Файл: str.php
Строк: 65
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
include($path.'files/core.php');
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
header('location: work.php');exit;
}
$mobs1=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows1=mysql_num_rows($mobs1);
if($rows1!=0)
{
header('location: arena.php');exit;
}
$mobs2=mysql_query("SELECT * FROM `avan_usr` WHERE `usr`='".$udata['id']."'");
$rows2=mysql_num_rows($mobs2);
if($rows2!=0)
{
header('location: avan.php');exit;
}
$mobs3=mysql_query("SELECT * FROM `battle` WHERE `usr`='".$udata['id']."'");
$rows3=mysql_num_rows($mobs3);
if($rows3!=0)
{
header('location: battle.php');exit;
}
$mobs4=mysql_query("SELECT * FROM `ohota` WHERE `usr`='".$udata['id']."'");
$rows4=mysql_num_rows($mobs4);
if($rows4!=0)
{
header('location: b_oh.php');exit;
}
$mobs5=mysql_query("SELECT * FROM `okr_usr` WHERE `usr`='".$udata['id']."'");
$rows5=mysql_num_rows($mobs5);
if($rows5!=0)
{
header('location: b_okr.php');exit;
}
$mobs7=mysql_query("SELECT * FROM `terr_usr` WHERE `usr`='".$udata['id']."'");
$rows7=mysql_num_rows($mobs7);
if($rows7!=0)
{
header('location: terr_b.php');exit;
}
if($udata['lvl']<5)
{
mysql_query("INSERT INTO `user_log` SET `usr`='".$udata['id']."', `text`='Доступ в Штурм с 5 уровня!'");
header('location: game.php');exit;
}
if($udata['stt']>time())
{
$bn=$udata['stt']-time();
mysql_query("INSERT INTO `user_log` SET `usr`='".$udata['id']."', `text`='Вы неможете зайти сюда еще: ".$bn."c.'");
header('location: game.php');exit;
}
$arr_usr=mysql_num_rows(mysql_query("SELECT * FROM `stt_usr` WHERE `usr`='".$udata['id']."'"));
if($arr_usr!=0)
{
header('location: b_str.php');exit;
}
else
{
$ti=time();
if($udata['lvl']<=15)
{
$arr=1;
$b=rand(1,5);
}
elseif($udata['lvl']>=16 and $udata['lvl']<=30)
{
$arr=2;
$b=rand(6,10);
}
elseif($udata['lvl']>=31 and $udata['lvl']<=38)
{
$arr=3;
$b=rand(11,15);
}
elseif($udata['lvl']>=39 and $udata['lvl']<=50)
{
$arr=4;
$b=rand(16,20);
}
elseif($udata['lvl']>=51 and $udata['lvl']<=60)
{
$arr=5;
$b=rand(21,25);
}
mysql_query("INSERT INTO `stt_usr` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='str',
`arr`='".$arr."',
`b`='".$b."',
`hp`='".$udata['hp']."',
`arm`='".$udata['arm']."',
`kom`='".$udata['rasa']."',
`sila`='".$udata['sila']."'
");
$tr=mysql_query("SELECT * FROM `pit` WHERE `usr`='".$udata['id']."' and `status`='1'");
$num=mysql_num_rows($tr);
if($num!=0)
{
$t=mysql_fetch_array($tr);
$kn=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `tip`='knyt' and `usr`='".$udata['id']."' and `status`='on'"));
if($kn!=0)
{
$t['hp']=round($t['hp']+$t['hp']/100*15);
$t['sila']=round($t['sila']+$t['sila']/100*15);
$t['arm']=round($t['arm']+$t['arm']/100*15);
}
$kn2=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `tip`='knyt2' and `usr`='".$udata['id']."' and `status`='on'"));
if($kn2!=0)
{
$t['hp']=round($t['hp']+$t['hp']/100*30);
$t['sila']=round($t['sila']+$t['sila']/100*30);
$t['arm']=round($t['arm']+$t['arm']/100*30);
}
mysql_query("INSERT INTO `stt_usr` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='pit',
`arr`='".$arr."',
`b`='".$b."',
`pit`='".$t['id']."',
`hp`='".$t['hp']."',
`arm`='".$t['arm']."',
`sila`='".$t['sila']."',
`kom`='".$udata['rasa']."'
");
}
header('location: b_str.php');exit;
}
?>