Просмотр файла admin/chat2.php

Размер файла: 1.02Kb
<? $page_name="Админ-меню"; $dir='../'; include("../include/1.php"); require "../include/avto.php";

if(!isset($_SESSION['user_id']) or $me['admin']!=2)exit("Нету доступа!");

if(isset($_GET['edit']))
{
$id=$_GET['edit'];
if(!isset($_POST['text'])){
$post_1=mysql_fetch_array(mysql_query("select * from `shurik_chat` where id=$id"));

echo '
<form action="chat2.php?edit='.$id.'" method="post">
Текст<br/><textarea name="text" cols="25" rows="5">'.$post_1['text'].'</textarea><br/>
<input name="" type="submit" value="Редактировать"></form>';}

if(isset($_POST['text']))
{
$text=$_POST['text'];

$upd_post=mysql_query("update `shurik_chat` set text='$text' where id=$id");
if($upd_post)echo "Сообщение отредактировано<br/><a href=chat.php>В чат</a>";
else echo mysql_error();

}
}




if(isset($_GET['del']))
{$id=$_GET['del'];

$delete_post=mysql_query("delete from `shurik_chat` where id=$id");
if($delete_post)echo "Сообщение удалено<br/><a href=chat.php>В чат</a>";
}

include("../include/2.php"); ?>