function online() { function online() {
global $prefix, $db, $name, $board_config, $userinfo, $identify; global $prefix, $db, $name, $board_config, $userinfo, $identify;
$ip = $identify->get_ip(); $ip = $identify->get_ip();
$url = (defined('ADMIN_FILE')) ? 'index.php' : Fix_Quotes($_SERVER['REQUEST_URI']); $url = (defined('ADMIN_FILE')) ? 'index.php' : Fix_Quotes($_SERVER['REQUEST_URI']);
$uname = $ip; $uname = $ip;
$guest = 1; $guest = 1;
$user_agent = $identify->identify_agent(); $user_agent = $identify->identify_agent();
if (is_user()) { if (is_user()) {
$uname = $userinfo['username']; $uname = $userinfo['username'];
$guest = 0; $guest = 0;
/*****[BEGIN]****************************************** /*****[BEGIN]******************************************
[ Base: Advanced Security Extension v1.0.0 ] [ Base: Advanced Security Extension v1.0.0 ]
******************************************************/ ******************************************************/
} elseif($user_agent['engine'] == 'bot') { } elseif($user_agent['engine'] == 'bot') {
$uname = $user_agent['bot']; $uname = $user_agent['bot'];
$guest = 3; $guest = 3;
} }
/*****[END]******************************************** /*****[END]********************************************
[ Base: Advanced Security Extension v1.0.0 ] [ Base: Advanced Security Extension v1.0.0 ]
******************************************************/ ******************************************************/
$custom_title = $name; $custom_title = $name;
$url = str_replace("&", "&", $url); $url = str_replace("&", "&", $url);
$past = time()-$board_config['online_time']; $past = time() - $board_config['online_time'];
$db->sql_query('DELETE FROM '.$prefix.'_session WHERE time < "'.$past.'"'); $db->sql_query('DELETE FROM '.$prefix.'_session WHERE time < "'.$past.'"');
$ctime = time(); $ctime = time();
list($count) = $db->sql_ufetchrow("SELECT COUNT(*) FROM ".$prefix."_session WHERE uname='$uname' OR host_addr='$ip'"); list($count) = $db->sql_ufetchrow("SELECT COUNT(*) FROM ".$prefix."_session WHERE uname='$uname' OR host_addr='$ip'");
if ($count >= 1) { if ($count >= 1) {
$result = $db->sql_query('UPDATE '.$prefix.'_session SET uname="'.$uname.'", time="'.$ctime.'", guest="'.$guest.'", module="'.$custom_title.'", url="'.$url.'" WHERE host_addr="'.$ip.'"'); $result = $db->sql_query('UPDATE '.$prefix.'_session SET time="'.$ctime.'", guest="'.$guest.'", module="'.$custom_title.'", url="'.$url.'" WHERE uname="'.$uname.'" OR host_addr="'.$ip.'"');
$db->sql_freeresult($result); $db->sql_freeresult($result);
} else { } else {
$db->sql_query('INSERT INTO '.$prefix.'_session (uname, time, starttime, host_addr, guest, module, url) VALUES ("'.$uname.'", "'.$ctime.'", "'.$ctime.'", "'.$ip.'", "'.$guest.'","'.$custom_title.'", "'.$url.'")'); $db->sql_query('INSERT INTO '.$prefix.'_session (uname, time, starttime, host_addr, guest, module, url) VALUES ("'.$uname.'", "'.$ctime.'", "'.$ctime.'", "'.$ip.'", "'.$guest.'","'.$custom_title.'", "'.$url.'")');
} }
}}
original text
changed text