Просмотр файла katrinka.ru/msgdel.php

Размер файла: 980B
  1. <?php
  2. include 'guestbook/mylib.php';
  3. include 'config.php';
  4. session_start();
  5. $id=htmlspecialchars(trim($_GET['id']),ENT_QUOTES);
  6. header("Cache-Control: no-cache");
  7. header("Content-type: text/vnd.wap.wml");
  8. $lang=$_GET['lang'];
  9. $agent=$_SERVER['HTTP_USER_AGENT'];
  10. if (($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
  11. if (isset($_SESSION['id'])) {
  12. $uid=$_SESSION['id'];
  13. $res=pg_query($conn,"select moder from users where id='$uid';");
  14. $moder=pg_result($res,0,0);
  15. if ($moder) { pg_close($conn); exit; }
  16. }
  17. }
  18. if (!$uid) { pg_close($conn); print "Not logged in"; exit; }
  19. if ($id=='all') {
  20. $res=pg_query($conn,"delete from messages where messages.to_u='$uid';");
  21. } else {
  22. $res=pg_query($conn,"delete from messages where messages.id='$id' and messages.to_u='$uid';");
  23. }
  24. pg_close($conn);
  25.  
  26. $link=sprintf("Location: messages.php?lang=%s&PHPSESSID=%s", $lang, session_id());
  27. header($link);
  28. ?>