inVINCEable Posted June 3, 2010 Share Posted June 3, 2010 I am checking referrers on a particular site, let's say domain.com/campaigns/2/ is where I am pointing them to. In there I have an index.php file that records the referrer as well as the request URL. Sometimes it is recorded correctly, such as "/campaigns/2/" and other times it comes up null. Either way they are hitting the file there, so what is the explanation as to why it would come up null? Thanks! Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted June 3, 2010 Share Posted June 3, 2010 Wow, your code is invisible. Oh wait...you didn't post any. Post the relevant code, even the db insert. Quote Link to comment Share on other sites More sharing options...
inVINCEable Posted June 3, 2010 Author Share Posted June 3, 2010 Sorry, I didn't mean to say it is a DB insert, it just logs the info in a file. Here is the info: Here is the php: <?php //lets log visitor information $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : ''; $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $remote_host = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : ''; $remote_port = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : ''; $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if(file_exists("info.txt")){ $file = fopen("info.txt", "a"); $info = "Referer: " . $referer . "\n\n"; $info .= "Query: " . $query . "\n\n"; $info .= "Request Method: " . $request_method . "\n\n"; $info .= "Host: " . $host . "\n\n"; $info .= "IP: " . $ip . "\n\n"; $info .= "Remote Host: " . $remote_host . "\n\n"; $info .= "Remote Port: " . $remote_port . "\n\n"; $info .= "Request URL: " . $request_uri . "\n\n"; $info .= "Agent: " . $agent . "\n\n"; $info .= "-----------------------------------------"; fwrite($file, $info); } else { $file = fopen("info.txt", "w"); $info = "Referer: " . $referer . "\n\n"; $info .= "Query: " . $query . "\n\n"; $info .= "Request Method: " . $request_method . "\n\n"; $info .= "Host: " . $host . "\n\n"; $info .= "IP: " . $ip . "\n\n"; $info .= "Remote Host: " . $remote_host . "\n\n"; $info .= "Remote Port: " . $remote_port . "\n\n"; $info .= "Request URL: " . $request_url . "\n\n"; $info .= "Agent: " . $agent . "\n\n"; $info .= "-----------------------------------------"; fwrite($file, $info); } ?> And here is the HTML file in its entirety: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Get My Email Guide</title> </head> <body> <?php //lets log visitor information $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; $query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : ''; $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $remote_host = isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : ''; $remote_port = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : ''; $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if(file_exists("info.txt")){ $file = fopen("info.txt", "a"); $info = "Referer: " . $referer . "\n\n"; $info .= "Query: " . $query . "\n\n"; $info .= "Request Method: " . $request_method . "\n\n"; $info .= "Host: " . $host . "\n\n"; $info .= "IP: " . $ip . "\n\n"; $info .= "Remote Host: " . $remote_host . "\n\n"; $info .= "Remote Port: " . $remote_port . "\n\n"; $info .= "Request URL: " . $request_uri . "\n\n"; $info .= "Agent: " . $agent . "\n\n"; $info .= "-----------------------------------------"; fwrite($file, $info); } else { $file = fopen("info.txt", "w"); $info = "Referer: " . $referer . "\n\n"; $info .= "Query: " . $query . "\n\n"; $info .= "Request Method: " . $request_method . "\n\n"; $info .= "Host: " . $host . "\n\n"; $info .= "IP: " . $ip . "\n\n"; $info .= "Remote Host: " . $remote_host . "\n\n"; $info .= "Remote Port: " . $remote_port . "\n\n"; $info .= "Request URL: " . $request_url . "\n\n"; $info .= "Agent: " . $agent . "\n\n"; $info .= "-----------------------------------------"; fwrite($file, $info); } ?> <center>*Are You Looking to Go Ahead and Get My Email Guide? </center> <br /> <br /> <br /> <center> <ul> <li>Make Thousands Monthly</li> <li>Do All Kinds of Things You Couldn't Before</li> <li>Get Whatever Car You Want!</li> <li>If you said yes then click the link below!</li> </ul> </center> <center> <a href="http://www.tracklead.net/click.track?CID=107578&AFID=112392&ADID=241750&SID=fb"> Rags to Riches Story Here! </a> </center> </body> </html> Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted June 3, 2010 Share Posted June 3, 2010 $_SERVER['REQUEST_URI'] is the only value not showing up? And when you say NULL, is it printing NULL in the file or do you just mean no value is present? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.