View file katrinka.ru/admin/photo_update.php

File size: 933B
<?php
  include '../wap/config.php';

if ($id==0) exit;

if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
    echo ("пЫЙВЛБ РПДЛМАЮЕОЙС Л вд!\n");
	exit;
};

if ($delete==1) {
	pg_query($conn, "delete from photos where id=$id;");
	pg_close($conn);
	header("Location: photos.php");
	exit;
}

if (($login=='')||($path=='')) {
	print "<html><head><title>пЫЙВЛБ</title></head><body>оЕ ЧУЕ ДБООЩЕ ЧЧЕДЕОЩ</body></html>";
	pg_close($conn);
	exit;
}

$res=pg_query($conn,"SET CLIENT_ENCODING TO 'KOI8';");
$res=pg_query($conn,"select id from users where login='$login';");
if (pg_numrows($res)!=1) {
	pg_close($conn);
	print "<html><head><title>пЫЙВЛБ</title></head><body>оЙЛ ОЕ ОБКДЕО Ч ВБЪЕ</body></html>";
	exit;
} else { $uid=pg_result($res,0,0); }

$res=pg_query($conn,"update photos set uid='$uid',path='$path' where id='$id';");
header("Location: photos.php");
pg_close($conn);
?>