ผมจะเช็ค bot ที่เข้ามาเก็บข้อมูลโดยใช้ Code จากเว็บนี้แหละครับ แต่พอไปวางมันขึ้น error ตามภาพ

code
<?php
error_reporting(E_ALL);
//file_put_contents on php4
if (!function_exists('file_put_contents')) {
function file_put_contents($filename, $data) {
$f = @fopen($filename, 'w');
if (!$f) {
return false;
} else {
$bytes = fwrite($f, $data);
fclose($f);
chmod($filename, 0666);
return $bytes;
}
}
}
$bot = "";
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Yandex')){ $bot='Yandex';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Googlebot')){$bot='Google';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mediapartners-Google')){$bot='Mediapartners-Google (Adsense)';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Slurp')){$bot='Hot Bot search';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'WebCrawler')){$bot='WebCrawler search';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'ZyBorg')){$bot='Wisenut search';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'scooter')){$bot='AltaVista';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'StackRambler')){$bot='Rambler';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'Aport')){$bot='Aport';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'lycos')){$bot='Lycos';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'WebAlta')){$bot='WebAlta';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'yahoo')){$bot='Yahoo';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'msnbot')){$bot='msnbot1.0';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'ia_archiver')){$bot='Alexa search engine';}
else if (strstr($_SERVER['HTTP_USER_AGENT'], 'FAST')){$bot='AllTheWeb';}
//File bot cache
$file_bot = "bot.txt";
$tdiff = 3600 * 7; // เปลี่ยนจาก 0 เป็น 7 ถ้า Server นอก (GMT) หรือเพิ่มลดได้ตามแต่ Time Zone อยู่ที่ได (GMT -12 ถึง GMT +13)
if(!file_exists($file_bot)) {
file_put_contents($file_bot, serialize(array()));
}
if(!empty($bot)) {
//Get old data
$bot_list = unserialize(file_get_contents($file_bot));
$day = date("d/m/Y",time() + $tdiff);
$time = date("H:i:s",time() + $tdiff);
$ip = $_SERVER['REMOTE_ADDR'];
$bot_list[$bot] = array($day, $time, $ip);
//Save new data
file_put_contents($file_bot, serialize($bot_list));
}
$thai_month[1] = "มกราคม";
$thai_month[2] = "กุมภาพันธ์";
$thai_month[3] = "มีนาคม";
$thai_month[4] = "เมษายน";
$thai_month[5] = "พฤษภาคม";
$thai_month[6] = "มิถุยายน";
$thai_month[7] = "กรกฎาคม";
$thai_month[8] = "สิงหาคม";
$thai_month[9] = "กันยายน";
$thai_month[10] = "ตุลาคม";
$thai_month[11] = "พฤศจิกายน";
$thai_month[12] = "ธันวาคม";
function showbot($botname) {
global $bot_list, $file_bot, $thai_month, $tdiff;
if(!isset($bot_list)) {
$bot_list = unserialize(file_get_contents($file_bot));
}
if(!isset($bot_list[$botname])) {
$out = "<dd><strong>บอทยังไม่ได้มาเก็บข้อมูล</strong></dd>";
} else {
list($day, $month, $year) = explode("/",$bot_list[$botname][0]);
$month = number_format($month);
list($hour, $minute, $second) = explode(":",$bot_list[$botname][1]);
$ip = $bot_list[$botname][2];
$out = "<dd>- บอท ".$botname ." ($ip) ";
if(date('d/m/Y',time()+$tdiff) == $bot_list[$botname][0]){
$out .= " มา วันนี้";
}else{
$out .=" มา เมื่อวันที่ ".$day." ".$thai_month[$month]." ". ($year+543);
}
$out .= " เวลา ". $hour. ".".$minute." น.</dd>";
}
return $out;
}
//Show last bot
echo showbot('Google');
echo showbot('Alexa search engine');
echo showbot('Hot Bot search');
echo showbot('msnbot1.0');
?>
แล้วแทรกสคลิปนี้ลงใน footer
{php}include('/home/krapalmc/domains/krapalm.com/public_html/bookmarks/checkvbot.php');{/php}