Re[2]: [PHP] Newbie redirect/variable question

From: Date: Thu, 10 May 2001 23:16:57 +0000
Subject: Re[2]: [PHP] Newbie redirect/variable question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52364@lists.php.net to get a copy of this message
:-) :-) Got it working - thanks heaps everyone :-) Out of interest - here's my current redirect.php... <?php if ($HTTP_GET_VARS['fred'] != "") { # $statement = "UPDATE links SET hits=hits+1 WHERE href=\"$u\""; # mysql_query($statement); $fred = $HTTP_GET_VARS['fred']; header("Location: $fred"); exit; } else { header("Location: $HTTP_REFERRER"); exit; } ?> and the updated referring code... <a href="redirect.php?fred=http://www.fusion.org.au">test link</a> Whew! Now to work on the hits counter bit... swadie ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Steve Wade Youth Outreach Coordinator Fusion Australia Ltd (Sydney North) ABN 26 001 273 105 +61 2 9477 1110 -----Original Message----- From: bill [mailto:billt@ifelse.org] Sent: Friday, 11 May 2001 0:33 To: Steve Wade Cc: PHP News Subject: Re: Re[2]: [PHP] Newbie redirect/variable question On Fri, 11 May 2001, Steve Wade wrote: > Thanks - hmm - doesn't seem to do it though. > > My current code is: > > <?php > > if ($HTTP_GET_VARS['fred'] != "") { > # $statement = "UPDATE links SET hits=hits+1 WHERE href=\"$u\""; > # mysql_query($statement); > header("Location: $HTTP_GET_VARS['fred']"); > exit; > } else { > header("Location: $HTTP_REFERRER"); > exit; > } > ?> > > which gives an error msg: > > Parse error: parse error, expecting T_STRING' or > T_VARIABLE' or > `T_NUM_STRING' in /home/swadie/public_html/redirect.php on line 6 > I noticed that you were passing the URL like this (from an earlier message): > > <a href="redirect.php?fred=www.fusion.org.au">test link</a> if you put this in Location: without prefixing it with "http://" it may be treated as a local url or something that is not what you intend. I don't think it is what is causing this specific error, but it could be the next one :-))). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#52364) next »