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

Размер файла: 8.78Kb
<?
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;

$pass=@mysql_escape_string($pass);

$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 id=\"setup\" title=\"&#x41D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x438; &#x447;&#x430;&#x442;&#x430;\">\n";
echo "<p align=\"left\">\n";

if(empty($action)) {
?>
&#x41A;&#x43E;&#x43B;-&#x432;&#x43E; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x439;:<br/>
<select name="num_msgs" title="&#x41A;&#x43E;&#x43B;-&#x432;&#x43E; &#x441;&#x43E;&#x43E;&#x431;&#x449;&#x435;&#x43D;&#x438;&#x439;" value="<? if(!empty($row['num_msgs'])) print $row['num_msgs']; ?>">
<option value="5">5</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="15">15</option>
<option value="20">20</option>
</select><br/>
&#x412;&#x440;&#x435;&#x43C;&#x44F; &#x43E;&#x431;&#x43D;&#x43E;&#x432;&#x43B;&#x435;&#x43D;&#x438;&#x44F;:<br/>
<select name="time_update" title="&#x412;&#x440;&#x435;&#x43C;&#x44F; &#x43E;&#x431;&#x43D;&#x43E;&#x432;&#x43B;&#x435;&#x43D;&#x438;&#x44F;" value="<? if(!empty($row['time_update'])) print $row['time_update']; ?>">
<option value="150">15</option>
<option value="200">20</option>
<option value="300">30</option>
<option value="450">45</option>
<option value="500">50</option>
<option value="600">60</option>
</select><br/>
&#x421;&#x438;&#x441;&#x442;&#x435;&#x43C;&#x430; &#x431;&#x435;&#x437;&#x43E;&#x43F;&#x430;&#x441;&#x43D;&#x43E;&#x441;&#x442;&#x438;:<br/>
<select name="safe" title="&#x411;&#x435;&#x437;&#x43E;&#x43F;&#x430;&#x441;&#x43D;&#x43E;&#x441;&#x442;&#x44C;" value="<? if(!empty($row['safe'])) print $row['safe']; ?>">
<option value="0">&#x432;&#x44B;&#x43A;&#x43B;.</option>
<option value="1">&#x432;&#x43A;&#x43B;.</option>
</select><br/>
&#x422;&#x440;&#x430;&#x43D;&#x441;&#x43B;&#x438;&#x442;:<br/>
<select name="trans" title="&#x422;&#x440;&#x430;&#x43D;&#x441;&#x43B;&#x438;&#x442;" value="<? if(!empty($row['trans'])) print $row['trans']; ?>">
<option value="0">&#x432;&#x44B;&#x43A;&#x43B;.</option>
<option value="1">&#x432;&#x43A;&#x43B;.</option>
</select><br/>
&#x421;&#x43C;&#x430;&#x439;&#x43B;&#x44B;:<br/>
<select name="smile" title="&#x421;&#x43C;&#x430;&#x439;&#x43B;&#x44B;" value="<? if(!empty($row['smile'])) print $row['smile']; ?>">
<option value="0">&#x432;&#x44B;&#x43A;&#x43B;.</option>
<option value="1">&#x432;&#x43A;&#x43B;.</option>
</select><br/>
&#x420;&#x430;&#x437;&#x43C;&#x435;&#x440; &#x448;&#x440;&#x438;&#x444;&#x442;&#x430;:<br/>
<select name="fsize" value="<? if(!empty($row['fsize'])) print $row['fsize']; ?>">
<option value="small">&#x41C;&#x430;&#x43B;&#x435;&#x43D;&#x44C;&#x43A;&#x438;&#x439;</option>
<option value="medium">&#x41D;&#x43E;&#x440;&#x43C;&#x430;&#x43B;&#x44C;&#x43D;&#x44B;&#x439;</option>
<option value="big">&#x411;&#x43E;&#x43B;&#x44C;&#x448;&#x43E;&#x439;</option>
</select><br/>
<anchor>&#x418;&#x437;&#x43C;&#x435;&#x43D;&#x438;&#x442;&#x44C;<go href="setup.php?id=<? print $id; ?>&amp;pass=<? print $pass; ?>&amp;cid=<? print $cid; ?>&amp;ref=<? print $rand; ?>" method="post">
<postfield name="action" value="setup"/>
<postfield name="num_msgs" value="$(num_msgs)"/>
<postfield name="time_update" value="$(time_update)"/>
<postfield name="trans" value="$(trans)"/>
<postfield name="smile" value="$(smile)"/>
<postfield name="safe" value="$(safe)"/>
<postfield name="fsize" value="$(fsize)"/></go></anchor>
<?
}
else
{
	if(empty($num_msgs)) $num_msgs = 5;
	if(empty($time_update)) $time_update = 300;
	if(empty($safe)) $safe = 0;
	if(empty($trans)) $trans = 0;
	if(empty($smile)) $smile = 0;
	if(empty($fsize)) $fsize = small;
	$query=@mysql_query("update users set num_msgs='".$num_msgs."', time_update='".$time_update."', trans='".$trans."', smile='".$smile."', safe='".$safe."', fsize='".$fsize."' where cid='".$cid."' and id='".$id."';");
	if($query) print "<b>&#x41D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x438; &#x438;&#x437;&#x43C;&#x435;&#x43D;&#x435;&#x43D;&#x44B;!</b><br/>";
print "<a href=\"enter.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x41F;&#x440;&#x438;&#x445;&#x43E;&#x436;&#x430;&#x44F;</a>";
} 
} 

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