<?php
$time = 60;
$ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
$ua = mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']);
if(mysql_result(mysql_query("SELECT count(`id`) FROM `online_count` WHERE `ip` = '". $ip ."' AND `ua` = '". $ua ."'",0) == 0)
{
mysql_query("INSERT INTO `online_count` (`ip`, `ua`, `time`) VALUES ('" .$ip ."', '". $ua ."', '". time() ."')"
mysql_query("DELETE FROM `online_count` WHERE `time` < '". (time() - $time) ."'"
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Онлайн</title>
</head>
<body>
Онлайн: <b><?php echo mysql_result(mysql_query("SELECT count(`id`) FROM `online_count`",0); ?></b>
<br/>
</body>
</html>
в каком файле код прописать ?