473,569 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is it possible to have more than one header(location : );

24 New Member
is it possible to have more than one header(location : );

or can i have one
header('Refresh : 3; url=login.php') ;
and
echo header('locatio n: index.php');
Jul 26 '07 #1
4 2039
pbmods
5,821 Recognized Expert Expert
Heya, fruityfreak.

To do that, redirect to login.php?targe t=index.php, and then have login.php redirect to $_GET['target'].
Jul 26 '07 #2
fruityfreak
24 New Member
what do u mean by that??
Jul 26 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, fruityfreak.

what do u mean by that??
In other words, if you wanted to (I'm assuming) log the User out, you could do this:

Expand|Select|Wrap|Line Numbers
  1. header('Location: login.php?target=index.php');
  2. exit();
  3.  
Which would pass 'index.php' as the value of $_GET['target'] to login.php.

And then at the bottom of login.php:
Expand|Select|Wrap|Line Numbers
  1. if(! empty($_GET['target']))
  2. {
  3.     header('Location: ' . $_GET['target']);
  4. }
  5. else
  6. {
  7.     header('Location: someDefaultLocation.ext');
  8. }
  9. exit();
  10.  
Jul 26 '07 #4
kovik
1,044 Recognized Expert Top Contributor
With absolute URLs as the Location header directive. ;)
Jul 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
6244
by: Jeff | last post by:
I've been able to find this question on a Google group search but not the answer. Plus I'm a late convert to php transferring over from ASP. I hope this isn't too many strikes against me. When I issue a "header(Location:/myscript.php?key1=value1&key2=value2);" the redirect happens just fine but the url in the address field keeps the...
6
18263
by: Filth | last post by:
Hi this is probably very easy to sort but I want to do the following:- header( "Location: subscribe_form.php?name='.$_GET.'&email='.$_GET.'"); but this pulls up the error:- Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
10
5621
by: Margaret MacDonald | last post by:
I'm seeing a problem that has me flummoxed. The only thing I can think of is that I'm violating some rule I don't know about. I have some code that does some processing and then does a header('Location: ...) jump to page A on success or falls through to the jump to page B. This is the code: if ( mysql_query( 'LOCK TABLES tableX WRITE',...
2
8828
by: Ladbroke | last post by:
Hiya, got a little prob with the syntax for header ( ' Location .... with variable). Usually examples are given with a complete URL, like: ..... header( 'Location: login/testsite/start.php' ); I'd like to use particular read out data from my database (URL) (variable $result).
6
5438
by: P-Rage | last post by:
Hello everyone, I was wondering what could possibly cause Internet Explorer 6 to loop a page usging a header(Location:) statement. For example, a page called 'page1.php': if((isset($_POST)) && ($name='valid')){ // insert some data into MySQL.
4
10411
by: geshan | last post by:
In php5 I am not able to use include funciton and header("location:""" together please help.
8
39219
by: php newbie | last post by:
I have a simple php page in which I use header("Location: http://www.example.com/"); to redirect the user to another php page. The php script works on my local machine but when I upload it to the web server for hosting the redirection does not work. Instead on one server it gives the standard header error Warning: Cannot modify header...
4
3114
by: henryrhenryr | last post by:
I'm using Win2k with Apache 2, PHP 5.2 for my local test server. My problem is that I think the header('Location ...') function isn't sending the header immediately and the rest of my script is running before the page redirects. I am using a $_SESSION array to transfer messages from one page to the next. I want the message available only...
8
39762
by: pedalpete | last post by:
I thought this should be simple, but i can't seem to get it to work. I'm trying to do a simple redirect to a page, but need to pass a variable. I've tried a few things, but nothing seems to work. here's what I've tried header('Location: edit.php?sid=$sid');
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.