<?php
$laikas = 600;
$dabar = time();
$timeout = $dabar - $laikas;

mysql_query("DELETE FROM table_online WHERE laikas<$timeout");
$ar_yra = mysql_num_rows(mysql_query("SELECT nick FROM table_online WHERE nick = '$log' LIMIT 1"));
if ($ar_yra == '0')
{
mysql_query("INSERT INTO table_online SET nick = '$log', laikas = '$dabar'");
}
elseif($ar_yra > '0')
{
mysql_query("UPDATE table_online SET laikas = '$dabar' WHERE nick = '$log' LIMIT 1");
}
?>

