Файл: rayb.me/plugins/games/sahta.php
Строк: 119
<?php
require_once '../../system/func.php';
auth();
$title = 'Шахта';
require_once H.'system/header.php';
$sahta= mysqli_fetch_assoc(DB::Query("SELECT * FROM `sahta` WHERE `id_user`= '".$uid."' LIMIT 1"));
$time= time();
$stime= $sahta['time'];
$uruby= $user['ruby'];
if(isset($_GET['goaway'])){
if($stime== 0) $err= 'Не доступно';
if($stime> $time) $err= 'Не доступно';
if(!$err){
if($uruby> 50000){
$ruby= rand($sahta['rand1'],$sahta['rand1']+200);
}else{
$ruby= rand($sahta['rand1'],$sahta['rand2']);
}
DB::Query("update `sahta` set `time`= '0' where (`id_user`= '".$uid."')");
DB::Query("update `users` set `ruby`= `ruby`+ '".$ruby."' where (`id`= '".$uid."')");
if($uid== $slehka){
DB::Query("INSERT INTO `ruby_log` SET `user` = '".$uid."', `time` = '".$time."', `mesto` = 'шахта', `ruby` = '+".$ruby."'");
}
$_SESSION['msg'] = "<font color='green'>Ваш шахтер, добыл для вас: {$ruby} Рубиков!</font>";
go('?');
}else{
$_SESSION['msg'] = $err;
go('?');
}
}
if(isset($_GET['go'])){
if($sahta['otdih'] > $time) $_SESSION['msg'] = 'Не доступно';
if(!$err){
$times_doh = ($time+1200);
$times_otd = ($time+4000);
DB::Query("update `sahta` set `time`= '$times_doh', `otdih` = '$times_otd' where (`id_user` = '".$uid."')");
$_SESSION['msg'] = '<font color="green">Шахтер отправлен, за рубинами!</font>';
go('?');
}else{
$_SESSION['msg'] = $err;
go('?');
}
}
if ($sahta['level'] == 0){ $level = 1; $rand1 = 10; $rand2 = 50; $cena = 150;}
if ($sahta['level'] == 1){ $level = 2; $rand1 = 50; $rand2 = 100; $cena = 300;}
if ($sahta['level'] == 2){ $level = 3; $rand1 = 100; $rand2 = 150; $cena = 500;}
if ($sahta['level'] == 3){ $level = 4; $rand1 = 150; $rand2 = 200; $cena = 750;}
if ($sahta['level'] == 4){ $level = 5; $rand1 = 200; $rand2 = 300; $cena = 1000;}
if ($sahta['level'] == 5){ $level = 6; $rand1 = 300; $rand2 = 450; $cena = 2000;}
if ($sahta['level'] == 6){ $level = 7; $rand1 = 450; $rand2 = 600; $cena = 3500;}
if ($sahta['level'] == 7){ $level = 8; $rand1 = 600; $rand2 = 900; $cena = 6000;}
if ($sahta['level'] == 8){ $level = 9; $rand1 = 900; $rand2 = 1200; $cena = 10000;}
if ($sahta['level'] == 9){ $level = 10; $rand1 = 1200; $rand2 = 1600; $cena = 15000;}
if ($sahta['level'] == 10){ $level = 11; $rand1 = 1400; $rand2 = 1800; $cena = 20000;}
if ($sahta['level'] == 11){ $level = 12; $rand1 = 1600; $rand2 = 2200; $cena = 25000;}
if ($sahta['level'] == 12){ $level = 13; $rand1 = 2000; $rand2 = 2500; $cena = 30000;}
if ($sahta['level'] == 13){ $level = 14; $rand1 = 2200; $rand2 = 2700; $cena = 35000;}
if ($sahta['level'] == 14){ $level = 15; $rand1 = 2500; $rand2 = 3000; $cena = 45000;}
if ($sahta['level'] == 15){ $level = 16; $rand1 = 3000; $rand2 = 3500; $cena = 55000;}
if ($sahta['level'] == 16){ $level = 17; $rand1 = 3500; $rand2 = 4000; $cena = 65000;}
if ($sahta['level'] == 17){ $level = 18; $rand1 = 4000; $rand2 = 4500; $cena = 75000;}
if ($sahta['level'] == 18){ $level = 19; $rand1 = 4500; $rand2 = 5000; $cena = 90000;}
if ($sahta['level'] == 19){ $level = 20; $rand1 = 5000; $rand2 = 5500; $cena = 105000;}
if ($sahta['level'] == 20){ $level = 21; $rand1 = 5500; $rand2 = 6000; $cena = 145000;}
if ($sahta['level'] == 21){ $level = 22; $rand1 = 6000; $rand2 = 6300; $cena = 155000;}
if(isset($_GET['up'])){
if ($sahta['level'] >= 21){
$_SESSION['msg'] = '<font color="green">Максимальный Уровень</font>';
go('?');
}
echo"<div class ='bordered'>";
echo 'Вы действительно хотите поднять уровень?</br>';
echo 'Уровень вашей шахты будет '.$level.'</br>';
echo 'Доход: от '.$rand1.' до '.$rand2.'</br>';
echo 'Цена за '.$level.' уровень: '.$cena.' рубинов</br>';
echo '<center><a class="btni" href="?up_ok">Поднять</a> <a class="btni" href="?">Отмена</a></center>';
echo '</div>';
}
if(isset($_GET['up_ok'])){
if ($sahta['level'] >= 21)$err = 'Максимальный Уровень';
if($cena > $uruby)$err = 'У вас не достаточно Рубинов';
if(!$err){
DB::Query("update `sahta` set `level`= '$level', `rand1` = '$rand1', `rand2` = '$rand2' where (`id_user` = '".$myID."')");
if($user['id']==$slehka){
DB::Query("INSERT INTO `ruby_log` SET `user` = '".$user['id']."', `time` = '".$time."', `mesto` = 'шахта левел', `ruby` = '-".$cena."'");
}
DB::Query("update `users` set `ruby` = `ruby`-$cena where (`id` = '".$myID."')");
$_SESSION['msg'] = '<font color="green">Уровень шахты повышен</font>';
go('?');
}else{
$_SESSION['msg'] = $err;
go('?');
}
}
echo"<div class ='bordered'>";
echo '<center>Уровень: '.$sahta['level'].''; echo ' Доход: от '.$sahta['rand1'].' до '.$sahta['rand2'].' Рубинов</center>';
echo '<center><img src="../../img/siti/mine/'.$sahta['level'].'.png?v2" width="200"></center>';
echo '<center>';
if ($stime > $time || $stime == 0){
if ($stime > $time){
echo "До сбора ".time_count($stime-$time,1,1,1,1)."</br>";
}elseif($sahta['otdih'] > $time){
echo 'Шахтер отдохнет через '.time_count($sahta['otdih']-$time,1,1,1,1).'</br>';
}else{
echo '<a class="btni" href="?go">Отправить Шахтера</a> ';
}
}else{
echo '<a class="btni" href="?goaway">Собрать Доход</a> ';
}
if($sahta['level'] < 21) echo '<a class="btni" href="?up">Поднять Уровень</a> ';
echo '</center>';
echo '</div>';
echo '<a class="btnl mt4" href="/games/">Меню</a>';
require_once H.'system/footer.php';