Файл: pdz.php
Строк: 271
<?
define('PROTECTOR', 1);
include('files/db.php');
include($path.'files/auth.php');
if ($user_id==0){
header('location: index.php');exit;
}
$textl='Подземелья';
include($path.'files/core.php');
if($udata['lvl']<5)
{
mysql_query("INSERT INTO `user_log` SET
`usr`='".$udata['id']."',
`text`='Минимальный уровень для режима 5.'
");
header('location: game.php');exit;
}
$npdz=mysql_num_rows(mysql_query("SELECT * FROM `pdz_usr` WHERE `usr`='".$udata['id']."'"));
if($npdz!=0)
{
header('location: pdz_b.php');exit;
}
$mobs=mysql_query("SELECT * FROM `craft` WHERE `usr`='".$udata['id']."'");
$rows=mysql_num_rows($mobs);
if($rows!=0)
{
header('location: work.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;
}
$mobs6=mysql_query("SELECT * FROM `str_usr` WHERE `usr`='".$udata['id']."'");
$rows6=mysql_num_rows($mobs6);
if($rows6!=0)
{
header('location: b_str.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;
}
$mobs8=mysql_query("SELECT * FROM `arena_m_usr` WHERE `usr`='".$udata['id']."'");
$rows8=mysql_num_rows($mobs8);
if($rows8!=0)
{
header('location: ar_m_b.php');exit;
}
$mobs8=mysql_query("SELECT * FROM `arena_duel_usr` WHERE `usr`='".$udata['id']."' and `ok`='2'");
$rows8=mysql_num_rows($mobs8);
if($rows8!=0)
{
header('location: ar_d_b.php');exit;
}
$mobs9=mysql_query("SELECT * FROM `arena_usr` WHERE `usr`='".$udata['id']."'");
$rows9=mysql_num_rows($mobs9);
if($rows9!=0)
{
header('location: ar_bz.php');exit;
}
if(isset($_GET['create']))
{
$lvl=mysql_real_escape_string($_POST['lvl']);
$voln=mysql_real_escape_string($_POST['voln']);
$sl=mysql_real_escape_string($_POST['sl']);
if($voln==3 or $voln==5 or $voln==7 or $voln==10 or $voln==15 or $voln==20)
{
if($udata['lvl']<$lvl)
{
}
else
{
if($udata['vip_exp']<100)
{$bl=1;}
elseif($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$bl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$bl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$bl=2;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$bl=2;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$bl=2;}
elseif($udata['vip_exp']>=5000){$bl=2;}
$pdz_bl=mysql_num_rows(mysql_query("SELECT * FROM `pdz_blok` WHERE `usr`='".$udata['id']."' and `pdz`='".$pdz['id']."'"));
if($pdz_bl==$bl)
{
}
else
{
$t=date('H');
$pdz=mysql_fetch_array(mysql_query("SELECT * FROM `pdz` WHERE `t1`='".$t."' or `t2`='".$t."'"));
mysql_query("INSERT INTO `pdz_kom` SET
`id`='',
`pdz`='".$pdz['id']."',
`lider`='".$udata['id']."',
`lvl`='".$lvl."',
`voln`='".$voln."',
`voln_max`='".$voln."',
`sl`='".$sl."',
`status`='0'
");
$id=mysql_insert_id();
mysql_query("INSERT INTO `pdz_usr` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='usr',
`arr`='".$id."',
`hp`='".$udata['hp']."',
`sila`='".$udata['sila']."',
`arm`='".$udata['arm']."'
");
$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);
mysql_query("INSERT INTO `pdz_usr` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='pit',
`pit`='".$t['id']."',
`arr`='".$id."',
`hp`='".$t['hp']."',
`sila`='".$t['sila']."',
`arm`='".$t['arm']."'
");
}
}
}
}
header('location: ?');exit;
}
if(isset($_GET['ins']))
{
$id=mysql_real_escape_string($_GET['ins']);
$t=date('H');
$pdz=mysql_fetch_array(mysql_query("SELECT * FROM `pdz` WHERE `t1`='".$t."' or `t2`='".$t."'"));
$komand=mysql_query("SELECT * FROM `pdz_kom` WHERE `pdz`='".$pdz['id']."' and `lvl`<='".$udata['lvl']."' and `status`='0' and `id`='".$id."'");
$nm=mysql_num_rows($komand);
if($nm!=0)
{
if($udata['vip_exp']<100)
{$bl=1;}
elseif($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$bl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$bl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$bl=2;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$bl=2;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$bl=2;}
elseif($udata['vip_exp']>=5000){$bl=2;}
$pdz_bl=mysql_num_rows(mysql_query("SELECT * FROM `pdz_blok` WHERE `usr`='".$udata['id']."' and `pdz`='".$pdz['id']."'"));
if($pdz_bl==$bl)
{
}
else
{
$kmd=mysql_fetch_array($komand);
mysql_query("INSERT INTO `pdz_usr` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='usr',
`arr`='".$kmd['id']."',
`hp`='".$udata['hp']."',
`sila`='".$udata['sila']."',
`arm`='".$udata['arm']."'
");
$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);
mysql_query("INSERT INTO `pdz_usr` SET
`id`='',
`usr`='".$udata['id']."',
`tip`='pit',
`pit`='".$t['id']."',
`arr`='".$kmd['id']."',
`hp`='".$t['hp']."',
`sila`='".$t['sila']."',
`arm`='".$t['arm']."'
");
}
}
}
header('location: ?vst&vs');exit;
}
include($path.'files/head.php');
include($path.'files/zag.php');
echo '<table width=100%>
<tr>
<td width=35%>
<a href=game.php><div style="background: #882222; border-radius: 7px 0 0 7px" class="m p bts bbs brs bls" align=center>Главная</div></a>
</td><td>';
echo '<a href=?><div class="line bts brs bls bbs p m" style="border-radius: 0 7px 7px 0">
<font color=#ffffff>Подземелья
</font>
</div></a></td></tr></table>';
echo '<div class="bat bts brs bls bbs p">';
$t=date('H');
$pdz=mysql_fetch_array(mysql_query("SELECT * FROM `pdz` WHERE `t1`='".$t."' or `t2`='".$t."'"));
$pdz_bl=mysql_num_rows(mysql_query("SELECT * FROM `pdz_blok` WHERE `usr`='".$udata['id']."' and `pdz`='".$pdz['id']."'"));
if($udata['vip_exp']<100)
{$bl=1;}
elseif($udata['vip_exp']>=100 and $udata['vip_exp']<250)
{$bl=1;}
elseif($udata['vip_exp']>=250 and $udata['vip_exp']<500)
{$bl=2;}
elseif($udata['vip_exp']>=500 and $udata['vip_exp']<1300)
{$bl=2;}
elseif($udata['vip_exp']>=1300 and $udata['vip_exp']<2500)
{$bl=2;}
elseif($udata['vip_exp']>=2500 and $udata['vip_exp']<5000)
{$bl=2;}
elseif($udata['vip_exp']>=5000){$bl=2;}
echo '
<div style="background:url(img/pdz/'.$pdz['img'].'.png) 50% 0 no-repeat; background-size: cover">
<table width=100%>
<tr><td>
<div class="p" style="background: #222222; opacity: 0.8" align=center> <font color=#ffffff><b>'.$pdz['name'].'</b> ';
if($pdz_bl<$bl){echo '<img src=img/main/1.png>';}else{echo '<img src=img/main/2.png>';}
echo'</font></div>
</td>
</tr>
<tr><td style="padding: 35px">
</td>
</tr>
</table>
</div>
';
if(isset($_GET['cr']))
{
if($pdz_bl<$bl)
{
echo '<img src=img/main/i25.png> <font color=#00ff99>Вы решили отправиться в этот поход? Для начала выберите критерии для подземелья.</font>';
echo '<form action=?create method=POST>
<table width=100%>
<tr>
<td colspan=1>Уровень похода:</td>
<td colspan=1><select name=lvl style="width:100%">';
if($udata['lvl']>=5){echo'<option value=5>5</option>';}
if($udata['lvl']>=8){echo'<option value=8>8</option>';}
if($udata['lvl']>=10){echo'<option value=10>10</option>';}
if($udata['lvl']>=15){echo'<option value=15>15</option>';}
if($udata['lvl']>=20){echo'<option value=20>20</option>';}
if($udata['lvl']>=25){echo'<option value=25>25</option>';}
if($udata['lvl']>=30){echo'<option value=30>30</option>';}
if($udata['lvl']>=33){echo'<option value=33>33</option>';}
if($udata['lvl']>=36){echo'<option value=36>36</option>';}
if($udata['lvl']>=39){echo'<option value=39>39</option>';}
if($udata['lvl']>=42){echo'<option value=42>42</option>';}
if($udata['lvl']>=45){echo'<option value=45>45</option>';}
if($udata['lvl']>=58){echo'<option value=48>48</option>';}
if($udata['lvl']>=50){echo'<option value=50>50</option>';}
echo'</select></td>
</tr>
<tr>
<td colspan=1>Волн до босса:</td>
<td colspan=1><select name=voln style="width:100%">';
echo'<option value=3>3</option>';
echo'<option value=5>5</option>';
echo'<option value=7>7</option>';
echo'<option value=10>10</option>';
echo'<option value=15>15</option>';
echo'<option value=20>20</option>';
echo'</select></td>
</tr>
<tr>
<td colspan=1>Сложность:</td>
<td colspan=1><select name=sl style="width:100%">';
echo'<option value=1>Обычный</option>';
echo'<option value=2>Опасный</option>';
echo'<option value=3>Эпический</option>';
echo'<option value=4>Легендарный</option>';
echo'<option value=5>Божественный</option>';
echo'</select></td>
</tr>
<tr><td colspan=2 align=center>
<input type=submit value="Создать" style="width:80%;margin:3px">
</td></tr>
</table>
</form>';
}
else
{
echo '<img src=img/main/i25.png> <font color=#ff0000>Вы уже посещали это подземелье за этот час.</font>';
}
}
elseif(isset($_GET['vs']))
{
if($pdz_bl<$bl)
{
echo '<img src=img/main/i25.png> <font color=#00ff99>Тут вы можете присоедениться к одной из компании собравшихся в поход.</font>';
$komand=mysql_query("SELECT * FROM `pdz_kom` WHERE `pdz`='".$pdz['id']."' and `lvl`<='".$udata['lvl']."' and `status`='0'");
while($kmd=mysql_fetch_array($komand))
{
$lider=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$kmd['lider']."'"));
echo '<div class="v5 v8 p">
<img src=img/main/e28.png> <font color=#ff9900>Группа:</font> ';
echo '<img src=img/main/c'.$lider['klass'].'.png> <img src=img/main/r'.$lider['rasa'].'.png> ';
echo '<a href=info.php?id='.$lider['id'].'>'.$lider['usr'].'</a> <img src=img/main/p10.png>'.$lider['lvl'].'<br>';
echo '<img src=img/main/e28.png> <font color=#ff9900>Уровень/Волн:</font> '.$kmd['lvl'].'/'.$kmd['voln'].'<br>';
echo '<img src=img/main/e30.png> <a href=?ins='.$kmd['id'].'>Вступить</a>';
echo'</div>';
}
}
else
{
echo '<img src=img/main/i25.png> <font color=#ff0000>Вы уже посещали это подземелье за этот час.</font>';
}
}
else
{
echo '<table width=100%>';
echo '<tr>';
echo '<td width=50%>';
echo'<a href=?cr><div style="position: relative;
font-weight: bold;
color: #ffff00;
text-decoration: none;
text-shadow: 0 -1px 1px #cc5500;
user-select: none;
padding: 3px 0 3px 3px;
outline: none;
border-radius: 1px;
background: rgb(0,120,0);
background-size: 100% 100%, auto;
background-position: 50% 50%;
box-shadow: inset rgb(0,170,0) 0 -1px 1px, inset 0 1px 1px rgb(0,170,0), rgb(0,170,0) 0 0 0 1px, #000 0 10px 15px -10px;
margin-left: 5px;
margin-right: 5px;
margin-top: 4px; text-align: center">Создать</div></a>';
echo '</td>';
echo '<td width=50%>';
echo'<a href=?vs><div style="position: relative;
font-weight: bold;
color: #ffff00;
text-decoration: none;
text-shadow: 0 -1px 1px #cc5500;
user-select: none;
padding: 3px 0 3px 3px;
outline: none;
border-radius: 1px;
background: rgb(0,120,150);
background-size: 100% 100%, auto;
background-position: 50% 50%;
box-shadow: inset rgb(0,170,200) 0 -1px 1px, inset 0 1px 1px rgb(0,170,200), rgb(0,170,200) 0 0 0 1px, #000 0 10px 15px -10px;
margin-left: 5px;
margin-right: 5px;
margin-top: 4px; text-align: center">Вступить</div></a>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
echo '</div></div>';
include('files/down.php');
?>