View file online.php

File size: 957B
<?php
$array = array('browser' => user_clean($_SERVER['HTTP_USER_AGENT']),'ip' => $_SERVER['REMOTE_ADDR'],'time' => time(),'on' => 600,);
mysql_query('REPLACE INTO `online` VALUES('.$array['time'].',"'.$array['browser'].'","'.$array['ip'].'")', $link);
mysql_query('DELETE FROM `online` WHERE `time`<'.($array['time']-$array['on']), $link);
$users = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `online`'));
$users = $users[0];
function user_clean($str){
return mysql_escape_string(htmlspecialchars(str_replace(array(chr(0),chr(1),chr(2),chr(3),chr(4),chr(5),chr(6),chr(7),chr(8),chr(9),chr(10),chr(11),chr(12),chr(13),chr(14),chr(15),chr(16),chr(17),chr(18),chr(19),chr(20),chr(21),chr(22),chr(23),chr(24),chr(25),chr(26),chr(27),chr(28),chr(29),chr(30),chr(31)),'',$str)));
}
$g = mysql_query("SELECT COUNT(*) FROM `online`;");
$kolonline= mysql_result($g, 0);

print "Онлайн: <a href='onlineuser.php'>".$kolonline."</a><br />";
?>