Просмотр файла chat_servis/edit_profile.php

Размер файла: 7.81Kb
<?
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">
				&#x41B;&#x43E;&#x433;&#x438;&#x43D; &#x438;&#x43B;&#x438; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44C; &#x43D;&#x435;&#x432;&#x435;&#x440;&#x43D;&#x44B;, &#x43F;&#x440;&#x43E;&#x432;&#x435;&#x440;&#x44C;&#x442;&#x435; &#x432;&#x430;&#x448; &#x432;&#x432;&#x43E;&#x434;.
			</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">
								&#x412;&#x44B; &#x437;&#x430;&#x431;&#x430;&#x43D;&#x435;&#x43D;&#x44B; &#x43F;&#x43E; &#x441;&#x432;&#x44F;&#x437;&#x43A;&#x435; 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=\"&#x410;&#x43D;&#x43A;&#x435;&#x442;&#x430;\">\n";
echo "<p align=\"left\">\n";

if(empty($action)) {
?>
&#x418;&#x43C;&#x44F;:<br/>
<input type="text" name="name" value="<? print $row['name']; ?>" emptyok="false"/><br/>
&#x41F;&#x430;&#x440;&#x43E;&#x43B;&#x44C;:<br/>
<input type="text" name="newpass" value="<? print $row['pass']; ?>" emptyok="false"/><br/>
&#x41F;&#x43E;&#x43B;:<br/>
<select name="sex" title="1" value="<? print $row['sex']; ?>">
<option value="m">M</option>
<option value="zh">&#x416;</option></select><br/>
&#x414;&#x430;&#x442;&#x430; &#x440;&#x43E;&#x436;&#x434;&#x435;&#x43D;&#x438;&#x44F;:<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/>
&#x413;&#x43E;&#x440;&#x43E;&#x434;:<br/>
<input type="text" name="live" value="<? print $row['live']; ?>" emptyok="true"/><br/>
&#x41C;&#x43E;&#x434;&#x435;&#x43B;&#x44C; &#x442;&#x435;&#x43B;&#x435;&#x444;&#x43E;&#x43D;&#x430;:<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 &#x441;&#x430;&#x439;&#x442;:<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/>
&#x43E; &#x441;&#x435;&#x431;&#x435;:<br/>
<input type="text" name="about" value="<? print $row['about']; ?>" emptyok="true"/><br/>
<anchor>&#x418;&#x437;&#x43C;&#x435;&#x43D;&#x438;&#x442;&#x44C;<go href="edit_profile.php?id=<? print $id; ?>&amp;pass=<? print $pass; ?>&amp;cid=<? print $cid; ?>&amp;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>&#x412;&#x430;&#x448;&#x430; &#x430;&#x43D;&#x43A;&#x435;&#x442;&#x430; &#x438;&#x437;&#x43C;&#x435;&#x43D;&#x435;&#x43D;&#x430;!</b><br/>";
print "<a href=\"enter.php?id=$id&amp;pass=$newpass&amp;ref=$rand&amp;cid=$cid\">&#x41F;&#x440;&#x438;&#x445;&#x43E;&#x436;&#x430;&#x44F;</a>";

}
}
?>
</p>
</card>
</wml>
<?
mysql_close($link);
?>