logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Header location with get method

 
Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner



View previous topic :: View next topic  
Author Message
sb.net



Joined: 22 Sep 2006
Posts: 120
Location: USA

PostPosted: Thu 30 Nov '06 0:17    Post subject: Header location with get method Reply with quote

I have this:
Code:
<?php
$redir = $_GET["redir"];

header("Location: $redir");
?>


All that I get is it forwards it to $redir.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6255
Location: Germany, Next to Hamburg

PostPosted: Thu 30 Nov '06 10:32    Post subject: Reply with quote

your script works fine if $_GET is not empty Wink

http://127.0.0.1/test.php?redir=bla.htm

But id $_GET is empty there is no location where header an redirect to.

Code:

<?php
if($_GET['redir']!=""){
          $redir = $_GET['redir'];
}
else
{
         $redir='index.htm';
}

header("Location: $redir");
die();
?>
Back to top
sb.net



Joined: 22 Sep 2006
Posts: 120
Location: USA

PostPosted: Sat 02 Dec '06 17:03    Post subject: Reply with quote

Thanks Very Happy the script works great.
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Coding & Scripting Corner
Page 1 of 1