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

Размер файла: 980B
<?php
  include 'guestbook/mylib.php';
  include 'config.php';
  session_start();
  $id=htmlspecialchars(trim($_GET['id']),ENT_QUOTES);
  header("Cache-Control: no-cache");
  header("Content-type: text/vnd.wap.wml");
  $lang=$_GET['lang'];
  $agent=$_SERVER['HTTP_USER_AGENT'];
  if (($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
	if (isset($_SESSION['id'])) {
		$uid=$_SESSION['id'];
		$res=pg_query($conn,"select moder from users where id='$uid';");
		$moder=pg_result($res,0,0);
		if ($moder) { pg_close($conn); exit; }
		
	}
  }
  if (!$uid) { pg_close($conn); print "Not logged in"; exit; }
  if ($id=='all') {
  	$res=pg_query($conn,"delete from messages where messages.to_u='$uid';");
  } else {
  	$res=pg_query($conn,"delete from messages where messages.id='$id' and messages.to_u='$uid';");
  }
  pg_close($conn);

  $link=sprintf("Location: messages.php?lang=%s&PHPSESSID=%s", $lang, session_id());
  header($link);
?>