File size: 0.98Kb
<?php
include '../wap/config.php';
$login=htmlspecialchars(trim($_POST['login']),ENT_QUOTES);
$path=htmlspecialchars(trim($_POST['path']),ENT_QUOTES);
if (($path=='')||(($uid=='')&&($login==''))) {
print "<html><head><title>пЫЙВЛБ</title></head><body>оЕ ЧУЕ ДБООЩЕ ЧЧЕДЕОЩ</body></html>";
exit;
}
if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
echo ("пЫЙВЛБ РПДЛМАЮЕОЙС Л вд!\n");
exit;
};
$res=pg_query($conn,"SET CLIENT_ENCODING TO 'KOI8';");
if ($uid) {
$res=pg_query($conn,"select login from users where id='$uid';");
} else {
$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 {
if ($uid) $id=$uid;
else $id=pg_result($res,0,0);
}
$res=pg_query($conn,"insert into photos (uid,path) values ('$id','$path');");
header("Location: photos.php");
pg_close($conn);
?>