<?php
include 'inc/db.php';
include 'inc/1.php';
if (!$user)header("Location: /aut.php");
mysql_query("CREATE TABLE IF NOT EXISTS `lenta` (
`id` int(255) NOT NULL AUTO_INCREMENT,
`time` int(255) NOT NULL,
`msg` text COLLATE utf8_unicode_ci NOT NULL,
`user` int(255) NOT NULL,
`read` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
echo "<div class='msg'><a href='?del=1'>Очистить ленту</a></div>";
if ($_GET['del']){
mysql_query("DELETE FROM `lenta` WHERE `user` = '$user[id]'");
mysql_query("INSERT INTO `log` (`user`, `text`, `time`) values ('$user[id]', 'Очистка ленты', '".time()."')");
}
$q=mysql_query("SELECT * FROM `lenta` WHERE `user` = '$user[id]' ORDER BY `time` DESC");
mysql_query("UPDATE `lenta` 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';
?>