<?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; }
header("Cache-Control: no-cache");
header("Content-type: text/vnd.wap.wml");
session_start();
$lang=$_GET['lang'];
$id=htmlspecialchars(trim($_GET['id']),ENT_QUOTES);
$r=htmlspecialchars(trim($_GET['r']),ENT_QUOTES);
$pid=htmlspecialchars(trim($_GET['pid']),ENT_QUOTES);
$dispb=0;
$uid=0;
$myaccess=0;
# if ($_SERVER['REMOTE_ADDR']=='212.93.97.200') $dispb=1;
if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) exit;
if (isset($_SESSION['id'])) {
$uid=$_SESSION['id'];
if (!isset($_SESSION['access'])) {
$res=pg_query($conn,"select access from users where id='$uid';");
$_SESSION['access']=pg_result($res,0,0);
}
$myaccess=$_SESSION['access'];
if ($myaccess > 1) $dispb=1;
} else {
if ((trim($_COOKIE['Login'])!='')&&(trim($_COOKIE['Password'])!='')) {
$login=htmlspecialchars(trim($_COOKIE['Login']),ENT_QUOTES);
$pass=htmlspecialchars(trim($_COOKIE['Password']),ENT_QUOTES);
$res=pg_query($conn,"select access,id from users where login='$login' and passwd='$pass';");
if (pg_numrows($res)==1) {
$myaccess=pg_result($res,0,0);
if ($myaccess > 1) $dispb=1;
$uid=pg_result($res,0,1);
$_SESSION['id']=$uid;
$_SESSION['access']=$myaccess;
}
}
}
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.dtd">
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<?php
if (($myaccess==4)&&($pid)) {
if ($r==18)
$res=pg_query($conn,"select agent,host from chat_tet where id='$pid';");
else
$res=pg_query($conn,"select agent,host from chat where id='$pid';");
$agent=pg_result($res,0,0);
$host=pg_result($res,0,1);
}
$res=pg_query($conn,"select login,email,name,bday,operator,fr,phonenum,web,info,phonemod,cust_status,moder,dreg,access,wap,icq,posts,job,avatar,lastact,showemail,kmoder,temp_ban,fposts from users where id='$id';");
$rows=pg_numrows($res);
if (!$rows) { exit; }
$login=uconv(pg_result($res,0,0));
$email=uconv(pg_result($res,0,1));
$name=uconv(pg_result($res,0,2));
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", pg_result($res,0,3), $regs);
$operator=uconv(pg_result($res,0,4));
$fr=uconv(pg_result($res,0,5));
$phonenum=uconv(pg_result($res,0,6));
$website=uconv(pg_result($res,0,7));
$info=uconv(pg_result($res,0,8));
$phonemodel=uconv(pg_result($res,0,9));
$cust_status=uconv(pg_result($res,0,10));
$moder=uconv(pg_result($res,0,11));
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", pg_result($res,0,12), $dreg);
$access=pg_result($res,0,13);
# if ($id==4) $access=0;
$wap=uconv(pg_result($res,0,14));
$icq=pg_result($res,0,15);
$numposts=pg_result($res,0,16);
$job=uconv(pg_result($res,0,17));
$avatar=pg_result($res,0,18);
$lastact=sprintf("%s", strftime("%d %b %G %T", pg_result($res,0,19)));
$showemail=pg_result($res,0,20);
$kmoder=pg_result($res,0,21);
$temp_ban=pg_result($res,0,22);
$fposts=pg_result($res,0,23);
$timex=time();
if (($kmoder)&&($temp_ban > $timex)) {
$mres=pg_query($conn,"select login from users where id='$kmoder';");
if (pg_numrows($mres)) $mname=uconv(pg_result($mres,0,0));
}
if ($moder) {
$mres=pg_query($conn,"select login from users where id='$moder';");
if (pg_numrows($mres)) $mname=uconv(pg_result($mres,0,0));
}
# $res=pg_query($conn,"select count(id) from chat where fr_u='$id';");
# $numposts=$numposts+pg_result($res,0,0);
$res=pg_query($conn,"select name_eng,name_rus from user_status where min <= '$numposts' and '$numposts' <= max;");
if (pg_numrows($res)) {
$status_eng=uconv(pg_result($res,0,0));
$status_rus=uconv(pg_result($res,0,1));
}
$res=pg_query($conn,"select who from users_ignore where uid='$uid' and who='$id';");
$ign=pg_numrows($res);
print "<card id=\"Info\" title=\"".$login."\">\n";
# if (($r==6)||($dispb)) {
if ((!$moder)&&($r)) {
print "<do name=\"a1\" type=\"options\" label=\"Private\">\n";
print '<go href="chat_add.php?lang='.$lang.'&r='.$r.'&to='.$id.'" />';
print "</do>\n";
if ($lang=='eng')
print "<do name=\"a2\" type=\"options\" label=\"Address to\">\n";
else
print "<do name=\"a2\" type=\"options\" label=\"Обратиться\">\n";
print '<go href="chat_add.php?lang='.$lang.'&r='.$r.'&to='.$id.'&n=1" />';
print "</do>\n";
}
if (($access < 2)&&(!$dispb)&&(!$moder)&&($uid!=$id)) {
if ($ign) {
print "<do name=\"a3\" type=\"options\" label=\"UnIgnore\">\n";
print '<go href="user_ignore.php?id='.$id.'&r='.$r.'&act=0" />';
} else {
print "<do name=\"a3\" type=\"options\" label=\"Ignore\">\n";
print '<go href="user_ignore.php?id='.$id.'&r='.$r.'&act=1" />';
}
print "</do>\n";
}
if (($access < 2)&&($dispb)&&(!$moder)) {
print "<do name=\"a4\" type=\"options\" label=\"BAN\">\n";
print '<go href="user_ban.php?id='.$id.'&r='.$r.'" />';
print "</do>\n";
print "<do name=\"a5\" type=\"options\" label=\"Kick\">\n";
print '<go href="user_kick.php?id='.$id.'&r='.$r.'" />';
print "</do>\n";
}
if ($myaccess==4) {
print "<do name=\"a6\" type=\"options\" label=\"Edit\">\n";
print '<go href="user_edit.php?id='.$id.'&r='.$r.'" />';
print "</do>\n";
}
if ($id==3) {
print "<p align=\"center\">\n";
print "--Информация--<br/>\n";
print "--Засекречена--<br/>\n";
} else {
print "<p>\n";
if ($avatar) print "<img src=\"".$avatar."\" alt=\"\"/><br/>\n";
if (($kmoder)&&($temp_ban > $timex)) $cust_status='Kicked by '.$mname;
if ($moder) $cust_status='Banned by '.$mname;
if ($lang=='eng') print "Status: ";
else print "Статус: ";
if ($cust_status!='') print $cust_status."<br/>\n";
else {
if ($lang=='eng') print $status_eng."<br/>\n";
else print $status_rus."<br/>\n";
}
if (($email!='')&&($showemail)) print "E-mail: ".$email."<br/>\n";
if ($icq) print "ICQ: ".$icq."<br/>\n";
if ($name!='') {
if ($lang=='eng')
print "Real name:\n";
else
print "Полное имя:\n";
print $name."<br/>\n";
}
if ($job!='') {
if ($name!='') {
if ($lang=='eng')
print "Job:\n";
else
print "Место работы/учёбы:\n";
print $job."<br/>\n";
}
}
if (($regs[3]==1)&&($regs[2]==1)&&($regs[1]==1960)) { $dr=0; }
else {
if ($lang=='eng')
print "Birthday:\n";
else
print "Дата рождения:\n";
# if ($id==5)
# print "завтра<br/>\n";
# else
print $regs[3].".".$regs[2].".".$regs[1]."<br/>\n";
}
if ($operator!='') {
if ($lang=='eng')
print "Operator:\n";
else
print "Оператор сотовой связи:\n";
print $operator."<br/>\n";
}
if ($website!='') {
if ($lang=='eng')
print "Web site:\n";
else
print "Страничка в Internet:\n";
print $website."<br/>\n";
}
if ($wap!='') {
if ($lang=='eng')
print "Wap site:\n";
else
print "WAP Страничка:\n";
print "<a href=\"http://".$wap."\">".$wap."</a><br/>\n";
}
if ($fr!='') {
if ($lang=='eng')
print "From:\n";
else
print "Откуда:\n";
print $fr."<br/>\n";
}
if ($phonenum!='') {
if ($lang=='eng')
print "Phone Number:\n";
else
print "Номер телефона:\n";
print $phonenum."<br/>\n";
}
if ($phonemodel!='') {
if ($lang=='eng')
print "Phone Model:\n";
else
print "Модель телефона:\n";
print $phonemodel."<br/>\n";
}
if ($info!='') {
if ($lang=='eng')
print "More info:\n";
else
print "Дополнительно о себе:\n";
print $info."<br/>\n";
}
$res=pg_query($conn,"select id from photos where uid='$id';");
$rows=pg_numrows($res);
pg_close($conn);
for ($i=0;$i<$rows;$i++) {
print "<a href=\"/users/photos.php?id=".pg_result($res,$i,0)."\">Photo ".($i+1)."</a><br/>\n";
}
if ($numposts) {
if ($lang=='eng') print "Posts in chat:\n";
else print "Постов в чате:\n";
# if ($id==18172) {
# $numposts="Туйная Хуча";
# }
# if ($id==3) {
# $numposts="Засекречено";
# }
# if ($id==5) {
# $numposts="надоело считать";
# }
if ($id==7) {
$numposts=0;
}
print $numposts."<br/>\n";
}
if ($fposts) {
if ($lang=='eng')
print "Posts in forum: \n";
else
print "Постов в форуме: \n";
print $fposts."<br/>\n";
}
if ($lang=='eng')
print "Registration date: \n";
else
print "Дата регистрации: \n";
print $dreg[3].".".$dreg[2].".".$dreg[1]."<br/>\n";
if ($lang=='eng')
print "Last visit: \n";
else
print "Последнее посещение: \n";
print $lastact."<br/>";
print "ID: ".$id."<br/>\n";
if (($myaccess==4)&&($pid)) {
list ($opname, $chatok) = check_op($host);
print "Host: ".gethostbyaddr($host)." [".$host."] ".$opname."<br/>\n";
print "Agent: ".$agent."<br/>\n";
}
}
?>
</p>
</card>
</wml>