botsmod color
Geplaatst: 21 apr 2005, 18:41
hallo, ik heb de botsmod geinstalleerd, wil alleen de kleur veraderen bij de 'who is online' krijg dit alleen niet voor elkaar...
hier is de mod, iemand een idee??
hier is de mod, iemand een idee??
Code: Selecteer alles
#-----[ OPEN ]------------------------------------------------------
includes/sessions.php
#-----[ FIND ]-------------------------------------------------------
global $SID;
if ( !empty($SID) && !preg_match('#sid=#', $url) )
#-----[ REPLACE WITH ]-----------------------------------------------
global $SID;
if ( !empty($SID) && !preg_match('#sid=#', $url) && !IS_ROBOT )
#-----[ FIND ]-------------------------------------------------------
// Create or update the session
#-----[ INSERT BEFORE ]----------------------------------------------
$robot = ( ( defined('IS_ROBOT') ) ? IS_ROBOT : 0 );
#-----[ INLINE FIND ]------------------------------------------------
session_page = $page_id, session_logged_in = $login
#-----[ INLINE AFTER, ADD ]------------------------------------------
, is_robot = '$robot'
#-----[ INLINE FIND ]------------------------------------------------
session_page, session_logged_in
#-----[ INLINE AFTER, ADD ]------------------------------------------
, is_robot
#-----[ INLINE FIND ]------------------------------------------------
'$user_ip', $page_id, $login
#-----[ INLINE AFTER, ADD ]------------------------------------------
, '$robot'
#-----[ OPEN ]------------------------------------------------------
viewonline.php
#-----[ INLINE FIND ]------------------------------------------------
s.session_page, s.session_ip
#-----[ INLINE AFTER, ADD ]------------------------------------------
, s.is_robot
#-----[ FIND ]-------------------------------------------------------
$username = $lang['Guest'];
#-----[ REPLACE WITH ]-----------------------------------------------
if($row['is_robot'])
{
$username = $row['is_robot'] . ' ( Bots )';
} else {
$username = $lang['Guest'];
}
#-----[ OPEN ]------------------------------------------------------
includes/page_header.php
#-----[ INLINE FIND ]------------------------------------------------
s.session_logged_in, s.session_ip
#-----[ INLINE AFTER, ADD ]------------------------------------------
, s.is_robot
#-----[ FIND ]-------------------------------------------------------
$guests_online++;
#-----[ AFTER, ADD ]-----------------------------------------------
if( $row['is_robot'] )
{
<b style="color:#9E8DA7"> . $online_userlist = $row['is_robot'] . (($online_userlist!='') ? ', ' : '') . $online_userlist . </b>;
}
#-----[ OPEN ]------------------------------------------------------
common.php
#-----[ FIND ]-------------------------------------------------------
?>
#-----[ INSERT BEFORE ]----------------------------------------------
define('IS_ROBOT', is_robot() );
#-----[ OPEN ]------------------------------------------------------
includes/functions.php
#-----[ FIND ]------------------------------------------------------
global $board_config, $theme, $images;
#-----[ REPLACE WITH ]----------------------------------------------
global $board_config, $theme, $images, $db, $table_prefix;
#-----[ FIND ]------------------------------------------------------
$theme = setup_style($board_config['default_style']);
#-----[ REPLACE WITH ]----------------------------------------------
if (IS_ROBOT)
{
$sql = "SELECT bot_style FROM " . $table_prefix . "bots WHERE bot_name='" . IS_ROBOT . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$theme = setup_style($row['bot_style']);
} else {
$theme = setup_style($board_config['default_style']);
}
#-----[ FIND ]------------------------------------------------------
?>
#-----[ INSERT BEFORE ]---------------------------------------------
//
// Part of bot MOD: This function checks whether the user agent or ip is
// listed as a bot and returns true otherwise false.
//
function is_robot()
{
global $db, $HTTP_SERVER_VARS, $table_prefix;
// define bots table - for the users who are to lazy to edit constants.php hehehe!
define('BOTS_TABLE', $table_prefix . "bots");
// get required user data
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$user_agent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
// get bot table data
$sql = "SELECT bot_agent, bot_ip, bot_id, bot_visits, last_visit, bot_pages, bot_name
FROM " . BOTS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain bot data.', '', __LINE__, __FILE__, $sql);
}
// loop through bots table
while ($row = $db->sql_fetchrow($result))
{
// clear vars
$agent_match = 0;
$ip_match = 0;
// check for user agent match
foreach (explode('|', $row['bot_agent']) as $bot_agent)
{
if ($row['bot_agent'] && $bot_agent != '' && preg_match('#' . preg_quote($bot_agent, '#') . '#i', $user_agent)) $agent_match = 1;
}
// check for ip match
foreach (explode('|', $row['bot_ip']) as $bot_ip)
{
if ($row['bot_ip'] && $bot_ip != '' && strpos($user_ip, $bot_ip) === 0)
{
$ip_match = 1;
break;
}
}
// if both ip and agent matched update table and return true
if ($agent_match == 1 && $ip_match == 1)
{
// get time - seconds from epoch
$today = time();
$last_visits = explode('|', $row['last_visit']);
// if half an hour has passed since last visit
if (($today - (($last_visits[0] == '') ? 0 : $last_visits[0])) > 2700)
{
for ($i = ((4 > sizeof($last_visits)) ? sizeof($last_visits) : 4); $i >= 0; $i--)
{
if ($last_visits[$i-1] != '') $last_visits[$i] = $last_visits[$i-1];
}
// increment the new visit counter
$row['bot_visits']++;
// clear prior indexed pages
$row['bot_pages'] = 1;
} else {
// add to indexed pages
$row['bot_pages']++;
}
$last_visits[0] = $today;
// compress it all together
$last_visit = implode("|", $last_visits);
// update table
$sql = "UPDATE " . BOTS_TABLE . "
SET last_visit='$last_visit', bot_visits='" . $row['bot_visits'] . "', bot_pages='" . $row['bot_pages'] . "'
WHERE bot_id = " . $row['bot_id'];
if ( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t update data in bots table.', '', __LINE__, __FILE__, $sql);
}
return $row['bot_name'];
}
else
{
if ($agent_match == 1 || $ip_match == 1)
{
// get data from table
$sql = "SELECT pending_" . ((!$agent_match) ? 'agent' : 'ip') . "
FROM " . BOTS_TABLE . "
WHERE bot_id = " . $row['bot_id'];
if ( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain bot data.', '', __LINE__, __FILE__, $sql);
}
$row2 = $db->sql_fetchrow($result2);
// add ip/agent to the list
$pending_array = (( $row2['pending_' . ((!$agent_match) ? 'agent' : 'ip')] ) ? explode('|', $row2['pending_' . ((!$agent_match) ? 'agent' : 'ip')]) : array());
$found = 0;
if ( sizeof($pending_array) )
{
for ($loop = 0; $loop < count($pending_array); $loop+=2)
{
if ($pending_array[$loop] == ((!$agent_match) ? $user_agent : $user_ip)) $found = 1;
}
}
if ($found == 0)
{
$pending_array[] = ((!$agent_match) ? str_replace("|", "|", $user_agent) : $user_ip);
$pending_array[] = ((!$agent_match) ? $user_ip : str_replace("|", "|", $user_agent));
}
$pending = implode("|", $pending_array);
// update table
$sql = "UPDATE " . BOTS_TABLE . "
SET pending_" . ((!$agent_match) ? 'agent' : 'ip') . "='$pending'
WHERE bot_id = " . $row['bot_id'];
if ( !($result2 = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Couldn\'t update data in bots table.', '', __LINE__, __FILE__, $sql);
}
}
}
}
return 0;
}
#
#-----[ SAVE/CLOSE ALL FILES ]---------------------------------------
#