View file katrinka.ru/user_info.php

File size: 10.52Kb
<?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.'&amp;r='.$r.'&amp;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=\"&#x041E;&#x0431;&#x0440;&#x0430;&#x0442;&#x0438;&#x0442;&#x044C;&#x0441;&#x044F;\">\n";
		print '<go href="chat_add.php?lang='.$lang.'&amp;r='.$r.'&amp;to='.$id.'&amp;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.'&amp;r='.$r.'&amp;act=0" />';
		} else {
			print "<do name=\"a3\" type=\"options\" label=\"Ignore\">\n";
			print '<go href="user_ignore.php?id='.$id.'&amp;r='.$r.'&amp;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.'&amp;r='.$r.'" />';
		print "</do>\n";
		print "<do name=\"a5\" type=\"options\" label=\"Kick\">\n";
		print '<go href="user_kick.php?id='.$id.'&amp;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.'&amp;r='.$r.'" />';
		print "</do>\n";
	}
	if ($id==3) {
		print "<p align=\"center\">\n";
		print "--&#x0418;&#x043D;&#x0444;&#x043E;&#x0440;&#x043C;&#x0430;&#x0446;&#x0438;&#x044F;--<br/>\n";
		print "--&#x0417;&#x0430;&#x0441;&#x0435;&#x043A;&#x0440;&#x0435;&#x0447;&#x0435;&#x043D;&#x0430;--<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 "&#x0421;&#x0442;&#x0430;&#x0442;&#x0443;&#x0441;: ";
		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 "&#x041F;&#x043E;&#x043B;&#x043D;&#x043E;&#x0435; &#x0438;&#x043C;&#x044F;:\n";
			print $name."<br/>\n";
		}

		if ($job!='') {
			if ($name!='') {
				if ($lang=='eng')
					print "Job:\n";
				else
					print "&#x041C;&#x0435;&#x0441;&#x0442;&#x043E; &#x0440;&#x0430;&#x0431;&#x043E;&#x0442;&#x044B;/&#x0443;&#x0447;&#x0451;&#x0431;&#x044B;:\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 "&#x0414;&#x0430;&#x0442;&#x0430; &#x0440;&#x043E;&#x0436;&#x0434;&#x0435;&#x043D;&#x0438;&#x044F;:\n";
#			if ($id==5) 
#				print "&#x0437;&#x0430;&#x0432;&#x0442;&#x0440;&#x0430;<br/>\n";
#			else
				print $regs[3].".".$regs[2].".".$regs[1]."<br/>\n"; 
		}

		if ($operator!='') {
			if ($lang=='eng')
				print "Operator:\n";
			else
				print "&#x041E;&#x043F;&#x0435;&#x0440;&#x0430;&#x0442;&#x043E;&#x0440; &#x0441;&#x043E;&#x0442;&#x043E;&#x0432;&#x043E;&#x0439; &#x0441;&#x0432;&#x044F;&#x0437;&#x0438;:\n";
				print $operator."<br/>\n";
		}

		if ($website!='') {
			if ($lang=='eng')
				print "Web site:\n";
			else
				print "&#x0421;&#x0442;&#x0440;&#x0430;&#x043D;&#x0438;&#x0447;&#x043A;&#x0430; &#x0432; Internet:\n";
			print $website."<br/>\n";
		}

		if ($wap!='') {
			if ($lang=='eng')
				print "Wap site:\n";
			else
				print "WAP &#x0421;&#x0442;&#x0440;&#x0430;&#x043D;&#x0438;&#x0447;&#x043A;&#x0430;:\n";
			print "<a href=\"http://".$wap."\">".$wap."</a><br/>\n";
		}

		if ($fr!='') {
			if ($lang=='eng')
				print "From:\n";
			else
				print "&#x041E;&#x0442;&#x043A;&#x0443;&#x0434;&#x0430;:\n";
			print $fr."<br/>\n";
		}

		if ($phonenum!='') {
			if ($lang=='eng')
				print "Phone Number:\n";
			else
				print "&#x041D;&#x043E;&#x043C;&#x0435;&#x0440; &#x0442;&#x0435;&#x043B;&#x0435;&#x0444;&#x043E;&#x043D;&#x0430;:\n";
			print $phonenum."<br/>\n";
		}

		if ($phonemodel!='') {
			if ($lang=='eng')
				print "Phone Model:\n";
			else
				print "&#x041C;&#x043E;&#x0434;&#x0435;&#x043B;&#x044C; &#x0442;&#x0435;&#x043B;&#x0435;&#x0444;&#x043E;&#x043D;&#x0430;:\n";
			print $phonemodel."<br/>\n";
		}

		if ($info!='') {
			if ($lang=='eng')
				print "More info:\n";
			else
				print "&#x0414;&#x043E;&#x043F;&#x043E;&#x043B;&#x043D;&#x0438;&#x0442;&#x0435;&#x043B;&#x044C;&#x043D;&#x043E; &#x043E; &#x0441;&#x0435;&#x0431;&#x0435;:\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 "&#x041F;&#x043E;&#x0441;&#x0442;&#x043E;&#x0432; &#x0432; &#x0447;&#x0430;&#x0442;&#x0435;:\n";
# 			if ($id==18172) {
#				$numposts="&#x0422;&#x0443;&#x0439;&#x043D;&#x0430;&#x044F; &#x0425;&#x0443;&#x0447;&#x0430;";
#			}
# 			if ($id==3) {
#				$numposts="&#x0417;&#x0430;&#x0441;&#x0435;&#x043A;&#x0440;&#x0435;&#x0447;&#x0435;&#x043D;&#x043E;";
#			}
# 			if ($id==5) {
#				$numposts="&#x043D;&#x0430;&#x0434;&#x043E;&#x0435;&#x043B;&#x043E; &#x0441;&#x0447;&#x0438;&#x0442;&#x0430;&#x0442;&#x044C;";
#			}
 			if ($id==7) {
				$numposts=0;
			}
			print $numposts."<br/>\n";
			}
		if ($fposts) {
			if ($lang=='eng')
				print "Posts in forum: \n";
			else
				print "&#x041F;&#x043E;&#x0441;&#x0442;&#x043E;&#x0432; &#x0432; &#x0444;&#x043E;&#x0440;&#x0443;&#x043C;&#x0435;: \n";
			print $fposts."<br/>\n";
		}
		if ($lang=='eng')
			print "Registration date: \n";
		else
			print "&#x0414;&#x0430;&#x0442;&#x0430; &#x0440;&#x0435;&#x0433;&#x0438;&#x0441;&#x0442;&#x0440;&#x0430;&#x0446;&#x0438;&#x0438;: \n";
		print $dreg[3].".".$dreg[2].".".$dreg[1]."<br/>\n";
		if ($lang=='eng')
			print "Last visit: \n";
		else
			print "&#x041F;&#x043E;&#x0441;&#x043B;&#x0435;&#x0434;&#x043D;&#x0435;&#x0435; &#x043F;&#x043E;&#x0441;&#x0435;&#x0449;&#x0435;&#x043D;&#x0438;&#x0435;: \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>