<?


$shutnik_last = mysql_fetch_assoc(mysql_query("SELECT * FROM `chat_msg` WHERE `room` = '$room_info[id]' AND `ot_user` = '53' ORDER BY id DESC LIMIT 1"));
if ($shutnik_last==NULL || $shutnik_last['date']<time()-300)
{

$shutnik = mysql_fetch_assoc(mysql_query("SELECT * FROM `chat_shutnik`  ORDER BY RAND() LIMIT 1"));


$result = mysql_query("INSERT INTO `chat_msg` SET `msg` = '".win2utf($shutnik[anek])."', `ot_user` = '53', `room` = '".$room_info[id]."', `date` = '".time()."', `antispam` = '".$antispam."', `ip` = '".$ip."', `emotion` = '".num(1)."', `color` = '".num($_POST['color'])."'");
}
?>