Файл: public_html/light_grab.php
Строк: 186
<?
define('PROTECTOR', 1);
defined('index') or die('Error: restricted access');
$head = 'grab';//фикс. места
$textl='Грабежи';
@include_once('files/db.php');
@include_once('files/auth.php');
@include_once('include.php');
@include_once('files/vip.php');
@include_once('files/online.php');
@include_once('files/sql.php');
@include_once('files/lvl.php');
@include_once('files/func.php');
@include_once('files/regeneration.php');
if($_SESSION['msg']) $sess = 1;
$close_mysql = @mysql_fetch_assoc( @mysql_query_new("SELECT `$head` FROM `close` LIMIT 1"));
if($close_mysql["$head"]==1){
    @include_once('files/head.php');
    @include_once('files/zag.php');
    location_exit("$textl");
    @include_once('files/down.php'); 
    exit;
}
if($udata['lvl']<4){
    $_SESSION['msg']="$imbal$c_cen Для грабежей, Вы не достигли 4 ур. </center></div>";
    @header ("Location: /index.php?r=index"); exit;
}
switch($_GET['mod']){
default:
if(isset($_GET['random'])){
    $_MYSQL_GRAB = " SELECT `id`,`lvl` FROM `users` WHERE `lvl`<'".($udata['lvl']+10)."' and `lvl`>'".($udata['lvl']-15)."'and `sb`>='".($time-(3600*24*rand(3,30)))."' ";
    $avto_grab = @mysql_num_rows( @mysql_query_new("$_MYSQL_GRAB"));
    $grab_rand_mysql = @mysql_fetch_array( @mysql_query_new("$_MYSQL_GRAB ORDER BY `id` DESC LIMIT ".rand(2,($avto_grab-1)).",1"));
if(empty($grab_rand_mysql['id'])){
    $_SESSION['msg']="$baloon<center> Нет кого грабить! <br> Приходи чутка попозже! </center></div>";
    @header("Location: /index.php?$_get_r"); exit;}
else{
    @header("Location: /index.php?r=index&user=$grab_rand_mysql[id]&$avto_grab$_get_n"); exit; }
}
@include_once('files/head.php');
@include_once('files/zag.php');
//----------- Обучение грабежей -----------\
if($_GET['msg']==1){ $_SESSION['msg_grab']=null; }
if(!empty($_SESSION['msg_grab']) and empty($sess)){
    $msg = abs($_GET['msg']);
    echo $_SESSION['msg_grab'][$msg]; }
//------------------------------------------\
    if ($_GET['page']<=1) {$_GET['page']=1;}
    $num = obnul(($_GET['page']-1) * 10);
    $a=0;
    if ($_GET['act']!='full')
    {$min_grab=5;}else
    {$min_grab=10;}
@mysql_query_new("UPDATE `grab` SET `status` = '0' WHERE `usr_lox`='$udata[id]'");
$guards_you = @mysql_fetch_array( @mysql_query_new(" SELECT * FROM `guards_usr` WHERE `usr`='$udata[id]' and `toch`>'0' or `usr`='$udata[id]' and `time`>'$time'"));
$avto = @mysql_num_rows( @mysql_query_new("SELECT * FROM `grab` WHERE `usr_lox` = '$udata[id]' or `usr`= '$udata[id]' ORDER BY `id` DESC"));
$result_grab = @mysql_query_new("SELECT * FROM `grab` WHERE `usr_lox` = '$udata[id]' or `usr`= '$udata[id]' ORDER BY `id` DESC LIMIT $num,$min_grab");
    
    
echo"<h1 class='center'> Грабежи </h1>
$balka
$inner
<center> Грабани случайного терпилу, заведи себе охрану и отомсти напавшим!
    ".($_GET['n']=='grabToch' && $udata['lvl']<12 ? "
        <div style='position: relative; top: ".($_default ? '37px' : '30px')."; right: ".($_default ? '-5px' : '60px')."'>
        <span class='tutorial-arrow rightArrow'></span>
        </div>
        " : null)."
<a href='/index.php?$_get_r&random$_get_n' $bt_gr> Грабануть случайного терпилу</a>
</center>
</div>
$div";
if(!empty($guards_you['id'])){
    $result_quards = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `guards_id` WHERE `id`='$guards_you[guards_id]'"));
    
    if(strrev($guards_you['toch'])[0]==0){$_attack='атак';}
    elseif(strrev($guards_you['toch'])[0]==1){$_attack='атаку';}
    elseif(strrev($guards_you['toch'])[0]<=4 and strrev($guards_you['toch'])[1]==1){$_attack='атак';}
    elseif(strrev($guards_you['toch'])[0]<=4){$_attack='атаки';}
    else{$_attack='атак';}
    
    if($guards_you['toch']>0){
        $text_grab_good="Отобьет еще <b>$guards_you[toch]</b> $_attack";
    }
    echo"
    <b> За твоими точками зорко следит:</b>
    <table width='100%' border='0' cellpadding='0' cellspacing='4'>
    <tr valign='top'>
      <td width='59'>
      <img src='/theme/i/icons/guards/$result_quards[img].png' class='img-border' width='60'>
      </td>
      
      <td>
       <b> $result_quards[name]</b>
       <br> <font color='gray'>$result_quards[lol_text]</font>
      </td>
    </tr>
    </table>
    $text_grab_good
    <a href='/index.php?$_get_r&mod=guards' $bt_s> Нанять другого охранника</a></div>";
} else {
    echo"n<a href='/index.php?$_get_r&mod=guards' $bt_s> Нанять охрану</a></div>";
}
if($avto==0){
    echo"$balka
    $inner <center><i>
    Ну чего стоишь?? Ограбь хоть пару точек!
    </i><center> </div>";
} elseif($avto>=1) {
    echo"$balka
    $inner    <center><h4> Хочешь отомстить???</h4> 
    Нажми на кликуху обидчика, ограбь его сам!
    </center>
    <div style='padding:4px'></div>
    </div>";
    while($grab = @mysql_fetch_assoc($result_grab)){
        $a++;
        if($grab['usr_lox']==$udata['id'])
        { $url_grab = "<b><a href='/index.php?r=index&user=$grab[usr]'>".us("usr{".$grab['usr']."}")."</a></b>";}else
        { $url_grab = "<b><a href='/index.php?r=index&user=$grab[usr_lox]'>".us("usr{".$grab['usr_lox']."}")."</a></b>";}
        echo"
        <div class='new_inner ".($a%2 ? 'e1' : 'e2')."'>
          ";
        if($grab['usr_lox']==$udata['id'] and $grab['lose']==1){
            echo"$url_grab не смог Вас ограбить";}
        elseif($grab['usr_lox']==$udata['id'] and $grab['lose']==0){
            echo"$url_grab украл $imgbox $grab[kolvo]";}
        elseif($grab['usr']==$udata['id'] and $grab['lose']==1){
            echo"Ты несмог ограбить $url_grab";}
        elseif($grab['usr']==$udata['id'] and $grab['lose']==0){
            echo"Ты украл у $url_grab $imgbox $grab[kolvo]";}
        echo"
          <div class='rightw'>".sekund($time-$grab['time'])."</div>
        </div>
        ";
    }
    if($avto>5 and $_GET['act']!='full') {
        echo"
        $inner
        <a href='/index.php?$_get_r&act=full' $bt_s> Показать грабежи полностью</a>
        </div>$balka";
    } elseif($avto>10) {
        echo"$balka";
        pager(10, $avto, "/index.php?$_get_r$_get_act");
    }
}
echo"n$javaback";
break;
case'guards':
if($_GET['buy']){
    $guards_mysql = @mysql_fetch_array( @mysql_query_new("SELECT * FROM `guards_id` WHERE `id`='$_GET[buy]'"));
    $Stoim_Tip = $guards_mysql['stoim_tip'];
    if($guards_mysql['stoim_tip']=='almaz')
    {$img_stoim="$imgdoc"; $img_bd="{doc}";}else
    {$img_stoim="$imglave"; $img_bd="{lave}";}
}
if(!empty($guards_mysql['id']) and !empty($_POST['buy']) and $udata["$Stoim_Tip"]<$guards_mysql['stoim']){
    if($guards_mysql['stoim_tip']=='money')
    { $_SESSION['msg']=$_MALO_LAVE; }else
    { $_SESSION['msg']=$_MALO_DOC; }
    @header("Location: /index.php?$_get_r$_get_mod"); exit; }
elseif(!empty($guards_mysql['id']) and !empty($_POST['buy'])){
    if($guards_mysql['kolvo_tip']=='crop')
    {$tip_grab_new='toch'; $tip_grab_new_kolvo=$guards_mysql['kolvo'];}else
    {$tip_grab_new='time'; $tip_grab_new_kolvo=($guards_mysql['kolvo']+$time);}
    $_log_text = "Нанял охранника «$guards_mysql[name]» за $img_bd$guards_mysql[stoim].";
    if($img_bd=="{doc}"){
        @mysql_query_new("INSERT INTO `logs` SET `usr`='$udata[id]',`mesto`='Рубины', `time` = '$time', `text`='$_log_text'"); }
    @mysql_query_new("INSERT INTO `logs` SET `usr`='$udata[id]', `text`='$_log_text', `mesto`='Грабежи', `time` = '$time'");
    @mysql_query_new("DELETE FROM `guards_usr` WHERE `usr`='$udata[id]'");
    @mysql_query_new("INSERT INTO `guards_usr` SET `usr`='$udata[id]', `$tip_grab_new`='$tip_grab_new_kolvo',`guards_id`='$guards_mysql[id]'");
    @mysql_query_new("UPDATE `users` SET `$Stoim_Tip`=`$Stoim_Tip`-'$guards_mysql[stoim]' WHERE `id` = '$udata[id]' ");
    
    $_SESSION['msg']="$baloon<center> Вы удачно наняли охрану «<b>$guards_mysql[name]</b>». </center></div>";
    @header("Location: /index.php?$_get_r$_get_mod"); exit; }
elseif(!empty($guards_mysql['id'])){
    @include_once('files/head.php');
    @include_once('files/zag.php');
    echo"$imbal
    Уверенны что хотите нанять охрану «<b>$guards_mysql[name]</b>», за $img_stoim$guards_mysql[stoim] ??<br>
    <form method='post'>
    <input class='margin0 bttn' type='submit' name='buy' value='Базарю!'>
    <a href='?$_get_r$_get_mod' $bt_r> Отказываюсь!</a>
    </form>
    </div>";
}
    @include_once('files/head.php');
    @include_once('files/zag.php');
$req = @mysql_query_new("SELECT * FROM `guards_id`");
while($guards_mysql = @mysql_fetch_assoc($req)){
    if($guards_mysql['stoim_tip']=='almaz')
    {$img_grab_stoim=$imgdoc;}else
    {$img_grab_stoim=$imglave;}
    
echo"
$div
<table width='100%' border='0' cellpadding='0' cellspacing='4'>
<tr valign='top'>
  <td width='59'>
  <img src='/theme/i/icons/guards/$guards_mysql[img].png' class='img-border' width='60'>
  </td>
  
  <td><b>$guards_mysql[name]</b>
  <br> $guards_mysql[text]
  </td>
</tr>
</table>
<a href='/index.php?$_get_r$_get_mod&buy=$guards_mysql[id]' $bt_gr> Нанять за $img_grab_stoim $guards_mysql[stoim]</a>
</div>";}
echo"
$balka
<a href='/index.php?$_get_r' class='margin0 bttn_sea'>В грабежи</a>";
break;
}
@include_once('./files/down.php');
?>