<?
function mess_adm ($msg)
{
global $set, $mysql;
$time=time();
$t=$time-$set['time_sess'];

$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]users` WHERE `level` <> '0' AND `time` > '$t';");
if (mysql_result($q, 0)>0)
{
$q2 = mysql_query("SELECT id FROM `$mysql[pref]users` WHERE `level` <> '0' AND `time` > '$t' ORDER BY time DESC LIMIT 1;");

$post_user = mysql_fetch_array($q2);

mysql_query("INSERT INTO `$mysql[pref]mail` (id_in_user, time, id_out_user, text, nick) values('$post_user[id]', '$time', '0', '$msg', 'SYSTEM')");
}
}
?>
