ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์Programmingจะเช็ค bot ที่เข้ามาเก็บข้อมูลแต่ Error
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: จะเช็ค bot ที่เข้ามาเก็บข้อมูลแต่ Error  (อ่าน 1047 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
krapalm
ก๊วนเสียว
*

พลังน้ำใจ: 10
ออฟไลน์ ออฟไลน์

กระทู้: 298



ดูรายละเอียด เว็บไซต์
« เมื่อ: 05 พฤษภาคม 2010, 15:06:08 »

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

code
โค๊ด:
<?php
error_reporting
(E_ALL);

//file_put_contents on php4
if (!function_exists(&#39;file_put_contents&#39;)) {
    
function file_put_contents($filename$data) {
        
$f = @fopen($filename, &#39;w&#39;);
        
if (!$f) {
            return 
false;
        } else {
            
$bytes fwrite($f$data);
            
fclose($f);
chmod($filename0666);
            return 
$bytes;
        }
    }
}


$bot "";
if (
strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;Yandex&#39;)){ $bot=&#39;Yandex&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;Googlebot&#39;)){$bot=&#39;Google&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;Mediapartners-Google&#39;)){$bot=&#39;Mediapartners-Google (Adsense)&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;Slurp&#39;)){$bot=&#39;Hot Bot search&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;WebCrawler&#39;)){$bot=&#39;WebCrawler search&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;ZyBorg&#39;)){$bot=&#39;Wisenut search&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;scooter&#39;)){$bot=&#39;AltaVista&#39;;}  
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;StackRambler&#39;)){$bot=&#39;Rambler&#39;;}  
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;Aport&#39;)){$bot=&#39;Aport&#39;;}  
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;lycos&#39;)){$bot=&#39;Lycos&#39;;}  
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;WebAlta&#39;)){$bot=&#39;WebAlta&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;yahoo&#39;)){$bot=&#39;Yahoo&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;msnbot&#39;)){$bot=&#39;msnbot1.0&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;ia_archiver&#39;)){$bot=&#39;Alexa search engine&#39;;}
else if (strstr($_SERVER[&#39;HTTP_USER_AGENT&#39;], &#39;FAST&#39;)){$bot=&#39;AllTheWeb&#39;;}


//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_botserialize(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[&#39;REMOTE_ADDR&#39;];

$bot_list[$bot] = array($day$time$ip);

//Save new data
file_put_contents($file_botserialize($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(&#39;d/m/Y&#39;,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(&#39;Google&#39;);
echo showbot(&#39;Alexa search engine&#39;);
echo showbot(&#39;Hot Bot search&#39;);
echo showbot(&#39;msnbot1.0&#39;);
?>

แล้วแทรกสคลิปนี้ลงใน footer
โค๊ด:
{php}include('/home/krapalmc/domains/krapalm.com/public_html/bookmarks/checkvbot.php');{/php}
บันทึกการเข้า

เก๋าลัดคุง
Verified Seller
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 196
ออฟไลน์ ออฟไลน์

กระทู้: 3,906



ดูรายละเอียด เว็บไซต์
« ตอบ #1 เมื่อ: 05 พฤษภาคม 2010, 15:14:27 »

file_get_contents   น่าเกิดจากระบุบ path ผิดหาไฟล์ไม่เจอครับ
บันทึกการเข้า

krapalm
ก๊วนเสียว
*

พลังน้ำใจ: 10
ออฟไลน์ ออฟไลน์

กระทู้: 298



ดูรายละเอียด เว็บไซต์
« ตอบ #2 เมื่อ: 05 พฤษภาคม 2010, 15:57:54 »

file_get_contents   น่าเกิดจากระบุบ path ผิดหาไฟล์ไม่เจอครับ

pังหาไม่เจอเลยครับว่าเกิดจากตรงไหน
บันทึกการเข้า

monthonsite
เจ้าพ่อบอร์ดเสียว
*

พลังน้ำใจ: 213
ออฟไลน์ ออฟไลน์

กระทู้: 3,204



ดูรายละเอียด เว็บไซต์
« ตอบ #3 เมื่อ: 05 พฤษภาคม 2010, 16:29:36 »

bot.txt chmod เป็น 777 หรือยัง
บันทึกการเข้า

1
2
ชนเผ่าอาข่า
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 158
ออฟไลน์ ออฟไลน์

กระทู้: 1,444



ดูรายละเอียด
« ตอบ #4 เมื่อ: 05 พฤษภาคม 2010, 16:29:49 »

file_get_contents   น่าเกิดจากระบุบ path ผิดหาไฟล์ไม่เจอครับ


pังหาไม่เจอเลยครับว่าเกิดจากตรงไหน


ลองทำตามกระทู้นี้ดูครับ

http://www.thaiseoboard.com/index.php/topic,56232.160.html
บันทึกการเข้า
krapalm
ก๊วนเสียว
*

พลังน้ำใจ: 10
ออฟไลน์ ออฟไลน์

กระทู้: 298



ดูรายละเอียด เว็บไซต์
« ตอบ #5 เมื่อ: 05 พฤษภาคม 2010, 17:32:41 »

bot.txt chmod เป็น 777 หรือยัง

ทำแล้วครับ ที่นี้ไม่ขึ้นอะไรเลย อาจจะเป็นไปได้ว่าบอทยังไม่มาเพราะพึ่งทำเสร็จใหม่ๆ ครับ
บันทึกการเข้า

krapalm
ก๊วนเสียว
*

พลังน้ำใจ: 10
ออฟไลน์ ออฟไลน์

กระทู้: 298



ดูรายละเอียด เว็บไซต์
« ตอบ #6 เมื่อ: 05 พฤษภาคม 2010, 17:34:58 »

file_get_contents   น่าเกิดจากระบุบ path ผิดหาไฟล์ไม่เจอครับ


pังหาไม่เจอเลยครับว่าเกิดจากตรงไหน


ลองทำตามกระทู้นี้ดูครับ

http://www.thaiseoboard.com/index.php/topic,56232.160.html

ทำแล้วครับ ที่นี้ไม่ขึ้นอะไรเลย
บันทึกการเข้า

กระเทยหัวล้าน
คนรักเสียว
*

พลังน้ำใจ: 8
ออฟไลน์ ออฟไลน์

กระทู้: 107



ดูรายละเอียด
« ตอบ #7 เมื่อ: 05 พฤษภาคม 2010, 20:52:23 »

ลองดูการเก็บ bot แบบเว็บนี้ซิ http://www.xn--c3c2aex8b9c7a8cn8d.com/
บันทึกการเข้า

ขออนุญาต เอาลายเซ็นต์พาดพิงกันเองในบอร์ดออกนะครับ [ USER ที่ชื่อ TOOAds.com ไหม!(ไม่ให้ความร่วมมือนะ!!!) รู้นะว่าใครปลอมตัว! 555 ไม่จบๆ+++ กระเทยผมดก! ]
หน้า: [1]   ขึ้นบน
พิมพ์