<?php
include 'inc/db.php';
include 'inc/1.php';
if (!$user)header("Location: /aut.php");
echo "<div class='msg'><a href='?del=1'>Очистить журнал</a></div>";
if ($_GET['del']){
mysql_query("DELETE FROM `jurnal` WHERE `user` = '$user[id]'");
mysql_query("INSERT INTO `log` (`user`, `text`, `time`) values ('$user[id]', 'Очистка журнала', '".time()."')");
}
$q=mysql_query("SELECT * FROM `jurnal` WHERE `user` = '$user[id]' ORDER BY `time` DESC");
mysql_query("UPDATE `jurnal` SET `read` = '1' WHERE `user` = '$user[id]'");
$b=1;
while ($f=mysql_fetch_assoc($q)){
$p=($b%2);
if ($f['read']==0)echo "<div class='p$p'><b>$f[msg]</b> (".vremja($f['time']).")</div>";
else
echo "<div class='p$p'>$f[msg] (".vremja($f['time']).")</div>";
$b++;
}
include_once 'inc/foot.php';
?>