Page is a not externally linkable
- WebmasterWorld
-- Website Analytics - Tracking and Logging
---- Logs Show Surge, but Not Human?


seoskunk - 10:55 pm on Feb 24, 2012 (gmt 0)


OK this script will test if a bot or a browser.....

Create a file called zombietest.php at root level and copy this into it.. remember to set path to file


<?php
$ip=$_SERVER['REMOTE_ADDR'];
$filename="/path-to-file/zombie.txt"; //path to file
$content="IP $ip is a REAL Browser\n";
if (file_exists($filename)) {
$handle = fopen($filename, 'a');
fwrite($handle, $content,strlen($content));
fclose($handle);
}
?>


Next Add this to the page getting hit at the bottom...


<?php
$ip=$_SERVER['REMOTE_ADDR'];
$filename="/path-to-file/zombie.txt";
$content="Is IP $ip a Browser?\n";
if (file_exists($filename)) {
$handle = fopen($filename, 'a');
fwrite($handle, $content,strlen($content));
fclose($handle);
} else {
$handle = fopen($filename, 'w');
fwrite($handle, $content,strlen($content));
fclose($handle);
}


?>
<script type="text/JavaScript">
<!--
var zombietest = "zombietest.php";
document.write('<iframe src="/' + zombietest + '" width="1px" height="1px"></iframe>');
//-->
</script>



Thats it now check results by opening text file called zombie.txt

I have an update on earlier script I posted as well


Thread source:: http://www.webmasterworld.com/analytics/4420174.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com