<?
$nick_shut='Лошара';
$t_lim=time()-60;



$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]chat_main` WHERE `time` > '$t_lim';");
$t_shut=time()-60-mysql_num_rows($q)*3;




$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]chat_main` WHERE `nick` = '$nick_shut' AND `time` > '$t_shut';");
if (mysql_result($q, 0)==0)
{
$file_um=file(BASEDIR."SYSTEM/data/chat/shut.txt");
$anek=$file_um[(rand(0, count($file_um)-1))];
$anek=stripcslashes(htmlspecialchars(trim($anek)));
mysql_query("INSERT INTO `$mysql[pref]chat_main` (nick, text, time)
values('$nick_shut', '$anek', '$time');");
}
?>
