Page 1 of 1

Bots Online

PostPosted: Wed Mar 05, 2008 2:26 pm
Author: Helter
I came across this simple mod that has been requested dozens of times. Works well with a little modification.

 ################################################################ MOD Title]http://www.phpbb-seo.com/#[/url]# MOD De.scription:    Adds the bots browsing the forum in the index viewonline, one entry per bot.#### MOD Version:     0.0.2#### Installation Level:  (EASY)## Installation Time:   5 Minutes## Files To Edit:   (5)##           includes/page_header.php##           includes/functions.php       ##           language/lang_english/lang_main.php##           templates/Integra2/index_body.tpl#### Included Files:   (1)################################################################## Author Notes:## _____________## ## This mod will add the bots name currently browsing the forum pages in the who is online block on forum index.## Each bots uses a special color.#### Example :##  In total there is 25 user online :: 8 Registered, 2 Hidden, 11 Guests and 4 Bots##                                         ^^^^^^^^^##  Bots : Google , Yahoo! (2), MSN## ## As you can see, if a bot is crawling your forum with several IPs, it won't be listed several times.## The number of occurrences will be added after the bot's name, if applicable.## ## Bot detection is performed using IP ranges for a lot faster and handier use. ## For example Google can be detected with this range : 66.249.xx.xx## Ip range test means a lot less tests and a lot less IP updates.## Some will argue there could be false positive, as even if the whole ip Range is owned by Google,## not all IPs are used to crawl.## Our answer is this is a cosmetic mod, not a bot tracking mod, would you prefer to perform hundreds of IP ## tests within this range and Check UAs to make sure you're being crawled on each page load ?## Would this be worth it for the few times you could get false positives ?#### Of course it could occur that a search engine starts using new IP ranges. And thus an IP range list update ## on this mod, but, this is rather a rare occurrence.## ## The default Ip range list will allow for Google, Yahoo! and MSN bot recognition.#### License: [url=http://opensource.org/licenses/gpl-license.php]http://opensource.org/licenses/gpl-license.php[/url] GNU General Public License v2 ################################################################ MOD History:####   2007-01-19 - 0.0.2##       - First Release####   2006-12-23 - 0.0.1##       - Internal beta version.################################################################## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD##############################################################    ##-----[ DIY INSTRUCTIONS ]------------------------------------------#  Upload : contrib/xs_simple_show_bots.cfg to:  root/admin  and  root/admin/modules      ##-----[ OPEN ]----------------------------------------------#  includes/page_header.php  ##-----[ FIND ]----------------------------------------------#  define('HEADER_INC', TRUE);  ##-----[ AFTER, ADD ]----------------------------------------------#  // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN - BOTS$bots_online = array();$online_botlist = '';$bot_count = 0;$bot_style = array( 'Google' => 'style="color:#2159D6;font-weight:bold"', 'MSN' => 'style="color:#52BA18;font-weight:bold"', 'Yahoo!' => 'style="color:#FF0031;font-weight:bold"' );$bot_to_style = array( 'Google', 'Yahoo!', 'Yahoo!' , 'Yahoo!', 'MSN',  'MSN', 'MSN', 'MSN');$bot_ips = array( '66.249', '74.6', '66.196', '66.142', '64.4', '65.5', '131.107', '207.46' );// [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END - BOTS  ##-----[ FIND ]----------------------------------------------#               // Skip multiple sessions for one user             if ( $row['session_ip'] != $prev_session_ip )             {                 $row['style'] = '';                 $connected[] = $row;    ##-----[ AFTER, ADD ]----------------------------------------------#                   // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN                 $bot_id = is_bot(decode_ip($row['session_ip']));                 if ( $bot_id >=0 ) {                     $guests_online--;                     $bot_count++;                     if ( !array_key_exists($bot_to_style[$bot_id], $bots_online) ) {                         $bots_online[$bot_to_style[$bot_id]] = 1;                     } else {                         $bots_online[$bot_to_style[$bot_id]] ++;                     }                 }                 // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END##-----[ FIND ]----------------------------------------------#     if ( empty($online_userlist) )     {         $online_userlist = $lang['None'];     }  ##-----[ BEFORE, ADD ]----------------------------------------------#     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN     if ( !empty($bots_online) ) {         foreach ( $bots_online as $bot => $bot_num) {             $bot_cnt = ( $bot_num > 1) ? "($bot_num)" : '';             $online_botlist .= (($online_botlist!='') ? ', ' : '') . "<span>$bot $bot_cnt</span>";         }     }     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END  ##-----[ FIND ]----------------------------------------------#       $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;  ##-----[ AFTER, ADD ]----------------------------------------------#     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN     $total_online_users += $bot_count;     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END ##-----[ FIND ]----------------------------------------------#       else     {         $l_g_user_s = $lang['Guest_users_total'];     }  ##-----[ AFTER, ADD ]----------------------------------------------#       // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN     if ( $bot_count == 0 ) {         $l_bot = $lang['Bot_nul'];     } else if ( $bot_count == 1 ) {         $l_bot = $lang['Bot_one'];     } else {         $l_bot = $lang['Bot_total'];     }     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END  ##-----[ FIND ]----------------------------------------------#       $l_online_users .= sprintf($l_g_user_s, $guests_online);  ##-----[ AFTER, ADD ]----------------------------------------------#       // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN     $l_online_users .= sprintf($l_bot, $bot_count);     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END  ##-----[ FIND ]----------------------------------------------#       'LOGGED_IN_USER_LIST' => $online_userlist,  ##-----[ AFTER, ADD ]----------------------------------------------#       // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN     'BOT_LIST' => $lang['Bot_online'] . ( ($online_botlist != '') ? $online_botlist : $lang['None']),     // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END  ##-----[ OPEN ]----------------------------------------------#includes/functions.php  ##-----[ FIND ]----------------------------------------------#  ?>    ##-----[ BEFORE, ADD ]----------------------------------------------#// [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN/*** tell if user is a bot on ip match*/function is_bot($user_ip) {     global $bot_ips;     if ( !empty($bot_ips) ) {         foreach ( $bot_ips as $bot_id => $bot_ip) {             if ( strpos(trim($user_ip), $bot_ip) === 0) {                 return $bot_id;             }         }     }     return -1;}// [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END  ##-----[ OPEN ]----------------------------------------------#  language/lang_english/lang_main.php    ##-----[ FIND ]----------------------------------------------#  $lang['Hidden_users_zero_total'] = '0 Hidden and ';$lang['Hidden_user_total'] = '%d Hidden and ';$lang['Hidden_users_total'] = '%d Hidden and ';$lang['Guest_users_zero_total'] = '0 Guests';$lang['Guest_users_total'] = '%d Guests';$lang['Guest_user_total'] = '%d Guest';    ##-----[ REPLACE WITH ]----------------------------------------------#  // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN$lang['Hidden_users_zero_total'] = '0 Hidden, ';$lang['Hidden_user_total'] = '%d Hidden, ';$lang['Hidden_users_total'] = '%d Hidden, ';$lang['Guest_users_zero_total'] = '0 Guests and ';$lang['Guest_users_total'] = '%d Guests and ';$lang['Guest_user_total'] = '%d Guest and ';$lang['Bot_online'] = 'Online Bots : ';$lang['Bot_nul'] = '0 Bots';$lang['Bot_total'] = '%d Bots';$lang['Bot_one'] = '%d Bot';// [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END    ##-----[ OPEN ]----------------------------------------------#  templates/subSilver/index_body.tpl    ##-----[ FIND ]----------------------------------------------#  {LOGGED_IN_USER_LIST}  ##-----[ IN-LINE FIND ]----------------------------------------------#  {LOGGED_IN_USER_LIST}    ##-----[ IN-LINE AFTER, ADD ]----------------------------------------------#  <br>{BOT_LIST}  ##-----[ SAVE/CLOSE ALL FILES ]------------------------------------------## EoM        FRENCH INSTALL :  The French lang code changes are the following :  OPEN :______  language/lang_french/lang_main.php  FIND :______  $lang['Hidden_users_zero_total'] = '0 Invisible et ';$lang['Hidden_user_total'] = '%d Invisible et ';$lang['Hidden_users_total'] = '%d Invisibles et ';$lang['Guest_users_zero_total'] = '0 InvitÃÂÂ ©';$lang['Guest_users_total'] = '%d InvitÃÂÂ ©s';$lang['Guest_user_total'] = '%d InvitÃÂÂ ©';  REPLACE WITH :______________  // [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT BEGIN$lang['Hidden_users_zero_total'] = '0 Invisible, ';$lang['Hidden_user_total'] = '%d Invisible, ';$lang['Hidden_users_total'] = '%d Invisibles, ';$lang['Guest_users_zero_total'] = '0 InvitÃÂÂ © et ';$lang['Guest_users_total'] = '%d InvitÃÂÂ ©s et ';$lang['Guest_user_total'] = '%d InvitÃÂÂ © et ';$lang['Bot_online'] = 'Bots : ';$lang['Bot_nul'] = '0 Bots';$lang['Bot_total'] = '%d Bots';$lang['Bot_one'] = '%d Bot';// [url=http://www.phpBB-SEO.com]http://www.phpBB-SEO.com[/url] SEO TOOLKIT END    

Re: Bots Online

PostPosted: Wed Mar 05, 2008 4:28 pm
Author: DjPorkchop
Thats pretty sweet. Yet another project for the ol' test site of mine. <img>

Re: Bots Online

PostPosted: Wed Mar 05, 2008 8:28 pm
Author: Helter
it is pretty basic, but it was the only one I could find that didnt require pcp intimacy.

I put it here only on the integrastyle template

Re: Bots Online

PostPosted: Wed Mar 05, 2008 10:04 pm
Author: CaNNon
Thanks, installed and looks fine.


*EDIT*
In total there are 17 users online :: 2 Registered, 0 Hidden, 11 Guests and 4 Bots


This part is showing on all of them <img>

Re: Bots Online

PostPosted: Thu Mar 06, 2008 10:56 am
Author: CaNNon
#-----[ AFTER, ADD ]----------------------------------------------
#

// http://www.phpBB-SEO.com SEO TOOLKIT BEGIN
$bot_id = is_bot(decode_ip($row['session_ip']));
if ( $bot_id >=0 ) {
$guests_online--;
$bot_count++;
if ( !array_key_exists($bot_to_style[$bot_id], $bots_online) ) {
$bots_online[$bot_to_style[$bot_id]] = 1;
} else {
$bots_online[$bot_to_style[$bot_id]] ++;
}
}
// http://www.phpBB-SEO.com SEO TOOLKIT END


After that add

// http://www.phpBB-SEO.com SEO TOOLKIT END
}
$prev_session_ip = $row['session_ip'];


With the toggles is the " } " here one to many?

Re: Bots Online

PostPosted: Thu Mar 06, 2008 11:05 am
Author: CaNNon
Never mind it does need it. <img>

Re: Bots Online

PostPosted: Thu Mar 06, 2008 1:01 pm
Author: jomasaco
woooo, nice long time i looking for this.

[flash=,:1wx319ks]http://i31.tinypic.com/bf2hk3.gif[/flash:1wx319ks]

Cuill are add by me. <img>

Re: Bots Online

PostPosted: Thu Mar 06, 2008 4:18 pm
Author: CaNNon
Please post your addition jomasaco.

Re: Bots Online

PostPosted: Fri Mar 07, 2008 3:49 am
Author: jomasaco
Is simples.

First go to the
http://www.iplists.com/

Here you can find lots of bots ip and agents, now pay attention, if you will add an range of ip's be careful it is only for some like google and yahoo, most of them have several ip's so include the full ip.

For this i add the agent on my "bot management" and copy the ip from there.

Now goes to the includes/page_header.php
And add the boot info.
$bot_style = only one add by bot is the style like that will appears, change the color to by more... kitsch
$bot_to_style = it must be add in same order like the ips (1ÂÂÂ º,2ÂÂÂ º,3ÂÂÂ º,4ÂÂÂ º...)
$bot_ips = the bot ip or ip range, in same order like the bot_to_style (1ÂÂÂ º,2ÂÂÂ º,3ÂÂÂ º...)

It cud by better if the detect are made by agent instead of ip.

btw, Users browsing this forum: None this still not working
I try to implement 2 new hacks, Only Display Users Online and User Always Browsing .
The first is ok. Only show if exists.
[flash=,:1f31jyy7]http://i32.tinypic.com/2zgt0gn.gif[/flash:1f31jyy7]

But the second i presume, this only show 1 i try whit an clone and don't show the name. And yes, i try to add the bots too whitout success, is too much for me.
[flash=,:1f31jyy7]http://i28.tinypic.com/2lomxl.gif[/flash:1f31jyy7]

sorry for my poor English <img>

PostPosted: Fri Apr 04, 2008 5:59 pm
Author: richiebgood
woo i have been looking for something like this for ages also, im gona try it now.

Does it work with the online block in portal also, or just on the user block on the index page?



*Edit, I also added it to my viewonline.php page.

1. Open /template/viewonline_body.tpl
2. find

<td>{TOTAL_GUEST_USERS_ONLINE}</td>

3. replace with <td>{TOTAL_GUEST_USERS_ONLINE} and {BOT_LIST} </td>

mine looks like: http://www.paintballer.ie/viewonline.php

Not much but something different.

Re: Bots Online

PostPosted: Fri Apr 04, 2008 9:20 pm
Author: CaNNon
It all helps! I have the "admin/index.php" edits from this tread working with it too.
If you add it only do the one file!

http://www.integramod.com/forum/viewtop ... highlight=