Файл: rayb.me/game.php
Строк: 271
<?php
require_once 'system/func.php';
$title = 'Rayb - Онлайн браузерная Игра';
require_once 'system/header.php';
auth();
$rooms = mysql_fetch_assoc(mysql_query("SELECT * FROM `room_users` WHERE `id_user` = '".$myID."' ORDER by id DESC"));
if($rooms['id_room'] != NULL){
$rooms_new = text($rooms['pay']*10);
$rooms_id = text($rooms['id_room']+1);
if($rooms['id_room'] == 2){
$room_sek = text($rooms['id_room']*2);
}else{
$room_sek = text($rooms['pay_money_sek']*2);
}
}else{
$rooms_new = 1;
$rooms_id = 1;
$room_sek = 1;
}
$acp = mysql_fetch_array(mysql_query("SELECT SUM(angels) FROM `users` WHERE `id_clan` = '".$user['id_clan']."'"));
if($user['id_clan'] >= 1 and $acp[0] >= 100){
$kol = text($acp[0]/100);
$p = text($kol*$user['x2']*$user['g_x2']);
}else{
if($user['angels'] < 100){
$p = text($user['x2']*$user['g_x2']);
}else{
$koll = text($user['angels']/100);
$p = text($koll*$user['x2']*$user['g_x2']);
}
}
if(isset($_GET['up_x10'])){
$up_x10 = text($_GET['up_x10']);
$room = mysql_fetch_assoc(mysql_query("SELECT * FROM `room_users` WHERE `id_user` = '".$uid."' AND `id_room` = '".$up_x10."'"));
$room_pay = text($room['pay_update']+($room['pay_update'] +($room['pay_update']*2)+($room['pay_update']*3)+($room['pay_update']*4)+($room['pay_update']*5)+($room['pay_update']*6)+($room['pay_update']*7)+($room['pay_update']*8)+($room['pay_update']*9)+($room['pay_update']*10))*10);
$up_cena = $room_pay;
$up_sek = text($room['pay_money_sek_up'] *100);
$up_level = 100;
$pay_up = text($room['pay'] * 100);
while($user['gold'] > $up_cena && $room['level'] < 1000000){
mysql_query("UPDATE `room_users` SET `level` = `level`+'".$up_level."',`money_sek`=`money_sek`+'".$up_sek."', `give_money_sek`=`give_money_sek`+'".$up_sek."', `pay_update` =`pay_update`+'".$pay_up."' WHERE `id_user` = '".$uid."' and `id_room` = '".$up_x10."'");
mysql_query("UPDATE `users` SET `gold` = `gold`-'".$up_cena."' WHERE `id` = '".$uid."'");
header ("Location: ".$_SERVER['HTTP_REFERER']);
exit;
}
}
if(isset($_GET['up_x100'])){
$up_x100 = text($_GET['up_x100']);
$room = mysql_fetch_assoc(mysql_query("SELECT * FROM `room_users` WHERE `id_user` = '".$uid."' AND `id_room` = '".$up_x100."'"));
$room_pay = text($room['pay_update']+($room['pay_update'] +($room['pay_update']*2)+($room['pay_update']*3)+($room['pay_update']*4)+($room['pay_update']*5)+($room['pay_update']*6)+($room['pay_update']*7)+($room['pay_update']*8)+($room['pay_update']*9)+($room['pay_update']*10))*100);
$up_cena = $room_pay;
$up_sek = text($room['pay_money_sek_up'] *1000);
$up_level = 1000;
$pay_up = text($room['pay'] * 1000);
while($user['gold'] > $up_cena && $room['level'] < 1000000){
mysql_query("UPDATE `room_users` SET `level` = `level`+'".$up_level."',`money_sek`=`money_sek`+'".$up_sek."', `give_money_sek`=`give_money_sek`+'".$up_sek."', `pay_update` =`pay_update`+'".$pay_up."' WHERE `id_user` = '".$uid."' and`id_room` = '".$up_x100."'");
mysql_query("UPDATE `users` SET `gold` = `gold`-'".$up_cena."' WHERE `id` = '".$uid."'");
header("Location: ".$_SERVER['HTTP_REFERER']);
exit;
}
}
if(isset($_GET['up_max'])){
$up_max = text($_GET['up_max']);
$room = mysql_fetch_assoc(mysql_query("SELECT * FROM `room_users` WHERE `id_user` = '".$uid."' AND `id_room` = '".$up_max."'"));
$room_pay = text($room['pay_update']+($room['pay_update'] +($room['pay_update']*2)+($room['pay_update']*3)+($room['pay_update']*4)+($room['pay_update']*5)+($room['pay_update']*6)+($room['pay_update']*7)+($room['pay_update']*8)+($room['pay_update']*9)+($room['pay_update']*10))*(10000-$room['level']));
$up_cena = $room_pay;
$up_sek = text($room['pay_money_sek_up'] *(1000000-$room['level']));
$up_level = text(1000000 - $room['level']);
$pay_up = text($room['pay'] * (1000000-$room['level']));
while($user['gold'] > $up_cena && $room['level'] < 1000000){
mysql_query("UPDATE `room_users` SET `level` = `level`+'".$up_level."',`money_sek`=`money_sek`+'".$up_sek."', `give_money_sek`=`give_money_sek`+'".$up_sek."', `pay_update` =`pay_update`+'".$pay_up."' WHERE `id_user` = '".$uid."' and`id_room` = '".$up_max."'");
mysql_query("UPDATE `users` SET `gold` = `gold`-'".$up_cena."' WHERE `id` = '".$uid."'");
header("Location: ".$_SERVER['HTTP_REFERER']);
exit;
}
}
if(isset($_GET['up_room'])){
$up_room = text($_GET['up_room']);
$room = mysql_fetch_assoc(mysql_query("SELECT * FROM `room_users` WHERE `id_user` = '".$uid."' AND `id_room` = '".$up_room."'"));
if($user['gold'] < $room['pay_update']){
$_SESSION['msg'] = "Не достаточно средств на балансе";
go('/');
}
mysql_query("UPDATE `room_users` SET `level` = `level`+'1', `money_sek`=`money_sek`+'".text($room['pay_money_sek_up'])."', `give_money_sek`=`give_money_sek`+'".text($room['pay_money_sek_up'])."', `pay_update` =`pay_update`+'".text($room['pay'])."' WHERE `id_user` = '".$uid."' AND `id_user` = '".$uid."' and `id_room` = '".$up_room."'");
mysql_query("UPDATE `users` SET `gold` = `gold`-'".$room['pay_update']."' WHERE `id` = '".$uid."'");
go('/');
}
if(isset($_GET['by_room'])){
$by_room = text($_GET['by_room']);
if($user['gold'] < $rooms_new){
$_SESSION['msg'] = "Произошла ошибка.Попробуйте позже";
go('/');
}
mysql_query("UPDATE `users` SET `gold` = `gold`-'".$rooms_new."' WHERE `id` = '".$uid."'");
mysql_query("INSERT INTO `room_users` SET `id_user` = '".$uid."', `item` = '".rand(1,175)."', `money_sek` = '".$room_sek."', `give_money_sek`='".text($room_sek*$p)."',`pay_money_sek_up` = '".$room_sek."', `pay` = '".$rooms_new."', `pay_update` = '".$rooms_new."' ,`id_room` = '".$rooms_id."',`pay_money_sek` = '".$room_sek."' ");
$_SESSION['msg'] = "Вы успешно купили новую комнату";
go('/');
}
echo' <div class="content"></div>';
$clan_memb = mysql_fetch_array(mysql_query("SELECT * FROM `clan_memb` WHERE `id_user` = '".$uid."' ORDER BY `id` DESC LIMIT 1"));
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clans` WHERE `id` = '".$clan_memb['id_clan']."' ORDER BY `id` DESC LIMIT 1"));
if($clan_memb){
if(isset($_GET['clan_memb_net'])){
mysql_query("DELETE FROM `clan_memb` WHERE `id` = '".$clan_memb['id']."'");
header ("Location: ".$_SERVER['HTTP_REFERER']);
exit();
}
if(isset($_GET['clan_memb_ok']) and $user['side'] == $clan['side']){
mysql_query("insert into `clan_histor` set `id_clan` = '".text($clan['id'])."', `data` = '".time()."', `text` = '<a href=/profile/".text($clan_memb['id_user2']).">".text($clan_memb['login'])."</a> Принял <a href=/profile/".$uid.">".$ulogin."</a>'");
mysql_query("UPDATE `users` SET `id_clan` = '".text($clan['id'])."', `clan_rang` = '1' WHERE `id` = '".$uid."'");
mysql_query("DELETE FROM `clan_memb` WHERE `id_user` = '".$uid."'");
header('Location: /corp/');
exit;
}
echo "<div class='feedback'><div class='minor mt4'>";
echo "Вас приглашают в корпорацию<br><span>".$clan['name']."</span><br>";
echo "<a href='?clan_memb_ok' class='btni'>Принять заявку</a><br><a href='?clan_memb_net'>Отменить</a>";
echo "</div></div>";
}
require_once ('bonus.php');
$news = mysql_fetch_array(mysql_query("SELECT * FROM `topic` WHERE `id_forum` = '1' ORDER BY `id` DESC LIMIT 1"));
if($news){
if(isset($_GET['header_news'])){
mysql_query("update `users` set `news_read` = '0' where `id` = '".$uid."'");
header("Location: /forum/sub/".$news['id']."?page=end");
exit;
}
if($user['news_read'] == 1 && $news['time'] > time()-86400){
echo "<div class='bordered'><center>";
echo "<div class='admin'>".$news['name']."</div>";
echo'<a class="btni" href="?header_news" style="margin-top: 3px; width: 140px;"> Перейти к новости</a><br/>';
echo "<a href='?news_read' class='grey'>Скрыть</a>";
echo "</div><div class='content'></div></center>";
}
}
$sahta= mysqli_fetch_assoc(DB::Query("SELECT * FROM `sahta` WHERE `id_user`= '".$uid."' LIMIT 1"));
echo '<center>';
echo '<a class="myButton" href="/games/" >Меню <font color="gren">';
if($sahta['time'] > time() || $sahta['time'] == 0){
if($sahta['time'] > time()){
if($user['time_id']<=time()){
echo ' +';
}
}elseif($sahta['otdih'] > time()){
}else{
echo ' +';
}
}else{
echo ' +';
}
/*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> ';
}*/
echo '</font></a></center><br/>';
if(!isset($_COOKIE['auto'])){
echo '<center>';
if($user['gold'] >= $rooms_new){
echo' <a class="myButton" href="/game/?by_room">Новый бизнес <img src="/img/money_36.png" alt="$" width="16" height="16"/>'.n_f($rooms_new).'</a><br/>';
}else{
echo' <span class="btni">Новый бизнес <img src="/img/money_36.png" alt="$" width="16" height="16"/>'.n_f($rooms_new).'</span>';
}
echo '</center><br/>';
}else{
if($user['gold'] >= $rooms_new){
echo'<br/><center><a class="myButton" href="/game/?by_room" >Новый бизнес <img src="/img/money_36.png" alt="$" width="16" height="16"/>'.n_f($rooms_new).'</a><a class="myButton" href="/games/" >Меню</a></center><br/>';
}else{
echo'<br/><center><span class="btni">Новый бизнес <img src="/img/money_36.png" alt="$" width="16" height="16"/>'.n_f($rooms_new).'</span><a class="myButton" href="/games/" >Меню</a></center><br/>';
}
}
$set['p_str'] = 10;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `room_users` WHERE `id_user` = '".$myID."'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `room_users` WHERE `id_user` = '".$myID."' ORDER BY `id` DESC LIMIT ".$start.", ".$set['p_str']."");
if ($k_post <= 0){
echo'<div class="feedback"><div class="minor mt4">У вас нет Бизнеса. Нажмите Новый бизнес, чтобы начать зарабатывать.</div></div>';
}
while($post = mysql_fetch_assoc($q)) {
$room_pay10="";
$rooms = mysql_fetch_assoc(mysql_query("SELECT * FROM `room_users` WHERE `id_room` = '".$post['id_room']."' ORDER by id_room DESC LIMIT 1 "));
$x10_up_cena = text($room_pay10);
$room_pay10 = text($post['pay_update']+($post['pay_update']+($post['pay_update']*2)+($post['pay_update']*3)+($post['pay_update']*4)+($post['pay_update']*5)+($post['pay_update']*6)+($post['pay_update']*7)+($post['pay_update']*8)+($post['pay_update']*9)+($post['pay_update']*10))*10);
$room_pay100 = text($post['pay_update']+($post['pay_update']+($post['pay_update']*2)+($post['pay_update']*3)+($post['pay_update']*4)+($post['pay_update']*5)+($post['pay_update']*6)+($post['pay_update']*7)+($post['pay_update']*8)+($post['pay_update']*9)+($post['pay_update']*10))*100);
$room_pay_max = text($post['pay_update']+($post['pay_update']+($post['pay_update']*2)+($post['pay_update']*3)+($post['pay_update']*4)+($post['pay_update']*5)+($post['pay_update']*6)+($post['pay_update']*7)+($post['pay_update']*8)+($post['pay_update']*9)+($post['pay_update']*10))*(10000-$post['level']));
if($user['gold'] > $post['pay_update'] && $post['level'] < 1000000){
echo'
<div style="margin: 0 0 0 0; position: relative;">
<div style="display: inline;" class="fl">
<div class="left small_mode_1" style="padding:0 0 0 0;margin: 0 0 0 0;"><span class="count_room ">'.$post['id_room'].'</span><img src="/img/rooms/'.$post['item'].'.png" width="31px"> </div>
<div class="left small_mode_1" style="margin: 0 0 0 0;"><a href="/game/?up_room='.$post['id_room'].'" class="btni small_mode_1" style="width:75px;" ><img src="/img/money_36.png" alt="$" width="16" height="16"/><span>'.n_f($post['pay_update']).'</span></a>';
if($user['gold'] > $room_pay10 && $post['level'] < 1000000){
echo '<a href="/game/?up_x10='.$post['id_room'].'" style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">x100</a>';
}else{
echo '<span style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">x100</span>';
}
if($user['gold'] > $room_pay100 && $post['level'] < 1000000){
echo '<a href="/game/?up_x100='.$post['id_room'].'" style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">
x1k</a>';
}else{
echo '<span style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">x1k</span>';
}
if($user['gold'] > $room_pay_max && $post['level'] < 1000000){
echo '<a href="/game/?up_max='.$post['id_room'].'" style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">
max</a>';
}else{
echo '<span style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">max</span>';
}
echo ' </div> </div>';
echo '<span class="small tbrown" style="float: right;">
<img src="/img/money_36.png" alt="$" width="13" height="13"/>
<span><small>'.n_f($post['money_sek']).' в сек</small></span><span class="center biss_right">'.n_f($post['level']).'</span>
</span> <div class="cb"></div> </div>';
}else{
echo'
<div style="margin: 0 0 0 0; position: relative;">
<div style="display: inline;" class="fl">
<div class="left small_mode_1" style="padding:0 0 0 0;margin: 0 0 0 0;"><span class="count_room ">'.$post['id_room'].'</span>
<img src="/img/rooms/'.$post['item'].'.png" width="31px"></td></div>
<div class="left small_mode_1" style="margin: 0 0 0 0;"><span class="btni small_mode_1" style="width:75px;" ><img src="/img/money_36.png" alt="$" width="16" height="16"/> <span>'.n_f($post['pay_update']).'</span></span><span style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">x100</span><span style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">x1k</span><span style="padding-left: 4px;padding-right: 4px;" class="btni small_mode_1">max</span>
</div> </div>
<span class="small tbrown" style="float: right;"> <img src="/img/money_36.png" alt="$" width="13" height="13"/><span><small>'.n_f($post['money_sek']).' в сек</small></span><span class="center biss_right">'.n_f($post['level']).'</span> </span> <div class="cb"></div> </div>';
}
}
if($k_post > 10) str('?',$k_page,$page);
require_once ('system/footer.php');