anyone know how i can save the original site referer in a variable for use in a later page? for ex: homepage.php <?php session_start(); $_session["orig_referer"] = $_server[http_referer]; // do stuff then user goes to page2.php ?> page2.php <? session_start(); echo $_session["orig_referer"]; ?> what i want echoed in page2.php is the original referer, but unfortunately i get homepage.php as the referer. any thoughts on how to save the original refer w/o cookies, DB, passing in URL or saving to a file?
are you including the file with $_session["orig_referer"] = $_server[http_referer]; in every page? if that's the case, you can use an if statement to stop it being reset if (!isset($_SESSION['orig_referer'])) { $_session["orig_referer"] = $_server[http_referer]; } Code (markup):
If you set it in the $_SESSION variable, it should not get reset. Edit: unless they click on another page and visit the homepage again. In that case, the code I gave you will also work.
it would seem that way but it isn't. for ex: on the homepage i did as a test: $_session[xyz]="hello"; $_session[orig_referer]=$_server[http_referer]; then echo $_session[xyz].$_session[orig_referer] would output: hello [then the true orig referer here] on page2.php session_start(); echo $_session[xyz].$_session[orig_referer] would output: hello homepage.php the $_session[orig_referer] seems to change as the referer changes despite any new assignment.