<?php
defined('PROTECTOR') OR die('Ошибка: нет доступа');
$laikas = 600;
$dabar = time();
$timeout = $dabar - $laikas;
mysql_query("DELETE FROM `online` WHERE `laikas` < '$timeout'");
$ar_yra = mysql_num_rows(mysql_query("SELECT `usr` FROM `online` WHERE `usr` = '$log' LIMIT 1"));
if ($ar_yra == '0'){
mysql_query("INSERT INTO `online` SET `usr` = '$log', `laikas` = '$dabar', `lvl` = '$udata[lvl]'");
}
elseif($ar_yra > '0'){
mysql_query("UPDATE `online` SET `laikas` = '$dabar',`lvl` = '$udata[lvl]' WHERE `usr` = '$log' LIMIT 1");
}
?>