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

Размер файла: 1.02Kb
  1. <? $page_name="Админ-меню"; $dir='../'; include("../include/1.php"); require "../include/avto.php";
  2.  
  3. if(!isset($_SESSION['user_id']) or $me['admin']!=2)exit("Нету доступа!");
  4.  
  5. if(isset($_GET['edit']))
  6. {
  7. $id=$_GET['edit'];
  8. if(!isset($_POST['text'])){
  9. $post_1=mysql_fetch_array(mysql_query("select * from `shurik_chat` where id=$id"));
  10.  
  11. echo '
  12. <form action="chat2.php?edit='.$id.'" method="post">
  13. Текст<br/><textarea name="text" cols="25" rows="5">'.$post_1['text'].'</textarea><br/>
  14. <input name="" type="submit" value="Редактировать"></form>';}
  15.  
  16. if(isset($_POST['text']))
  17. {
  18. $text=$_POST['text'];
  19.  
  20. $upd_post=mysql_query("update `shurik_chat` set text='$text' where id=$id");
  21. if($upd_post)echo "Сообщение отредактировано<br/><a href=chat.php>В чат</a>";
  22. else echo mysql_error();
  23.  
  24. }
  25. }
  26.  
  27.  
  28.  
  29.  
  30. if(isset($_GET['del']))
  31. {$id=$_GET['del'];
  32.  
  33. $delete_post=mysql_query("delete from `shurik_chat` where id=$id");
  34. if($delete_post)echo "Сообщение удалено<br/><a href=chat.php>В чат</a>";
  35. }
  36.  
  37. include("../include/2.php"); ?>