<?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 "Новый пароль:\n";
print "<input type=\"password\" name=\"newpass\" title=\"New Password\" maxlength=\"15\"/><br/>\n";
if ($lang=='eng')
print "Retype new password:\n";
else
print "Ещё раз новый пароль:\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 "ВНИМАНИЕ! Указывайте ТОЛЬКО действительный E-MAIL! Ваш новый пароль будет отправлен на этот адрес!<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 "* Полное имя:\n";
print "<input type=\"text\" name=\"name\" title=\"Name\" maxlength=\"20\" value=\"".$name."\"/><br/>\n";
if ($lang=='eng')
print "* Birthday:\nDay:\n";
else
print "* Дата рождения:<br/>\nЧисло:\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 "Месяц:\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\">Янв</option>\n";
print "<option value=\"02\">Фев</option>\n";
print "<option value=\"03\">Мар</option>\n";
print "<option value=\"04\">Апр</option>\n";
print "<option value=\"05\">Май</option>\n";
print "<option value=\"06\">Июнь</option>\n";
print "<option value=\"07\">Июль</option>\n";
print "<option value=\"08\">Авг</option>\n";
print "<option value=\"09\">Сен</option>\n";
print "<option value=\"10\">Окт</option>\n";
print "<option value=\"11\">Ноя</option>\n";
print "<option value=\"12\">Дек</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 "Год:\n";
print "<input name=\"year\" type=\"text\" value=\"".$regs[1]."\" maxlength=\"4\" format=\"4N\"/><br/>\n";
if ($lang=='eng')
print "* Operator:\n";
else
print "* Оператор сотовой связи:\n";
print "<input type=\"text\" name=\"operator\" title=\"Operator\" maxlength=\"20\" value=\"".$operator."\"/><br/>\n";
if ($lang=='eng')
print "Web site:\n";
else
print "Страничка в 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 "Страничка в 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 "* Откуда Вы:\n";
print "<input type=\"text\" name=\"fr\" title=\"From\" maxlength=\"50\" value=\"".$fr."\"/><br/>\n";
if ($lang=='eng')
print "Phone Number:\n";
else
print "Номер телефона:\n";
print "<input type=\"text\" name=\"phonenum\" title=\"PhoneNum\" maxlength=\"25\" value=\"".$phonenum."\"/><br/>\n";
if ($lang=='eng')
print "* Phone Model:\n";
else
print "* Модель телефона:\n";
print "<input type=\"text\" name=\"phonemodel\" title=\"PhoneModel\" maxlength=\"20\" value=\"".$phonemodel."\"/><br/>\n";
if ($lang=='eng')
print "Job:\n";
else
print "Место работы/учебы:\n";
print "<input type=\"text\" name=\"job\" title=\"Job\" maxlength=\"50\" value=\"".$job."\"/><br/>\n";
if ($lang=='eng')
print "More info:\n";
else
print "Дополнительно о себе:\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 "Обязательные поля отмечены *<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>