New2th โพสต์ 2011-7-26 21:10:27

[New2th] Show bot ในออนไลน์ list X 2.0

แก้ไขครั้งสุดท้ายโดย New2th เมื่อ 2011-7-26 21:37

http://image.free.in.th/z/ik/ggggg.png
(รูปด้านบนเอามาจาก x15 ขี้เกียจทำใหม่)



กรุณาสำรองไฟล์ก่อนทำการแก้ไขใดๆsm910dz


๑. ไปที่
เว็บของฉัน/admin.php?frames=yes&action=db&operation=runquery
ใส่โค้ดALTER TABLEpre_common_session ADDbotid TINYINT(2) UNSIGNED NOT NULL DEFAULT 0 AFTER tidกดส่ง

๒. เปิดไฟล์ ./source/class/class_core.php
เพิ่มfunction user2idbot($user_agent){
$user_agent = strtolower($user_agent);
if (strstr($user_agent, 'yandex')){ $bot=1;}
else if (strstr($user_agent, 'googlebot')){$bot=2;}
else if (strstr($user_agent, 'mediapartners-google')){$bot=3;}
else if (strstr($user_agent, 'slurp')){$bot=4;}
else if (strstr($user_agent, 'webcrawler')){$bot=5;}
else if (strstr($user_agent, 'zyborg')){$bot=6;}
else if (strstr($user_agent, 'scooter')){$bot=7;}
else if (strstr($user_agent, 'stackrambler')){$bot=8;}
else if (strstr($user_agent, 'aport')){$bot=9;}
else if (strstr($user_agent, 'lycos')){$bot=10;}
else if (strstr($user_agent, 'webalta')){$bot=11;}
else if (strstr($user_agent, 'yahoo')){$bot=12;}
else if (strstr($user_agent, 'msnbot')){$bot=13;}
else if (strstr($user_agent, 'ia_archiver')){$bot=14;}
else if (strstr($user_agent, 'fast')){$bot=15;}
else if (strstr($user_agent, 'facebook')){$bot=16;}
else if (strstr($user_agent, 'ia_archiver')){$bot=17;}
return $bot;
}

function idbot2user($botid){
if($botid==0){$user='';}
elseif($botid==1){$user='Yandex';}
elseif($botid==2){$user='<font face=times color=#0039b6>G</font><font face=times color=#c41200>o</font><font face=times color=#f3c518>o</font><font face=times color=#0039b6>g</font><font face=times color=#30a72f>l</font><font face=times color=#c41200>e</font>';}
elseif($botid==3){$user='<font face=times color=#0039b6>G</font><font face=times color=#c41200>o</font><font face=times color=#f3c518>o</font><font face=times color=#0039b6>g</font><font face=times color=#30a72f>l</font><font face=times color=#c41200>e</font> <span style="font-weight:bold;">Adsense</span>';}
elseif($botid==4){$user='Hot Bot search';}
elseif($botid==5){$user='WebCrawler search';}
elseif($botid==6){$user='Wisenut search';}
elseif($botid==7){$user='AltaVista';}
elseif($botid==8){$user='Rambler';}
elseif($botid==9){$user='Aport';}
elseif($botid==10){$user='Lycos';}
elseif($botid==11){$user='WebAlta';}
elseif($botid==12){$user='<span style="color:#65106e;font-weight:bold;">Yahoo!</span>';}
elseif($botid==13){$user='<span style="color:#eea930;font-weight:bold;">Bing</span>';}
elseif($botid==14){$user='Alexa search engine';}
elseif($botid==15){$user='AllTheWeb';}
// elseif($botid==16){$user='<span style="background:#3b5999;color:#ffffff;padding:0 2px 0 2px;font-weight:bold;">facebook</span>';}
elseif($botid==16){$user='<span style="color:#3b5999;font-weight:bold;">facebook</span>';}
elseif($botid==17){$user='Alexa';}
return $user;
}
หลังerror_reporting(0);หา        function update() {
                global $_G;
                if($this->sid !== null) {

                        $data = daddslashes($this->var);
                        if($this->isnew) {
                                $this->delete();
                                DB::insert('common_session', $data, false, false, true);
                        } else {
                                DB::update('common_session', $data, "sid='$data'");
                        }
                        $_G['session'] = $data;
                        dsetcookie('sid', $this->sid, 86400);
                }
        }เปลี่ยนเป็น        function update() {
                global $_G;
                if($this->sid !== null) {

                        $data = daddslashes($this->var);
                        if($this->isnew) {
                                $this->delete();
                                DB::insert('common_session', $data, false, false, true);
                $bot = user2idbot($_SERVER['HTTP_USER_AGENT']);
                if($bot){
                        DB::query('UPDATE pre_common_session SET botid='.$bot.' WHERE sid=\''.$this->sid.'\'');
               }
                        } else {
                                DB::update('common_session', $data, "sid='$data'");
                        }
                        $_G['session'] = $data;
                        dsetcookie('sid', $this->sid, 86400);
                }
        }๓. เปิดไฟล์ ./source/module/forum/forum_index.php
หา$query = DB::query("SELECT uid, username, groupid, invisible, lastactivity, fid FROM ".DB::table('common_session')." WHERE uid='0' ORDER BY uid DESC LIMIT ".($_G['setting']['maxonlinelist'] - $membercount));แก้เป็น$query = DB::query("SELECT uid, username, groupid, invisible, lastactivity, fid, botid FROM ".DB::table('common_session')." WHERE uid='0' ORDER BY uid DESC LIMIT ".($_G['setting']['maxonlinelist'] - $membercount));หา$online['username'] = $_G['cache']['onlinelist']['guest'];แก้เป็น                                        if($online['botid']){
                                                $online['username'] = idbot2user($online['botid']);
                                        }else{
                                                $online['username'] = $_G['cache']['onlinelist']['guest'];
                                        }เสร็จ byebyesm930dz
รอการอัพเดตซัก 15-30 นาทีsm935dz

New2th
อนุญาตให้ทำอะไรก็ได้ตามสบายถ้ายังอยู่ใน Discuzthai.comsm930dz

MasterTGZ โพสต์ 2011-7-26 21:50:07

แก้ไขครั้งสุดท้ายโดย MasterTGZ เมื่อ 2011-7-26 22:22

ขอบคุณครับบบบ sm945dzsm945dzsm945dz
ดีมากๆเลย sm949dz


เพิ่มเติม :: รอของ x2 มานาน 55555

damrongsak โพสต์ 2011-7-26 21:53:15

ขอบคุณครับ

damrongsak โพสต์ 2011-7-26 21:57:17

อัพเกรดผิดพลาด, ข้อความจาก MySQL: Duplicate column name 'botid'

[E]x[P] โพสต์ 2011-7-26 22:02:21

ขอบคุณครับ sm900dz

aaa.111 โพสต์ 2011-7-26 22:26:18

ขอบคุณมากครับ sm953dz

[E]x[P] โพสต์ 2011-7-27 10:38:49

ทำตามทุกตอนเลยแต่ไม่ขึนครับ

รอมาหลายช.มแล้วครับทำไงดี

MasterTGZ โพสต์ 2011-7-27 19:08:28

@kanzayo พี่นิวเขาก็บอกละเอียดแล้วนิ sm949dzsm949dz

abeerclup โพสต์ 2011-8-12 12:42:19

ขอบคุณมากครับ จะลองดูว่าใช้ได้ไหม

perng โพสต์ 2011-9-2 05:08:01

ผมก็ทำตามแล้วไม่ขึ้นครับ
หน้า: [1] 2 3 4
ดูในรูปแบบกติ: [New2th] Show bot ในออนไลน์ list X 2.0