Re: Re[2]: [PHP] Newbie redirect/variable question
| From: | bill | Date: | Thu, 10 May 2001 14:32:39 +0000 |
| Subject: | Re: Re[2]: [PHP] Newbie redirect/variable question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52289@lists.php.net to get a copy of this message | ||
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 :-))).