View file moder/gobook2.php

File size: 1.18Kb
<? $page_name="Модер-меню";  $dir='../'; include("../include/1.php"); require "../include/avto.php";

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

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

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

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

$upd_post=mysql_query("update `shurik_gobook` set text='$text',otvet='$otvet' where id=$id");
if($upd_post)echo "Сообщение отредактировано<br/><a href=gobook.php>В гостевую</a>";
else echo mysql_error();

}
}




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

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

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