Файл: impwar.tk/ohota.php
Строк: 260
<?php
require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
$page_title = 'Охота';
require_once('conf/head.php');
require_once('conf/top.php');
$user_id=abs(intval($_SESSION['id']));
$user=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();
echo"<br/><center><p class='name'>Охота</p><img src='/img/ohota.gif' align='center' width='170' height='100' alt='' style='margin:2px;border:1px solid #5F6F75'></center>";
switch($_GET[act]){
default:
$user_id=abs(intval($_SESSION['id']));
$user=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();
if($user['ohota_time'] < time() and $user['ohota'] == 1){
if($user['ohota_monster'] == '1'){$name='Зомби' and $opis='Зомби' and $img='1.png' and $nagrada='Рука Зомби';}
elseif($user['ohota_monster'] == '2'){$name='Скелет' and $opis='Скелет' and $img='2.png' and $nagrada='Кость';}
elseif($user['ohota_monster'] == '3'){$name='Cкелет-маг' and $opis='Cкелет-маг' and $img='3.png' and $nagrada='Посох';}
elseif($user['ohota_monster'] == '4'){$name='Cкелет-млучник' and $opis='Cкелет-лучник' and $img='4.png' and $nagrada='Стрелы';}
elseif($user['ohota_monster'] == '5'){$name='Наставник Тьмы' and $opis='Наставник Тьмы' and $img='5.png' and $nagrada='Глаз';}
elseif($user['ohota_monster'] == '6'){$name='Дикий волк' and $opis='Дикий волк' and $img='6.png' and $nagrada='Хвост';}
$chislo=$user['ohota_chislo'];
$nagopit=$user['ohota_opit'];
echo "<br/><p><center><b><div style=color:#126478;font-size:15px;margin:12px;>Охота завершена</div></b><p>
<span style=color:#326F60;>Убито <b>$chislo</b> $opis </span><br/><span style=color:#7E7143;>
+ $nagrada ($chislo штук) <br/>
+ $nagopit опыта </p></center>
<div class='forlink'><a class='link' style='text-decoration:none;' href='ohota.php?act=add'>Забрать</a></div>";
}
elseif($user['ohota_time'] > time() or $user['ohota'] == 1)
{
$time_ostalos=$user['ohota_time']-time();
echo'<div class=r6><center><p>Вам осталось охотиться<span class="bonus"> ';
if($time_ostalos>=3600){echo'
'.(int)($time_ostalos/3600).' час.<b> '.($time_ostalos/60%60).'</b> мин.</div></span></center>';}
else{echo'<b> '.($time_ostalos/60%60).'</b> мин. <b>'.($time_ostalos%60).'</b> сек.</div></span></center>';}
}
else{
echo"<center><form action='?act=start' method='POST'>
<select name='time' class='input' style='width: 98%;' size='1'>
<option value='5'>5 минут</option>";
if ($user[lvl]>=5)echo"<option value='10'>10 минут</option>";
if ($user[lvl]>=10)echo"<option value='15'>15 минут</option>";
if ($user[lvl]>=13)echo"<option value='20'>20 минут</option>";
if ($user[lvl]>=15)echo"<option value='25'>25 минут</option>";
if ($user[lvl]>=18)echo"<option value='30'>30 минут</option>";
if ($user[lvl]>=20)echo"<option value='35'>35 минут</option>";
if ($user[lvl]>=22)echo"<option value='40'>40 минут</option>";
if ($user[lvl]>=25)echo"<option value='45'>45 минут</option>";
if ($user[lvl]>=27)echo"<option value='50'>50 минут</option>";
if ($user[lvl]>=29)echo"<option value='55'>55 минут</option>";
if ($user[lvl]>=30)echo"<option value='60'>1 час</option>";
if ($user[lvl]>=35)echo"<option value='90'>1 час 30 минут</option>";
if ($user[lvl]>=40)echo"<option value='120'>2 час</option>";
echo"</select><input style='width:98%; height:25px;' type='submit' value='На охоту!'/>
</form></center>";
}
break;
case'start':
$user_id=abs(intval($_SESSION['id']));
$user=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();
if($user['ohota'] == 1)
{header('location: ohota.php');exit();}
$time=time()+(abs(intval($_POST[time]))*60);
$timeo=abs(intval($_POST[time]));
if ($timeo>=5){$nagopit=rand(150,200) and $monster=rand(1,1) and $chislo=rand(1,1);}
if ($timeo>=10){$nagopit=rand(150,200) and $monster=rand(1,1) and $chislo=rand(1,1);}
if ($timeo>=15){$nagopit=rand(150,200) and $monster=rand(1,2) and $chislo=rand(1,1);}
if ($timeo>=20){$nagopit=rand(150,200) and $monster=rand(1,3) and $chislo=rand(1,2);}
if ($timeo>=25){$nagopit=rand(150,200) and $monster=rand(1,3) and $chislo=rand(1,3);}
if ($timeo>=30){$nagopit=rand(150,200) and $monster=rand(1,3) and $chislo=rand(1,3);}
if ($timeo>=35){$nagopit=rand(150,200) and $monster=rand(1,4) and $chislo=rand(1,4);}
if ($timeo>=40){$nagopit=rand(150,200) and $monster=rand(1,4) and $chislo=rand(1,5);}
if ($timeo>=45){$nagopit=rand(150,200) and $monster=rand(1,5) and $chislo=rand(2,5);}
if ($timeo>=50){$nagopit=rand(150,200) and $monster=rand(1,5) and $chislo=rand(3,6);}
if ($timeo>=55){$nagopit=rand(150,200) and $monster=rand(1,6) and $chislo=rand(3,7);}
if ($timeo>=60){$nagopit=rand(150,200) and $monster=rand(1,6) and $chislo=rand(4,7);}
if ($timeo>=90){$nagopit=rand(150,200) and $monster=rand(1,6) and $chislo=rand(5,7);}
if ($timeo>=120){$nagopit=rand(150,200) and $monster=rand(1,6) and $chislo=rand(6,7);}
if($user[vip]==1 and $user[viptime]>time()){$chislo=$chislo*2;}
$dbc->query("UPDATE `users` SET `ohota` = '1', `ohota_time` = '$time',`ohota_opit` = '$nagopit', `ohota_monster` = '$monster', `ohota_chislo` = '$chislo' WHERE `id` ='".$user_id."' LIMIT 1");
header('location: ohota.php');
break;
case'add':
$user_id=abs(intval($_SESSION['id']));
$user=$dbc->query("SELECT * FROM `users` WHERE`id`='$user_id' LIMIT 1")->fetch_assoc();
if($user['ohota_time'] > time())
{header('location: ohota.php');exit();}
if($user['ohota_monster'] == '1'){$monster='hvost_sobaki';}
if($user['ohota_monster'] == '2'){$monster='glas_ploti';}
if($user['ohota_monster'] == '3'){$monster='k_kabana';}
if($user['ohota_monster'] == '4'){$monster='hvost_psa';}
if($user['ohota_monster'] == '5'){$monster='noga_snorka';}
if($user['ohota_monster'] == '6'){$monster='sch_krovik';}
$opitn=$user['ohota_opit'];
$monstern=$user['ohota_chislo'];
$mplus=$monstern;
$dbc->query("UPDATE `users` SET `opit` =`opit` +$opitn, $monster =$monster+ '$mplus', `ohota` = '0', `ohota_time` = '0' , `ohota_opit` = '0' , `ohota_chislo` = '0' , `ohota_monster` = '0' WHERE `id` ='".$user_id."' LIMIT 1");
header('location: ohota.php');
break;
}
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>
</body>
</html>