Set as your index.php and then change the $goto variable to your main entrance page. You can view the log either by downloading the Comma Seperated File it creates or you can type index?view and it will show you a nice little table generated from the Comma Seperated File.
By : Rock
<?php /*/-----------------------------------------\ |Original Name : reflog.php | | Author : Neil | | Function : Generate a log of IP No.s | | and Exact Referring pages and the user | | agent after checking the HTTP_REFERER | | for a small expresstion. (Useful for | | checking the for a domain name in the | | HTTP_REFERER and then geting the entire| | path) | | You could run case or elseif's to run | | the check from multiple domains or | | expressions. You could get an exact | | log of refering pages if you were | | advertising, like in the original | | script, at Yell.co.uk. | \-----------------------------------------/
Definition of variables Logstring is the string to insert in to the logfile The log file name is specified by filename regexp is the expression to search for in the URL */ $date = gmdate("d/m/Y - H:i:s T"); //change to preffered format. $logstring = $date.",".$HTTP_SERVER_VARS['REMOTE_ADDR'].",".$HTTP_SERVER_VARS['HTTP_REFERER'].",".$HTTP_SERVER_VARS['HTTP_USER_AGENT']."\r"; $regexp = strtoupper("yell.co.uk"); //String to filter for. $filename = "./reflog.csv";
/* No cache!! */ $goto = "http://www.yoursite.com/main.html"; header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 /* End of No cache */
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.