Размер файла: 1.34Kb
<?php
include '../config.php';
include '../guestbook/mylib.php';
if (!checkagent($_SERVER['HTTP_USER_AGENT'])) { noemul(); exit; }
list ($opname, $chatok) = check_op($_SERVER['REMOTE_ADDR']);
if (!$chatok) { unk_op(); exit; }
session_start();
header("Content-type: text/vnd.wap.wml");
$timex=time();
$slogin=htmlspecialchars(trim($_GET['slogin']),ENT_QUOTES);
$id=htmlspecialchars(trim($_GET['id']),ENT_QUOTES);
$lang=$_GET['lang'];
if ((trim($_COOKIE['Login'])!='')&&(trim($_COOKIE['Password'])!='')) {
$login=htmlspecialchars(trim($_COOKIE['Login']),ENT_QUOTES);
$pass=htmlspecialchars(trim($_COOKIE['Password']),ENT_QUOTES);
} else {
$login=htmlspecialchars(trim($_POST['login']),ENT_QUOTES);
$pass=htmlspecialchars(trim($_POST['pass']),ENT_QUOTES);
}
if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) {
wmlhd();
print "<p align=\"center\">Error connecting to database</p>\n";
print "</card>\n</wml>";
exit;
}
if (!$id) {
$res=pg_query($conn,"select id from users where login='$slogin';");
if (pg_numrows($res)!=1) {
wmlhd();
print "<p align=\"center\">Sorry, user NOT FOUND.</p>\n";
print "</card>\n</wml>";
pg_close($conn);
exit;
}
$id=pg_result($res,0,0);
}
pg_close($conn);
$link=sprintf("Location: /user_info.php?id=%s&lang=%s", $id, $lang);
header($link);
?>