<?
function status()
{
global $id,$admin,$den,$mesac,$god,$time;
if(!isset($_GET['id']))
{
if(isset($_GET['delst']) and $admin==$id)
{
mysql_query("delete from news where id='$_GET[delst]'");
}
if($_POST['news']!="")
{
$news_end=mysql_fetch_array(mysql_query("select * from `news` where `id_user`='$id' ORDER BY `id` DESC LIMIT 1"));
if($news_end[text]!=$_POST['news'])
{
$data = $den.' '.$mesac.' '.$god.'г.<br/>'.$time;
mysql_query("insert into `news`(`id_user`,`data`,`text`) values('$id','$data','".$_POST['news']."');");
}
}
$news_t = mysql_query("select * from `news` where `id_user`='$id' ORDER BY `id` DESC LIMIT 1") or die(mysql_error());
if(isset($_GET['news']))
{
echo'<p><form action="?" method="post">';
echo'Что у вас нового?<br>
<input name="news">
<input type="submit" value="Обновить">';
echo'</form><p>';
}
else
{
if(mysql_num_rows($news_t)==0)
{
echo'<p><a href="?news">Что у вас нового?</a><p>';
}
else
{
$st = mysql_fetch_array(mysql_query("select * from `news` where `id_user`='$id' ORDER BY `id` DESC LIMIT 1")) or die(mysql_error());
echo'<p><a href="?news">'.check($st[text]).'</a><p>';
}
}
}
else
{
$news_t = mysql_query("select * from `news` where `id_user`='".$_GET['id']."' ORDER BY `id` DESC LIMIT 1") or die(mysql_error());
if(mysql_num_rows($news_t)!=0)
{
$st = mysql_fetch_array(mysql_query("select * from `news` where `id_user`='".$_GET['id']."' ORDER BY `id` DESC LIMIT 1")) or die(mysql_error());
echo'<p>'.check($st[text]).'<p>';
}
}
}
?>