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

Размер файла: 12.54Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);          /////////////// игнорируем ошибки
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-relative");

list($msec,$sec)=explode(chr(32),microtime()); 
$HeadTime=$sec+$msec;									

$rand=rand(100000000,1000000);
require("conf.inc.php");
global $REMOTE_ADDR;
global $HTTP_USER_AGENT;

$id=@mysql_escape_string($id);
$pass=@mysql_escape_string($pass);
$login=@mysql_escape_string($login);

$link=mysql_connect ($DB_HOST, $DB_USER, $DB_PASS) or die ('<wml><card id="dberror" title="Ошибка" ontimer="http://prowap.ru/chat"><timer value="15"/>'.
        '<p>'.
        'Р?звините, РЅРѕ база данных РЅРµ доступна РІ данный момент!'.
        '<br/>'.
        '<anchor>Назад<prev/></anchor><br/>'.
        '<a href="/">[PROwap.ru]</a>'.
        '</p>'.
        '</card>'.
        '</wml>');
mysql_select_db($DB_NAME) or die ('<wml><card id="dberror" title="Ошибка" ontimer="http://prowap.ru/chat"><timer value="15"/>'.
        '<p>'.
        'Р?звините, РЅРѕ база данных РЅРµ доступна РІ данный момент!'.
        '<br/>'.
        '<anchor>Назад<prev/></anchor><br/>'.
        '<a href="/">[PROwap.ru]</a>'.
        '</p>'.
        '</card>'.
        '</wml>');

if(empty($id)) {
$find_user=mysql_query("Select * from users where cid='".$cid."' AND login='".$login."' and pass='".$pass."'") or die ('<wml><card id="dberror" title="Ошибка" ontimer="http://prowap.ru/chat"><timer value="15"/>'.
        '<p>'.
        'Р?звините, РЅРѕ база данных РЅРµ доступна РІ данный момент!'.
        '<br/>'.
        '<anchor>Назад<prev/></anchor><br/>'.
        '<a href="/">[PROwap.ru]</a>'.
        '</p>'.
        '</card>'.
        '</wml>');
} else {
$find_user=mysql_query("Select * from users where cid='".$cid."' AND id='".$id."' and pass='".$pass."'") or die ('<wml><card id="dberror" title="Ошибка" ontimer="http://prowap.ru/chat"><timer value="15"/>'.
        '<p>'.
        'Р?звините, РЅРѕ база данных РЅРµ доступна РІ данный момент!'.
        '<br/>'.
        '<anchor>Назад<prev/></anchor><br/>'.
        '<a href="/">[PROwap.ru]</a>'.
        '</p>'.
        '</card>'.
        '</wml>');
}
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'];
$softt=$row['browser'];
$ipp=$row['ip'];
$safe=$row['safe'];

//система безопасности
  			if (($row["browser"]!==$HTTP_USER_AGENT) or ($row["ip"]!==$REMOTE_ADDR))
  			{

  			if ($row['safe']==1)
  			{
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="proverka" title="&#x412;&#x43D;&#x438;&#x43C;&#x430;&#x43D;&#x438;&#x435;!">
			<p align="center">
<a href="enter.php?id=$id&amp;pass=$pass&amp;ref=$rand&amp;cid=$cid">&#x41F;&#x440;&#x43E;&#x434;&#x43E;&#x43B;&#x436;&#x438;&#x442;&#x44C;</a><br/>
<b>&#x41F;&#x440;&#x435;&#x434;&#x443;&#x43F;&#x440;&#x435;&#x436;&#x434;&#x435;&#x43D;&#x438;&#x435; &#x43E; &#x431;&#x435;&#x437;&#x43E;&#x43F;&#x430;&#x441;&#x43D;&#x43E;&#x441;&#x442;&#x438;!</b><br/>
&#x412;&#x43D;&#x438;&#x43C;&#x430;&#x43D;&#x438;&#x435;! &#x412;&#x430;&#x448; &#x442;&#x435;&#x43A;&#x443;&#x449;&#x438;&#x439; browser &#x438;&#x43B;&#x438; ip &#x430;&#x434;&#x440;&#x435;&#x441; &#x43D;&#x435; &#x441;&#x43E;&#x432;&#x43F;&#x430;&#x434;&#x430;&#x44E;&#x442; &#x441; ip+browser &#x43F;&#x43E;&#x441;&#x43B;&#x435;&#x434;&#x43D;&#x435;&#x433;&#x43E; &#x437;&#x430;&#x445;&#x43E;&#x434;&#x430;. &#x42D;&#x442;&#x43E; &#x43C;&#x43E;&#x436;&#x435;&#x442; &#x43E;&#x437;&#x43D;&#x430;&#x447;&#x430;&#x442;&#x44C;, &#x447;&#x442;&#x43E; &#x43A;&#x442;&#x43E;-&#x442;&#x43E; &#x437;&#x430;&#x445;&#x43E;&#x434;&#x438;&#x442; &#x441; &#x412;&#x430;&#x448;&#x435;&#x433;&#x43E; &#x43D;&#x438;&#x43A;&#x430;. &#x420;&#x435;&#x43A;&#x43E;&#x43C;&#x435;&#x43D;&#x434;&#x443;&#x435;&#x43C; &#x441;&#x43C;&#x435;&#x43D;&#x438;&#x442;&#x44C; &#x432;&#x430;&#x448; &#x43F;&#x430;&#x440;&#x43E;&#x43B;&#x44C;.
 <br/>
<u>&#x412;&#x430;&#x448;&#x438; &#x442;&#x435;&#x43A;&#x443;&#x449;&#x438;&#x435; &#x434;&#x430;&#x43D;&#x43D;&#x44B;&#x435;:</u>
<br/>ip: $REMOTE_ADDR <br/> browser: $HTTP_USER_AGENT
<u>&#x414;&#x430;&#x43D;&#x43D;&#x44B;&#x435; &#x441; &#x43F;&#x43E;&#x441;&#x43B;&#x435;&#x434;&#x43D;&#x435;&#x433;&#x43E; &#x437;&#x430;&#x445;&#x43E;&#x434;&#x430;:</u>
<br/>ip: $ipp <br/> browser: $softt <br/>
(&#x41E;&#x442;&#x43A;&#x43B;&#x44E;&#x447;&#x438;&#x442;&#x44C; &#x441;&#x438;&#x441;&#x442;&#x435;&#x43C;&#x443; &#x431;&#x435;&#x437;&#x43E;&#x43F;&#x430;&#x441;&#x43D;&#x43E;&#x441;&#x442;&#x438; &#x43C;&#x43E;&#x436;&#x43D;&#x43E; &#x432; &#x43D;&#x430;&#x441;&#x442;&#x440;&#x43E;&#x439;&#x43A;&#x430;&#x445; &#x447;&#x430;&#x442;&#x430;, &#x43D;&#x43E; &#x44D;&#x442;&#x43E;&#x433;&#x43E; &#x434;&#x435;&#x43B;&#x430;&#x442;&#x44C; &#x43D;&#x435; &#x440;&#x435;&#x43A;&#x43E;&#x43C;&#x435;&#x43D;&#x434;&#x443;&#x435;&#x442;&#x441;&#x44F;.)<br/>
<a href="enter.php?id=$id&amp;pass=$pass&amp;ref=$rand&amp;cid=$cid">&#x41F;&#x440;&#x43E;&#x434;&#x43E;&#x43B;&#x436;&#x438;&#x442;&#x44C;</a><br/>
			</p>
		</card>
	</wml>
END;
mysql_query("update users set browser='$HTTP_USER_AGENT', ip='$REMOTE_ADDR' where cid='".$cid."' AND id='$id';");
return 0;
		} else {
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;
				}
//даём статус
if(empty($status)) {
mysql_query("update users set status='Прохожий' where cid='".$cid."' AND  id='$id' or login='$login';");
}
if($posts>=100 && $posts<500 && $status=="Прохожий") {
mysql_query("update users set status='Новичок' where cid='".$cid."' AND  (id='$id' or login='$login');");
}
if($posts>=500 && $posts<1000 && $status=="Новичок") {
mysql_query("update users set status='Пользователь' where cid='".$cid."' AND  (id='$id' or login='$login');");
}
if($posts>=1000 && $posts<3000 && $status=="Пользователь") {
mysql_query("update users set status='Продвинутый' where cid='".$cid."' AND  (id='$id' or login='$login');");
}
if($posts>=3000 && $posts<5000 && $status=="Продвинутый") {
mysql_query("update users set status='Чаттер' where cid='".$cid."' AND  (id='$id' or login='$login');");
}
if($posts>=5000 && $posts<7000 && $status=="Чаттер") {
mysql_query("update users set status='Тусовщик' where cid='".$cid."' AND  (id='$id' or login='$login');");
}
if($posts>=7000 && $status=="Тусовщик") {
mysql_query("update users set status='Почетный' where cid='".$cid."' AND  (id='$id' or login='$login');");
}
//конец


@mysql_query("update users set `ltime`='".time()."', `lroom`='$room' where cid='".$cid."' AND  (id='$id' or login='$login');");

			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=\"&#x41F;&#x440;&#x438;&#x445;&#x43E;&#x436;&#x430;&#x44F;\">\n";
			echo "<p align=\"center\">\n";

@mysql_query("DELETE FROM `room` WHERE `wtime`<'".(time()-3600*4)."';");

$serv=mysql_query("select * from cusers where cid='".$cid."';");
$chats = @mysql_fetch_array($serv);
$chatname=$chats['chatname'];
$name=$chats['name'];
$slink=$chats['link'];

if($row['fsize'] == "small") { $fsize1 = "<small>"; $fsize2 = "</small>"; }
elseif($row['fsize'] == "big") { $fsize1 = "<big>"; $fsize2 = "</big>"; }
else { $fsize1 = ""; $fsize2 = ""; }
echo $fsize1; 
			$let_in=mysql_query("select id from letters where cid='".$cid."' AND to_user='$login' and new=1;");
			$num_in=mysql_affected_rows()+0;

			$let_in2=mysql_query("select id from letters where cid='".$cid."' AND to_user='$login'");
			$num_in2=mysql_affected_rows()+0;

			$met=mysql_query("select id from vstrechi where cid='".$cid."' AND 1");
			$num_met=mysql_affected_rows()+0;

			if($row['admin']) { echo "<a href=\"admin.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">РђРґРјРёРЅРєР°</a><br/>***<br/>\n"; }
			if($row['smoder']) { echo "<a href=\"smoder.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x421;-&#x43C;&#x43E;&#x434;&#x435;&#x440;&#x43A;&#x430;</a><br/>***<br/>\n"; }
			if($row['moder']) { echo "<a href=\"moder.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x41C;&#x43E;&#x434;&#x435;&#x440;&#x43A;&#x430;</a><br/>***<br/>\n"; }
			if($row['vip']) { echo "<a href=\"vip.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">V.I.P. &#x43F;&#x430;&#x43D;&#x435;&#x43B;&#x44C;</a><br/>***<br/>\n"; }
                  echo "<a href=\"help.php?id=$id&amp;pass=$pass&amp;mod=rules&amp;cid=$cid&amp;ref=$rand\">&#x41F;&#x440;&#x430;&#x432;&#x438;&#x43B;&#x430;</a><br/>\n";					
                  echo "<a href=\"vstrechi.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x412;&#x441;&#x442;&#x440;&#x435;&#x447;&#x438;($num_met)</a><br/>\n";
		      echo "***<br/>";			
                  echo "<a href=\"letters/index.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x417;&#x430;&#x43F;&#x438;&#x441;&#x43A;&#x438;($num_in/$num_in2)</a><br/>\n";
                  echo "<a href=\"online.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">Кто где?</a><br/>\n";
			echo "<a href=\"search.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x41F;&#x43E;&#x438;&#x441;&#x43A;</a><br/>\n";
			echo "***<br/>";
        $q = @mysql_query("select `var`,`val1` from setts where cid='".$cid."' AND `mod`='room' order by val3;");
        while($droom = @mysql_fetch_array($q)) {
                $q_count = @mysql_query("SELECT count(*) FROM users WHERE cid='".$cid."' AND `ltime`>'".intval(time()-300)."' AND `lroom`='".$droom['var']."';");
                $dcount = @mysql_fetch_array($q_count);
                echo '<a href="room.php?id='.$id.'&amp;pass='.$pass.'&amp;cid='.$cid.'&amp;room='.$droom['var'].'">'.$droom['val1'].'('.$dcount['count(*)'].')</a><br/>';
        }
			echo "***<br/>\n";
			echo "<a href=\"stats.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x421;&#x442;&#x430;&#x442;&#x438;&#x441;&#x442;&#x438;&#x43A;&#x430;</a><br/>\n";
			echo "<a href=\"help.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">F.A.Q.</a><br/>\n";
			echo "<a href=\"setup.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">Настройки &#x447;&#x430;&#x442;&#x430;</a><br/>\n";
			echo "<a href=\"edit_profile.php?id=$id&amp;pass=$pass&amp;cid=$cid&amp;ref=$rand\">&#x41C;&#x43E;&#x44F; &#x430;&#x43D;&#x43A;&#x435;&#x442;&#x430;</a><br/>\n";
			echo "***\n";
        		$pr_count = @mysql_query("SELECT count(*) FROM users WHERE cid='".$cid."' AND ltime>'".intval(time()-300)."' AND lroom='';");        
        		$pdc = @mysql_fetch_array($pr_count);
        		echo '<br/>&#x421;&#x435;&#x439;&#x447;&#x430;&#x441; &#x432; &#x43F;&#x440;&#x438;&#x445;&#x43E;&#x436;&#x435;&#x439;: '.$pdc['count(*)'].'<br/>';
			echo "***\n";
			echo "<br/><a href=\"$slink\">$name</a>\n";
		echo $fsize2;
	
}
?>
</p>
</card>
</wml>