Просмотр файла katrinka.ru/user_pref.php

Размер файла: 10.51Kb
<?php
  include 'config.php';
  include 'guestbook/mylib.php';
  session_start();
  header("Cache-Control: no-cache");
  header("Content-type: text/vnd.wap.wml");
  if (ereg("^SIE-.*",$_SERVER['HTTP_USER_AGENT'])) $sie=1; else $sie=0;
  $uid=0;
  $lang=$_GET['lang'];
  if (!($conn=pg_connect("host=$dbhost port=$dbport dbname=$dbname user=$dbuser password=$dbpass"))) exit;
  if (isset($_SESSION['id'])) {
	$uid=$_SESSION['id'];
  }
  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);
  }
?>
<?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 ($uid) {
		$res=pg_query($conn,"select id,email,name,bday,operator,fr,phonenum,web,info,phonemod,icq,wap,job,cust_status,posts from users where id='$uid' and moder=0;");
	} else {
		$res=pg_query($conn,"select id,email,name,bday,operator,fr,phonenum,web,info,phonemod,icq,wap,job,cust_status,posts from users where login='$login' and passwd='$pass' and moder=0;");
	}
	$rows=pg_numrows($res);
	pg_close($conn);

	if (!$rows) { 
		print "<card id=\"Login\" title=\"Login\">\n";
		print "<p>\n";
		loginform(1);
		print "</p></card></wml>";
		exit;

	}
	$id=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));
	$icq=uconv(pg_result($res,0,10));
	$wap=uconv(pg_result($res,0,11));
	$job=uconv(pg_result($res,0,12));
	$cust_status=uconv(pg_result($res,0,13));
	$posts=uconv(pg_result($res,0,14));

		print "<card id=\"Reg\" title=\"".uconv($login)."\" newcontext=\"true\">\n";

		print "<p>\n";

		if ($lang=='eng')
			print "New Password:\n";
		else
			print "&#x041D;&#x043E;&#x0432;&#x044B;&#x0439; &#x043F;&#x0430;&#x0440;&#x043E;&#x043B;&#x044C;:\n";
		print "<input type=\"password\" name=\"newpass\" title=\"New Password\" maxlength=\"15\"/><br/>\n";

		if ($lang=='eng')
			print "Retype new password:\n";
		else
			print "&#x0415;&#x0449;&#x0451; &#x0440;&#x0430;&#x0437; &#x043D;&#x043E;&#x0432;&#x044B;&#x0439; &#x043F;&#x0430;&#x0440;&#x043E;&#x043B;&#x044C;:\n";
		print "<input type=\"password\" name=\"newrepass\" title=\"New RePassword\" maxlength=\"15\"/><br/>\n";

		if ($posts >= 9000) {
			print "Status: <input type=\"text\" name=\"cust_status\" title=\"Status\" emptyok=\"true\" maxlength=\"60\" value=\"".$cust_status."\"/><br/>\n";
		}

		print "* E-mail: <input type=\"text\" name=\"email\" title=\"E-mail\" emptyok=\"false\" maxlength=\"30\" value=\"".$email."\"/><br/>\n";

		if ($lang=='eng')
			print "Note: You must enter VALID e-mail, your password will be e-mailed to you!<br/>\n";
		else
			print "&#x0412;&#x041D;&#x0418;&#x041C;&#x0410;&#x041D;&#x0418;&#x0415;! &#x0423;&#x043A;&#x0430;&#x0437;&#x044B;&#x0432;&#x0430;&#x0439;&#x0442;&#x0435; &#x0422;&#x041E;&#x041B;&#x042C;&#x041A;&#x041E; &#x0434;&#x0435;&#x0439;&#x0441;&#x0442;&#x0432;&#x0438;&#x0442;&#x0435;&#x043B;&#x044C;&#x043D;&#x044B;&#x0439; E-MAIL! &#x0412;&#x0430;&#x0448; &#x043D;&#x043E;&#x0432;&#x044B;&#x0439; &#x043F;&#x0430;&#x0440;&#x043E;&#x043B;&#x044C; &#x0431;&#x0443;&#x0434;&#x0435;&#x0442; &#x043E;&#x0442;&#x043F;&#x0440;&#x0430;&#x0432;&#x043B;&#x0435;&#x043D; &#x043D;&#x0430; &#x044D;&#x0442;&#x043E;&#x0442; &#x0430;&#x0434;&#x0440;&#x0435;&#x0441;!<br/>\n";
		print "ICQ: <input type=\"text\" name=\"icq\" title=\"ICQ\" emptyok=\"false\" maxlength=\"10\" format=\"*N\" value=\"".$icq."\"/><br/>\n";

		if ($lang=='eng')
				print "* Real name:\n";
			else
				print "* &#x041F;&#x043E;&#x043B;&#x043D;&#x043E;&#x0435; &#x0438;&#x043C;&#x044F;:\n";
		print "<input type=\"text\" name=\"name\" title=\"Name\" maxlength=\"20\" value=\"".$name."\"/><br/>\n";

		if ($lang=='eng')
			print "* Birthday:\nDay:\n";
		else
			print "* &#x0414;&#x0430;&#x0442;&#x0430; &#x0440;&#x043E;&#x0436;&#x0434;&#x0435;&#x043D;&#x0438;&#x044F;:<br/>\n&#x0427;&#x0438;&#x0441;&#x043B;&#x043E;:\n";
		if (!$sie) {
			print "<select name=\"day\" value=\"".$regs[3]."\">\n";
			for ($i=1; $i<=31; $i++) {
				if ($i<10) print "<option value=\"0".$i."\">".$i."</option>\n";
				else print "<option value=\"".$i."\">".$i."</option>\n";
			}
			print "</select>\n";
		} else {
			print "<input name=\"day\" type=\"text\" value=\"".$regs[3]."\" maxlength=\"2\" format=\"2N\"/>\n";
		}

		if ($lang=='eng') {
			print "Month:\n";
		} else {
			print "&#x041C;&#x0435;&#x0441;&#x044F;&#x0446;:\n";
		}
		if (!$sie) {
			if ($lang=='eng') {
				print "<select name=\"month\" value=\"".$regs[2]."\">\n";
				print "<option value=\"01\">Jan</option>\n";
				print "<option value=\"02\">Feb</option>\n";
				print "<option value=\"03\">Mar</option>\n";
				print "<option value=\"04\">Apr</option>\n";
				print "<option value=\"05\">May</option>\n";
				print "<option value=\"06\">Jun</option>\n";
				print "<option value=\"07\">Jly</option>\n";
				print "<option value=\"08\">Aug</option>\n";
				print "<option value=\"09\">Sep</option>\n";
				print "<option value=\"10\">Oct</option>\n";
				print "<option value=\"11\">Nov</option>\n";
				print "<option value=\"12\">Dec</option>\n";
			} else {
				print "<select name=\"month\" value=\"".$regs[2]."\">\n";
				print "<option value=\"01\">&#x042F;&#x043D;&#x0432;</option>\n";
				print "<option value=\"02\">&#x0424;&#x0435;&#x0432;</option>\n";
				print "<option value=\"03\">&#x041C;&#x0430;&#x0440;</option>\n";
				print "<option value=\"04\">&#x0410;&#x043F;&#x0440;</option>\n";
				print "<option value=\"05\">&#x041C;&#x0430;&#x0439;</option>\n";
				print "<option value=\"06\">&#x0418;&#x044E;&#x043D;&#x044C;</option>\n";
				print "<option value=\"07\">&#x0418;&#x044E;&#x043B;&#x044C;</option>\n";
				print "<option value=\"08\">&#x0410;&#x0432;&#x0433;</option>\n";
				print "<option value=\"09\">&#x0421;&#x0435;&#x043D;</option>\n";
				print "<option value=\"10\">&#x041E;&#x043A;&#x0442;</option>\n";
				print "<option value=\"11\">&#x041D;&#x043E;&#x044F;</option>\n";
				print "<option value=\"12\">&#x0414;&#x0435;&#x043A;</option>\n";
			}
			print "</select>\n";
		} else {
			print "<input name=\"month\" type=\"text\" value=\"".$regs[2]."\" maxlength=\"2\" format=\"2N\"/>\n";
		}

		if ($lang=='eng')
			print "Year:\n";
		else
			print "&#x0413;&#x043E;&#x0434;:\n";
			print "<input name=\"year\" type=\"text\" value=\"".$regs[1]."\" maxlength=\"4\" format=\"4N\"/><br/>\n";

		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 "<input type=\"text\" name=\"operator\" title=\"Operator\" maxlength=\"20\" value=\"".$operator."\"/><br/>\n";

		if ($lang=='eng')
				print "Web site:\n";
			else
				print "&#x0421;&#x0442;&#x0440;&#x0430;&#x043D;&#x0438;&#x0447;&#x043A;&#x0430; &#x0432; Internet:\n";
		print "<input type=\"text\" name=\"website\" title=\"Website\" maxlength=\"50\" value=\"".$website."\"/><br/>\n";

		if ($lang=='eng')
				print "Wap site:\n";
			else
				print "&#x0421;&#x0442;&#x0440;&#x0430;&#x043D;&#x0438;&#x0447;&#x043A;&#x0430; &#x0432; Wap:\n";
		print "<input type=\"text\" name=\"wap\" title=\"Wap\" maxlength=\"50\" value=\"".$wap."\"/><br/>\n";

		if ($lang=='eng')
				print "* Where are you from:\n";
			else
				print "* &#x041E;&#x0442;&#x043A;&#x0443;&#x0434;&#x0430; &#x0412;&#x044B;:\n";
		print "<input type=\"text\" name=\"fr\" title=\"From\" maxlength=\"50\" value=\"".$fr."\"/><br/>\n";

		if ($lang=='eng')
				print "Phone Number:\n";
			else
				print "&#x041D;&#x043E;&#x043C;&#x0435;&#x0440; &#x0442;&#x0435;&#x043B;&#x0435;&#x0444;&#x043E;&#x043D;&#x0430;:\n";
		print "<input type=\"text\" name=\"phonenum\" title=\"PhoneNum\" maxlength=\"25\" value=\"".$phonenum."\"/><br/>\n";

		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 "<input type=\"text\" name=\"phonemodel\" title=\"PhoneModel\" maxlength=\"20\" value=\"".$phonemodel."\"/><br/>\n";

		if ($lang=='eng')
				print "Job:\n";
			else
				print "&#x041C;&#x0435;&#x0441;&#x0442;&#x043E; &#x0440;&#x0430;&#x0431;&#x043E;&#x0442;&#x044B;/&#x0443;&#x0447;&#x0435;&#x0431;&#x044B;:\n";
		print "<input type=\"text\" name=\"job\" title=\"Job\" maxlength=\"50\" value=\"".$job."\"/><br/>\n";

		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 "<input type=\"text\" name=\"info\" title=\"Info\" maxlength=\"300\" value=\"".$info."\"/><br/>\n";
		if ($lang=='eng')
			print "NOTE: Required fields marked *<br/>";
		else
			print "&#x041E;&#x0431;&#x044F;&#x0437;&#x0430;&#x0442;&#x0435;&#x043B;&#x044C;&#x043D;&#x044B;&#x0435; &#x043F;&#x043E;&#x043B;&#x044F; &#x043E;&#x0442;&#x043C;&#x0435;&#x0447;&#x0435;&#x043D;&#x044B; *<br/>";
?>
<anchor title="Ok">Ok<go href="user_update.php" method="post">
<?php
print "<postfield name=\"login\" value=\"".$login."\"/>\n";
print "<postfield name=\"pass\" value=\"".$pass."\"/>\n";
?>
<postfield name="newpass" value="$(newpass)"/>
<postfield name="newrepass" value="$(newrepass)"/>
<?php if ($posts >= 9000) {
print "<postfield name=\"cust_status\" value=\"$(cust_status)\"/>\n";
} ?>
<postfield name="email" value="$(email)"/>
<postfield name="icq" value="$(icq)"/>
<postfield name="name" value="$(name)"/>
<postfield name="day" value="$(day)"/>
<postfield name="month" value="$(month)"/>
<postfield name="year" value="$(year)"/>
<postfield name="operator" value="$(operator)"/>
<postfield name="fr" value="$(fr)"/>
<postfield name="website" value="$(website)"/>
<postfield name="wap" value="$(wap)"/>
<postfield name="phonenum" value="$(phonenum)"/>
<postfield name="phonemodel" value="$(phonemodel)"/>
<postfield name="info" value="$(info)"/>
<postfield name="job" value="$(job)"/>
<?php print "<postfield name=\"lang\" value=\"".$lang."\"/>\n"; ?>
</go></anchor>
</p>
</card>
</wml>