I am looking for a php script that shows where a visitor comes from. lets say Visitor A comes to my webpage via a link on domain.com The script will be able to show on the webpage "domain.com" using the echo function. I tried this: $_SERVER['HTTP_REFERER']; but all it shows is the URL of my own webpage instead of the referring webpage.
do you have a link that you are coming from or are you just typing in domain.com? that might be the problem...lol
duh. I DO have a link I am coming from. I placed a link on another of my website to test it. heres the full php code: <?php $referer = $_SERVER["HTTP_REFERER"]; $ipaddress = $_SERVER['REMOTE_ADDR']; // Requestor IP addr $request_uri = ltrim($_SERVER['REQUEST_URI'],'/'); if ($_SERVER["HTTP_REFERER"]) { $parsed = @parse_url(strtolower($referer)); if ($parsed[host] && !eregi(strtolower("domain.com"),$parsed[host])) { echo '<a href="http://'; echo str_replace("statistics.","www.",str_replace("stats.","www.",$parsed[host])); echo '/">'; echo ucfirst(str_replace("statistics.","",str_replace("stats.","",str_replace("www.","",$parsed[host]))))."</a>"; } } ?> PHP:
yeah, thats the good alternative, but I do not want to use it unless it is the only choice. I wanted a solution that can output to HTML (php) so that ppl cannot view the code I used. Javascript can be seen in View Source which is not what I want.