Re: Redirect with referer info
| From: | Dotan Cohen | Date: | Sat, 30 Jul 2005 16:40:05 +0000 |
| Subject: | Re: Redirect with referer info | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219678@lists.php.net to get a copy of this message | ||
On 7/30/05, Joe Wollard <joe.wollard@gmail.com> wrote:
> To obtain a certain portion of the referring url you might look at
> parse_url();
> See http://us3.php.net/manual/en/function.parse-url.php
>
> - or -
>
> If you want to bounce the user right back to the previous page including get
> variables you could just use this snippet.
>
> <?php$referrer = $_SERVER['HTTP_REFERER'];
> header("Location: " . $referrer);
> exit;
> ?>
I must have not phased the question well. I have a page on
http://lyricslist.com that links to http://song-lirics.com and it is
very important that the request to http://song-lirics.com has
the
referer part of the request intact. There is no id=xxx or whatever,
the server at http://song-lirics.com looks at the $HTTP_REFERER
to
grant points. That works great when on http://lyricslist.com I
do a
simple <a href='~'>lyrics</a> to http://song-lirics.com, but I don't
want to do that. Instead, I link to another page on
http://lyricslist.com so that I can record how many people
clicked on
the link, and then I want to redirect to http://song-lirics.com
It's just that with the two redirect methods that I know of (header
and meta), the request to http://song-lirics.com gets there
with no
referer information, as if the user typed in the address.
If you want to see it, click:
http://song-lirics.com/sl/goto.php/4
You will be redirected to http://dotancohen.com
Look at the source code, in the first few lines you will see:
<!--
Refferer:
User_Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10)
Gecko/20050720 Fedora/1.0.6-1.1.fc4 Firefox/1.0.6
Time: July 30, 2005, 12:36 pm
-->
No referer! Try clicking around http://dotancohen.com and look
at the
source code: they all have referers!
Dotan Cohen
http://ie-only.com