<?
Error_Reporting(E_ALL & ~E_NOTICE); /////////////// игнорируем ошибки
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
list($msec,$sec)=explode(chr(32),microtime());
$HeadTime=$sec+$msec;
$rand=rand(10000,1000000);
require("conf.inc.php");
global $REMOTE_ADDR;
global $HTTP_USER_AGENT;
$link=mysql_connect ($DB_HOST, $DB_USER, $DB_PASS);
mysql_select_db($DB_NAME);
if(empty($id)) {
$find_user=mysql_query("Select * from users where cid='".$cid."' AND login='".$login."' and pass='".$pass."'") or die("Querry error");
} else {
$find_user=mysql_query("Select * from users where cid='".$cid."' AND id='".$id."' and pass='".$pass."'") or die("Querry error");
}
if(mysql_affected_rows()==0)
{
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="search" title="РџРѕРСвЂВВВРЎРѓР С”">
<p align="center">
Логин или пароль неверны, проверьте ваш ввод.
</p>
</card>
</wml>
END;
return 0;
}
else
{
$row=mysql_fetch_array($find_user);
$login=$row['login'];
$id=$row['id'];
$admin=$row['admin'];
$status=$row['status'];
$posts=$row['posts'];
if (($row["browser"]!==$HTTP_USER_AGENT) or ($row["ip"]!==$REMOTE_ADDR))
{
mysql_query("update users set browser='$HTTP_USER_AGENT', ip='$REMOTE_ADDR' where cid='".$cid."' AND id='$id';");
}
//Проверка, не забанен ли ip+browser:
mysql_query ("Select * from bannedib WHERE cid='".$cid."' AND (ip = '".$REMOTE_ADDR."')and(browser = '".$HTTP_USER_AGENT."')");
if(mysql_affected_rows()!=0)
{
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="error" title="Забанен">
<p align="center">
Вы забанены по связке ip+browser!
</p>
</card>
</wml>
END;
exit;
}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">\n";
echo "<wml>\n";
echo "<card title=\"Анкета\">\n";
echo "<p align=\"left\">\n";
if(empty($action)) {
?>
Имя:<br/>
<input type="text" name="name" value="<? print $row['name']; ?>" emptyok="false"/><br/>
Пароль:<br/>
<input type="text" name="newpass" value="<? print $row['pass']; ?>" emptyok="false"/><br/>
Пол:<br/>
<select name="sex" title="1" value="<? print $row['sex']; ?>">
<option value="m">M</option>
<option value="zh">Ж</option></select><br/>
Дата рождения:<br/>
<input size="2" name="bday" maxlength="2" value="<? print $row['bday']; ?>" format="*N" emptyok="true"/>-<input size="2" name="bmonth" maxlength="2" value="<? print $row['bmonth']; ?>" format="*N" emptyok="true"/>-<input size="4" name="byear" maxlength="4" value="<? print $row['byear']; ?>" format="*N" emptyok="true"/><br/>
Город:<br/>
<input type="text" name="live" value="<? print $row['live']; ?>" emptyok="true"/><br/>
Модель телефона:<br/>
<input type="text" name="mobile" value="<? print $row['mobile']; ?>" emptyok="true"/><br/>
e-mail:<br/>
<input type="text" name="email" value="<? print $row['email']; ?>" emptyok="true"/><br/>
WAP сайт:<br/>
<input type="text" name="url" value="<? print $row['url']; ?>" emptyok="true"/><br/>
ICQ:<br/>
<input size="9" name="icq" maxlength="9" format="*N" value="<? print $row['icq']; ?>" emptyok="true"/><br/>
о себе:<br/>
<input type="text" name="about" value="<? print $row['about']; ?>" emptyok="true"/><br/>
<anchor>Изменить<go href="edit_profile.php?id=<? print $id; ?>&pass=<? print $pass; ?>&cid=<? print $cid; ?>&ref=<? print $rand; ?>" method="post">
<postfield name="action" value="edit"/>
<postfield name="name" value="$(name)"/>
<postfield name="newpass" value="$(newpass)"/>
<postfield name="sex" value="$(sex)"/>
<postfield name="bday" value="$(bday)"/>
<postfield name="bmonth" value="$(bmonth)"/>
<postfield name="byear" value="$(byear)"/>
<postfield name="live" value="$(live)"/>
<postfield name="mobile" value="$(mobile)"/>
<postfield name="email" value="$(email)"/>
<postfield name="url" value="$(url)"/>
<postfield name="icq" value="$(icq)"/>
<postfield name="about" value="$(about)"/></go></anchor>
<?
}
else
{
if(@mysql_query("update users set name='$name',pass='$newpass',sex='$sex',bday='$bday',bmonth='$bmonth',byear='$byear',live='$live',mobile='$mobile',email='$email',url='$url',icq='$icq',about='$about' where cid='".$cid."' AND id='".$id."';"))
print "<b>Ваша анкета изменена!</b><br/>";
print "<a href=\"enter.php?id=$id&pass=$newpass&ref=$rand&cid=$cid\">Прихожая</a>";
}
}
?>
</p>
</card>
</wml>
<?
mysql_close($link);
?>