query("INSERT INTO `ipbans` SET `ip` = '". $_GET['banip'] ."', `reason`='online.php ban', `date` = '". ctime() ."', `banner` = '$loguserid'") or print mysql_error();
// if ($_GET['uid']) mysql_query("UPDATE `users` SET `powerlevel` = -1, `title` = 'Banned; account hijacked. Contact admin via PM to change it.' WHERE `id` = '". $_GET['uid'] ."'") or print mysql_error();
xk_ircsend("1|". xk(8) . $loguser['name'] . xk(7) ." added IP ban for ". xk(8) . $_GET['banip'] . xk(7) .".");
return header("Location: online.php?m=1");
}
$sort = filter_bool($_GET['sort']);
$lnk = 'minute |
$lnk=300>5 minutes |
$lnk=900>15 minutes |
$lnk=3600>hour |
$lnk=86400>day
";
if($isadmin)
print '
Admin cruft: Sort by ".($sort == 'IP' ? 'date' : 'IP') ."";
print " ";
// Logged in users
$posters = $sql->query("SELECT id,posts,name,sex,powerlevel,aka,lastactivity,lastip,lastposttime,lasturl,birthday FROM users WHERE lastactivity>".(ctime()-$time).' ORDER BY '.($sort=='IP'&&$isadmin?'lastip':'lastactivity DESC'));
print "
$fonttag Online users during the last ".timeunits2($time).":
$tblstart
$tccellh width=20> 
$tccellh width=200>Username
$tccellh width=120> Last activity
$tccellh width=180> Last post
$tccellh width=*>URL
";
if($isadmin) print "$tccellh width=120>IP address";
print "$tccellh width=60> Posts";
for ($i=1; $user=$sql->fetch($posters); $i++) {
$userlink = getuserlink($user);
if(!$user['posts']) $user['lastposttime'] = getblankdate();
else $user['lastposttime'] = date($dateformat,$user['lastposttime']+$tzoff);
$user['lasturl']=str_replace('<','<',$user['lasturl']);
$user['lasturl']=str_replace('>','>',$user['lasturl']);
$user['lasturl']=str_replace('%20',' ',$user['lasturl']);
$user['lasturl']=str_replace('shoph','shop',$user['lasturl']);
$user['lasturl']=preg_replace('/[\?\&]debugsql(|=[0-9]+)/i','',$user['lasturl']); // let's not give idiots any ideas
$lasturltd = "$tccell2l>$user[lasturl]";
if (substr($user['lasturl'], -11) =='(IP banned)')
$lasturltd = "$tccell2l>". substr($user[lasturl], 0, -12) ." (IP banned)";
elseif (substr($user['lasturl'], -11) =='(Tor proxy)')
$lasturltd = "$tccell2l>". substr($user[lasturl], 0, -12) ." (Tor proxy)";
print "