I’d like to save the referring page to my site – only external sources and then pass it in a session to another page where I log this url. My site uses the index.php file to connect to all pages of the site (like a global include). So my problem is that I do record the referring url, but it is erased if a user passes from page to page – my script writes the previous page, instead of just saving the entrance url and that’s it. Anyone can help here?
hi put this in index.php session_start(); // Make sure the REFERER value is if(strstr($_SESSION['HTTP_REFERER'], "index.php") == false) { // Save the value in the $_SESSION array $_SESSION['origionalref'] = $_SERVER['HTTP_REFERER']; }
The variable is $_SERVER['HTTP_REFERER']; However, there's no way to reliably do this. The referrer is not set on all browsers and can be forged. It is not a reliable method of identifying where a visitor came from. If the referrer can be used for anything that could be a potential security or operational risk, expect it to happen at some point.