PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
xnex
Forum Newbie
Posts: 3 Joined: Thu Nov 04, 2004 4:58 pm
Post
by xnex » Thu Nov 04, 2004 5:06 pm
does anyone know how to send referer while redirecting with header()?
for example I have 2 pages,
redir.php has
Code: Select all
header("Location: http://blah.com/receive.php");
and receive.php has
Code: Select all
echo $HTTP_SERVER_VARSї'HTTP_REFERER'];
receive.php doesn't show anything for the referer, but I want it to have redir.php as the referer
I've tried putting this infront of the header() but it doesn't do anything
header("Referer:
http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html ");
thanks for any help
Weirdan | Help us, help you. Please use Code: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Thu Nov 04, 2004 5:32 pm
HTTP_REFERER is supposed to be tracked by user's browser, if it does not return the referer to your site you can't do anything about it. But you may pass the values from 'redir' to 'receive' via GET variables like this:
Code: Select all
header('Location: http://example.com/receive.php?referred_by=' . urlecode($_SERVERї'SCRIPT_URI']));
Code: Select all
echo isset($_GETї'referred_by']) ? $_GETї'referred_by'] : 'random hit';
xnex
Forum Newbie
Posts: 3 Joined: Thu Nov 04, 2004 4:58 pm
Post
by xnex » Thu Nov 04, 2004 6:01 pm
I was just using receive.php to test it, I would really be redirecting to sites other than mine.
is there no way to make sure it send a http referer, even a fake one?
thanks for the reply
rehfeld
Forum Regular
Posts: 741 Joined: Mon Oct 18, 2004 8:14 pm
Post
by rehfeld » Thu Nov 04, 2004 6:51 pm
xnex wrote: I was just using receive.php to test it, I would really be redirecting to sites other than mine.
is there no way to make sure it send a http referer, even a fake one?
thanks for the reply
nope