|
From: OryNider <ory...@us...> - 2007-06-26 16:02:19
|
Update of /cvsroot/mxbb/mx_online_adv/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25899/includes Added Files: functions.php online_adv_hack.php online_common.php Log Message: --- NEW FILE: online_common.php --- <?php /** * * @package mxBB Portal Module - mx_online_adv * @version $Id: online_common.php,v 1.1 2007/06/26 16:02:12 orynider Exp $ * @copyright (c) 2002-2006 [OryNider] mxBB Development Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ // // Security check // if( !defined('IN_PORTAL') ) { die("Hacking attempt"); } // // Define table names. // // Online Adv Tables !defined('ONLINE_ADV_SESSION_TABLE') ? define('ONLINE_ADV_SESSION_TABLE', $mx_table_prefix.'online_adv_session') : false; // ********************************************************************** // Read language definition // ********************************************************************** if ( !file_exists( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ) ) { include( $module_root_path . 'language/lang_english/lang_main.' . $phpEx ); $link_language='lang_english'; } else { include( $module_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.' . $phpEx ); $link_language='lang_' . $board_config['default_lang']; } include_once($module_root_path . 'includes/functions.'.$phpEx); // //Set Time and Period // //$period = 1240000000; $period = 1200000000; $time = date("U"); //$this_period = $board_config['session_length']*1000000; // //Get The User Agent // global $_SERVER, $HTTP_USER_AGENT, $HTTP_SERVER_VARS; if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; } else if ( !empty( $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ) ) { $HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT']; } else if ( !isset( $HTTP_USER_AGENT ) ) { $HTTP_USER_AGENT = ''; } if ( empty( $user_agent ) ) { $user_agent = $HTTP_USER_AGENT; } $user_agent = strtolower( $user_agent ); // Determine browser and version // The order in which we test the agents patterns is important // Intentionally ignore Konquerer. It should show up as Mozilla. // post-Netscape Mozilla versions using Gecko show up as Mozilla 5.0 // known browsers, list will be updated routinely, check back now and then // covers Netscape 6-7, K-Meleon, Most linux versions, uses moz array below // search engine spider bots: // various http utility libaries // download apps if ( preg_match( '/(googlebot |google\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(google )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(googlebot )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(googlebot-mobile )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(googlebot-image )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(adsbot-google )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(mediapartners-google |adsense\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/([Gg][Oo][Oo][Gg][Ll][Ee]*)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahoo-verticalcrawler |yahoo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahoo! slurp |yahoo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahooseeker |yahoo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahoo-mm |yahoomm\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(inktomi |inktomi\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(lycosbot |lycos\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(infoseekbot |infoseek\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(slurp |inktomi\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(fast-webcrawler |fast\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot |msn\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-media |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-newsblogs |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-products |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-academic |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msn )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(altavistabot |altavista\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(excitebot |excite\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(ask jeeves |ask\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(teoma |ask\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(scooter |scooter\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(openbot |openbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(ia_archiver |ia_archiver\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(zyborg |looksmart\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(almaden |ibm\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(baiduspider |baidu\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(psbot |psbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(gigabot |gigabot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(naverbot |naverbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(surveybot |surveybot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(boitho.com-dc |boitho\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(objectssearch |objectsearch\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(answerbus |answerbus\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(sohu-search |sohu\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(iltrovatore-setaccio |il-set\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(opera |opera\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msie )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(mozilla\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(phoenix\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(firebird\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(omniweb |omni\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(konqueror |konq\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(safari |saf\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(gecko |moz\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(netpositive |netp\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(lynx |lynx\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(elinks |elinks\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(links |links\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(w3m |w3m\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(webtv |webtv\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(amaya |amaya\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(dillo |dillo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(ibrowsevibrowse |ibrowsevibrowse\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(icab |icab\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(crazy browser |ie\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(sonyericssonp800 |sonyericssonp800\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(aol )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(camino )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(w3c_validator |w3c\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(wdg_validator |wdg\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(libwww-perl |libwww-perl\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(jakarta commons-httpclient |jakarta\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(python-urllib |python-urllib\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(getright |getright\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(wget |wget\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; else { $matches[1] = 'unknown'; $matches[2] = 0; $matches[3] = 0; } $majorver = $matches[2]; $minorver = $matches[3]; $ver = $matches[2] . '.' . $matches[3]; switch ($matches[1]) { case 'googlebot ': case 'google ': case 'googlebot-mobile ': case 'googlebot-image ': case 'adsbot-google ': case 'mediapartners-google ': case 'adsense ': $agent = 'google'; $bot_id = '1'; break; case 'yahoo-verticalcrawler ': case 'yahoo ': case 'yahoo! slurp ': case 'yahoo-mm ': case 'yahoomm ': case 'inktomi ': $agent = 'yahoo'; $bot_id = '2'; break; case 'lycosbot ': case 'lycos ': $agent = 'lycos'; $bot_id = '3'; break; case 'infoseekbot ': case 'infoseek ': $agent = 'infoseek'; $bot_id = '4'; break; case 'msnbot ': case 'msn ': case 'msnbot-newsblogs ': case 'msnbot-products ': case 'msnbot-academic ': $agent = 'msn'; $bot_id = '5'; break; case 'altavistabot ': case 'altavista ': $agent = 'altavista'; $bot_id = '6'; break; case 'excitebot ': case 'excite ': $agent = 'excite'; $bot_id = '7'; break; case 'ask jeeves ': case 'ask ': $agent = 'askjeeves'; $bot_id = '8'; break; case 'slurp ': case 'fast-webcrawler ': case 'teoma ': case 'scooter ': case 'openbot ': case 'ia_archiver ': case 'zyborg ': case 'looksmart ': case 'almaden ': case 'baiduspider ': case 'baidu ': case 'psbot ': case 'gigabot ': case 'naverbot ': case 'surveybot ': case 'boitho.com-dc ': case 'boitho ': case 'objectssearch ': case 'answerbus ': case 'sohu-search ': case 'sohu ': case 'iltrovatore-setaccio ': case 'il-set ': $agent = 'BOT'; $bot_id = '9'; break; default: $agent = 'browser'; $bot_id = ''; } // Determine platform // This is very incomplete for platforms other than Win/Mac if ( preg_match( '/(win|mac|linux|unix|x11|freebsd|beos|os2|irix|sunos|aix)/', $user_agent, $matches ) ); else $matches[1] = 'unknown'; switch ($matches[1]) { case 'win': $platform = 'Win'; break; case 'mac': $platform = 'Mac'; break; case 'linux': $platform = 'Linux'; break; case 'unix': case 'x11': $platform = 'Unix'; break; case 'freebsd': $platform = 'FreeBSD'; break; case 'beos': $platform = 'BeOS'; break; case 'os2': $platform = 'OS2'; break; case 'irix': $platform = 'IRIX'; break; case 'sunos': $platform = 'SunOS'; break; case 'aix': $platform = 'Aix'; break; case 'palm': $platform = 'PalmOS'; break; case 'unknown': $platform = 'Other'; break; default: $platform = 'Oops!'; } //$agent = 'google'; //$bot_id = '1'; if ( !empty($bot_id) ) { online_spider_surfing($agent,$bot_id); } else { if(strpos($user_agent, 'googlebot') > -1) { $agent = 'google'; $bot_id = '1'; } elseif(strpos($user_agent, 'google') > -1) { $agent = 'google'; $bot_id = '1'; } elseif(strpos($user_agent, 'yahoo') > -1) { $agent = 'yahoo'; $bot_id = '2'; } elseif(strpos($user_agent, 'lycos') > -1) { $agent = 'lycos'; $bot_id = '3'; } elseif(strpos($user_agent, 'msnbot') > -1) { $agent = 'msn'; $bot_id = '5'; } if ( !empty($bot_id) ) { online_spider_surfing($agent,$bot_id); } } $sql = "SELECT * FROM ". ONLINE_ADV_SESSION_TABLE ." WHERE bot_id = $bot_id"; if( !($result = $db->sql_query($sql)) ) { if ($bot_id) { online_spider_surfing($agent,$bot_id); } } else { update_spiders_surfing($agent,$time,$bot_id); } $current_time=date("U"); //prevent delay $period=$period+2; // Calcul max_time $max_time=$current_time-$period; $sql2 = "SELECT * FROM ". ONLINE_ADV_SESSION_TABLE ." WHERE time<'$max_time'"; if( ($result = $db->sql_query($sql2)) ) { drop_spiders_surfing($period); } ?> --- NEW FILE: online_adv_hack.php --- <?php /** * * @package mxBB Portal Module - mx_online_adv * @version $Id: online_adv_hack.php,v 1.1 2007/06/26 16:02:04 orynider Exp $ * @copyright (c) 2002-2006 [OryNider, Horace] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ /****************************************************************** * MODIFICATIONS * --------------- * started : 26/06/2007 * copyright : © mxBB-Development Team (OryNider) * email : ory...@rd... * version : 1.0 * * MODIFICATIONS: * * 26/06/2007 - First Try * (This file to be inluded in common.php) * ******************************************************************/ /********************************************************************** // Code to be inluded at the end of common.php for mx_online_adv BEGIN if (file_exists($mx_root_path . 'modules/mx_online_adv/includes/online_adv_hack.'.$phpEx)) { include_once($mx_root_path . 'modules/mx_online_adv/includes/online_adv_hack.'.$phpEx); } // Code to be inluded at the end of common.php for mx_online_adv END **********************************************************************/ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } // // Define table names. // // Online Adv Tables !defined('ONLINE_ADV_SESSION_TABLE') ? define('ONLINE_ADV_SESSION_TABLE', $mx_table_prefix.'online_adv_session') : false; include_once($mx_root_path . 'modules/mx_online_adv/includes/functions.'.$phpEx); // //Set Time and Period // //$this_period = 1240000000; $this_period = 1190000000; $time = date("U"); //$this_period = $board_config['session_length']*1000000; // //Get The User Agent // // //Get The User Agent // global $_SERVER, $HTTP_USER_AGENT, $HTTP_SERVER_VARS; if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) ) { $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT']; } else if ( !empty( $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ) ) { $HTTP_USER_AGENT = $HTTP_SERVER_VARS['HTTP_USER_AGENT']; } else if ( !isset( $HTTP_USER_AGENT ) ) { $HTTP_USER_AGENT = ''; } if ( empty( $user_agent ) ) { $user_agent = $HTTP_USER_AGENT; } $user_agent = strtolower( $user_agent ); // Determine browser and version // The order in which we test the agents patterns is important // Intentionally ignore Konquerer. It should show up as Mozilla. // post-Netscape Mozilla versions using Gecko show up as Mozilla 5.0 // known browsers, list will be updated routinely, check back now and then // covers Netscape 6-7, K-Meleon, Most linux versions, uses moz array below // search engine spider bots: // various http utility libaries // download apps if ( preg_match( '/(googlebot |google\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(google )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(googlebot )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(googlebot-mobile )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(googlebot-image )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(adsbot-google )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(mediapartners-google |adsense\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/([Gg][Oo][Oo][Gg][Ll][Ee]*)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahoo-verticalcrawler |yahoo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahoo! slurp |yahoo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahooseeker |yahoo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(yahoo-mm |yahoomm\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(inktomi |inktomi\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(lycosbot |lycos\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(infoseekbot |infoseek\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(slurp |inktomi\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(fast-webcrawler |fast\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot |msn\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-media |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-newsblogs |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-products |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msnbot-academic |msnbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msn )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(altavistabot |altavista\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(excitebot |excite\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(ask jeeves |ask\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(teoma |ask\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(scooter |scooter\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(openbot |openbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(ia_archiver |ia_archiver\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(zyborg |looksmart\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(almaden |ibm\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(baiduspider |baidu\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(psbot |psbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(gigabot |gigabot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(naverbot |naverbot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(surveybot |surveybot\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(boitho.com-dc |boitho\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(objectssearch |objectsearch\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(answerbus |answerbus\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(sohu-search |sohu\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(iltrovatore-setaccio |il-set\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(opera |opera\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(msie )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(mozilla\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(phoenix\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(firebird\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(omniweb |omni\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(konqueror |konq\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(safari |saf\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(gecko |moz\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(netpositive |netp\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(lynx |lynx\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(elinks |elinks\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(links |links\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(w3m |w3m\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(webtv |webtv\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(amaya |amaya\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(dillo |dillo\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(ibrowsevibrowse |ibrowsevibrowse\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(icab |icab\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(crazy browser |ie\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(sonyericssonp800 |sonyericssonp800\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(aol )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(camino )([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(w3c_validator |w3c\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(wdg_validator |wdg\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(libwww-perl |libwww-perl\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(jakarta commons-httpclient |jakarta\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(python-urllib |python-urllib\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(getright |getright\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; elseif ( preg_match( '/(wget |wget\/)([0-9]*).([0-9]{1,2})/', $user_agent, $matches ) ) ; else { $matches[1] = 'unknown'; $matches[2] = 0; $matches[3] = 0; } $majorver = $matches[2]; $minorver = $matches[3]; $ver = $matches[2] . '.' . $matches[3]; switch ($matches[1]) { case 'googlebot ': case 'google ': case 'googlebot-mobile ': case 'googlebot-image ': case 'adsbot-google ': case 'mediapartners-google ': case 'adsense ': $this_agent = 'google'; $this_bot_id = '1'; break; case 'yahoo-verticalcrawler ': case 'yahoo ': case 'yahoo! slurp ': case 'yahoo-mm ': case 'yahoomm ': case 'inktomi ': $this_agent = 'yahoo'; $this_bot_id = '2'; break; case 'lycosbot ': case 'lycos ': $this_agent = 'lycos'; $this_bot_id = '3'; break; case 'infoseekbot ': case 'infoseek ': $this_agent = 'infoseek'; $this_bot_id = '4'; break; case 'msnbot ': case 'msn ': case 'msnbot-newsblogs ': case 'msnbot-products ': case 'msnbot-academic ': $this_agent = 'msn'; $this_bot_id = '5'; break; case 'altavistabot ': case 'altavista ': $this_agent = 'altavista'; $this_bot_id = '6'; break; case 'excitebot ': case 'excite ': $this_agent = 'excite'; $this_bot_id = '7'; break; case 'ask jeeves ': case 'ask ': $this_agent = 'askjeeves'; $this_bot_id = '8'; break; case 'slurp ': case 'fast-webcrawler ': case 'teoma ': case 'scooter ': case 'openbot ': case 'ia_archiver ': case 'zyborg ': case 'looksmart ': case 'almaden ': case 'baiduspider ': case 'baidu ': case 'psbot ': case 'gigabot ': case 'naverbot ': case 'surveybot ': case 'boitho.com-dc ': case 'boitho ': case 'objectssearch ': case 'answerbus ': case 'sohu-search ': case 'sohu ': case 'iltrovatore-setaccio ': case 'il-set ': $this_agent = 'BOT'; $this_bot_id = '9'; break; default: $this_agent = 'browser'; $this_bot_id = ''; } // Determine platform // This is very incomplete for platforms other than Win/Mac if ( preg_match( '/(win|mac|linux|unix|x11|freebsd|beos|os2|irix|sunos|aix)/', $user_agent, $matches ) ); else $matches[1] = 'unknown'; switch ($matches[1]) { case 'win': $platform = 'Win'; break; case 'mac': $platform = 'Mac'; break; case 'linux': $platform = 'Linux'; break; case 'unix': case 'x11': $platform = 'Unix'; break; case 'freebsd': $platform = 'FreeBSD'; break; case 'beos': $platform = 'BeOS'; break; case 'os2': $platform = 'OS2'; break; case 'irix': $platform = 'IRIX'; break; case 'sunos': $platform = 'SunOS'; break; case 'aix': $platform = 'Aix'; break; case 'palm': $platform = 'PalmOS'; break; case 'unknown': $platform = 'Other'; break; default: $platform = 'Oops!'; } //$this_agent = 'msn'; //$this_bot_id = '5'; if ( !empty($this_bot_id) ) { online_spider_surfing($this_agent,$this_bot_id); } else { if(strpos($user_agent, 'googlebot') > -1) { $this_agent = 'google'; $this_bot_id = '1'; } elseif(strpos($user_agent, 'google') > -1) { $this_agent = 'google'; $this_bot_id = '1'; } elseif(strpos($user_agent, 'yahoo') > -1) { $this_agent = 'yahoo'; $this_bot_id = '2'; } elseif(strpos($user_agent, 'lycos') > -1) { $this_agent = 'lycos'; $this_bot_id = '3'; } elseif(strpos($user_agent, 'msnbot') > -1) { $this_agent = 'msn'; $this_bot_id = '5'; } if ( !empty($this_bot_id) ) { online_spider_surfing($this_agent,$this_bot_id); } } $sql = "SELECT * FROM ". ONLINE_ADV_SESSION_TABLE ." WHERE bot_id = $this_bot_id"; if( !($result = $db->sql_query($sql)) ) { if ($this_bot_id) { online_spider_surfing($this_agent,$this_bot_id); } } else { update_spiders_surfing($this_agent,$time,$this_bot_id); } $current_time=date("U"); //prevent delay $this_period=$this_period+2; // Calcul max_time $max_time=$current_time-$this_period; $sql2 = "SELECT * FROM ". ONLINE_ADV_SESSION_TABLE ." WHERE time<'$max_time'"; if( ($result = $db->sql_query($sql2)) ) { drop_spiders_surfing($this_period); } // -------------------------------------------------------------------------------- // That's all Folks! // -------------------------------------------------------------------------------- ?> --- NEW FILE: functions.php --- <?php /** * * @package mxBBmodule_mx_pafileDB * @version $Id: functions.php,v 1.1 2007/06/26 16:01:52 orynider Exp $ * @copyright (c) 2002-2006 [Mohd Basri, PHP Arena, pafileDB, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if ( !defined( 'IN_PORTAL' ) ) { die( "Hacking attempt" ); } function online_spider_surfing($nick,$bot_id) { global $db; $current_time=date("U"); $sql = "DELETE FROM ".ONLINE_ADV_SESSION_TABLE." WHERE username = '".addslashes($nick)."'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'SQL Error in function online_spider_surfing()', '', __LINE__, __FILE__, $sql); } $sql = "INSERT INTO ".ONLINE_ADV_SESSION_TABLE." (username, time, bot_id)" . " VALUES ('" .addslashes($nick). "', '" .$current_time. "', '" .$bot_id. "')"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'SQL Error in function online_spider_surfing()', '', __LINE__, __FILE__, $sql); } } function update_spiders_surfing($nick,$time,$bot_id) { global $board_config, $db, $lang; $sql="update ".ONLINE_ADV_SESSION_TABLE." set time='$time' and bot_id='$bot_id' where username='$nick'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'SQL Error in function update_spiders_surfing()', '', __LINE__, __FILE__, $sql); } } function drop_spiders_surfing($period) { global $board_config, $db, $lang; $current_time=date("U"); //prevent delay $period=$period+2; // Calcul max_time $max_time=$current_time-$period; $sql = "DELETE FROM " . ONLINE_ADV_SESSION_TABLE . " WHERE time < '$max_time'"; if( !$result = $db->sql_query($sql) ) { mx_message_die(GENERAL_ERROR, 'SQL Error in function drop_spiders_surfing()', '', __LINE__, __FILE__, $sql); } } ?> |