<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  vsem@pizdec.ru             #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#	
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";

$text = @file("../local/profil/$log.prof"); 
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$privat=trim($udata[10]);}

$sum=0;

echo '<img src="../images/img/partners.gif" alt=""> <b><font color="#FFFF00">Бандит</font></b><br><br>';

if (!$_SESSION['log']=="" && !md5($_SESSION['par'])=="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {
if($udata[10]>0){
echo'<img src="../images/img/mail.gif" alt=""> <b><a href="../pages/privat.php?'.SID.'"><font color="red">Приватное сообщение! ('.$privat.')</font></a></b><br>';}


if(!isset($action)){  

echo 'Любишь азарт? А выигрывая, чувствуешь адреналин? Играй и получай призы<br><br>';
 
echo'- <img src="../images/bandit/1.gif" alt=""> <img src="../images/bandit/2.gif" alt=""> <img src="../images/bandit/3.gif" alt=""> -<br>';  
echo'- <img src="../images/bandit/7.gif" alt=""> <img src="../images/bandit/7.gif" alt=""> <img src="../images/bandit/7.gif" alt=""> -<br>';  
echo'- <img src="../images/bandit/4.gif" alt=""> <img src="../images/bandit/5.gif" alt=""> <img src="../images/bandit/6.gif" alt=""> -<br>';  

echo'<br><b><a href="bandit.php?action=go&amp;'.SID.'">Играть</a></b><br>';    
    
} //if($action=="index")

if($action=="go"){ 
if($udata[41]>0){
$num1 = mt_rand(1, 8);
$num2 = mt_rand(1, 8);
$num3 = mt_rand(1, 8);
$num4 = mt_rand(1, 8);
///////уменьшаем шанс выпадения 7 в центре
$num_a= mt_rand(1, 6);
$num_b= mt_rand(1, 8);
$num_d = array($num_a, $num_b);
$num_e = mt_rand(0, 1); 
$num5 = $num_d[$num_e];
///////
$num6 = mt_rand(1, 8);
$num7 = mt_rand(1, 8);
$num8 = mt_rand(1, 8);
$num9 = mt_rand(1, 8);

$rand = mt_rand(100, 999);

echo'- <img src="../images/bandit/'.$num1.'.gif" alt=""> <img src="../images/bandit/'.$num2.'.gif" alt=""> <img src="../images/bandit/'.$num3.'.gif" alt=""> -<br>';
echo'- <img src="../images/bandit/'.$num4.'.gif" alt=""> <img src="../images/bandit/'.$num5.'.gif" alt=""> <img src="../images/bandit/'.$num6.'.gif" alt=""> -<br>'; 
echo'- <img src="../images/bandit/'.$num7.'.gif" alt=""> <img src="../images/bandit/'.$num8.'.gif" alt=""> <img src="../images/bandit/'.$num9.'.gif" alt=""> -<br>'; 

/////////////////////////////////линии//////////////////////////////
if ($num1 == 1 and $num2 == $num1 and $num3 == $num1) {echo'Вишенки-вехний ряд<br>'; $sum+="5";}
if ($num4 == 1 and $num5 == $num4 and $num6 == $num4) {echo'Вишенки-средний ряд<br>'; $sum+="10";}
if ($num7 == 1 and $num8 == $num7 and $num9 == $num7) {echo'Вишенки-нижний ряд<br>';  $sum+="5";}

if ($num1 == 2 and $num2 == $num1 and $num3 == $num1) {echo'Апельсины-вехний ряд<br>'; $sum+="10";}
if ($num4 == 2 and $num5 == $num4 and $num6 == $num4) {echo'Апельсины-средний ряд<br>'; $sum+="15";}
if ($num7 == 2 and $num8 == $num7 and $num9 == $num7) {echo'Апельсины-нижний ряд<br>'; $sum+="10";}

if ($num1 == 3 and $num2 == $num1 and $num3 == $num1) {echo'Виноград-вехний ряд<br>'; $sum+="15";}
if ($num4 == 3 and $num5 == $num4 and $num6 == $num4) {echo'Виноград-средний ряд<br>'; $sum+="25";}
if ($num7 == 3 and $num8 == $num7 and $num9 == $num7) {echo'Виноград-нижний ряд<br>'; $sum+="15";}

if ($num1 == 4 and $num2 == $num1 and $num3 == $num1) {echo'Бананы-вехний ряд<br>'; $sum+="25";}
if ($num4 == 4 and $num5 == $num4 and $num6 == $num4) {echo'Бананы-средний ряд<br>'; $sum+="35";}
if ($num7 == 4 and $num8 == $num7 and $num9 == $num7) {echo'Бананы-нижний ряд<br>'; $sum+="25";}

if ($num1 == 5 and $num2 == $num1 and $num3 == $num1) {echo'Яблоки-вехний ряд<br>'; $sum+="30";}
if ($num4 == 5 and $num5 == $num4 and $num6 == $num4) {echo'Яблоки-средний ряд<br>'; $sum+="50";}
if ($num7 == 5 and $num8 == $num7 and $num9 == $num7) {echo'Яблоки-нижний ряд<br>'; $sum+="30";}

if ($num1 == 6 and $num2 == $num1 and $num3 == $num1) {echo'BAR-вехний ряд<br>'; $sum+="50";}
if ($num4 == 6 and $num5 == $num4 and $num6 == $num4) {echo'BAR-средний ряд<br>'; $sum+="70";}
if ($num7 == 6 and $num8 == $num7 and $num9 == $num7) {echo'BAR-нижний ряд<br>'; $sum+="55";}

if ($num1 == 7 and $num2 == $num1 and $num3 == $num1) {echo'777-вехний ряд<br>'; $sum+="177";}
if ($num4 == 7 and $num5 == $num4 and $num6 == $num4) {echo'777-средний ряд<br>'; $sum+="777";}
if ($num7 == 7 and $num8 == $num7 and $num9 == $num7) {echo'777-нижний ряд<br>'; $sum+="177";}

if ($num1 == 8 and $num2 == $num1 and $num3 == $num1) {echo'$$$-вехний ряд<br>'; $sum+="60";}
if ($num4 == 8 and $num5 == $num4 and $num6 == $num4) {echo'$$$-средний ряд<br>'; $sum+="100";}
if ($num7 == 8 and $num8 == $num7 and $num9 == $num7) {echo'$$$-нижний ряд<br>'; $sum+="60";}

/////////////////////////////////столбцы//////////////////////////////


if ($num1 == 1 and $num4 == $num1 and $num7 == $num1) {echo'Вишенки-левый столбец<br>';  $sum+="5";}
if ($num2 == 1 and $num5 == $num2 and $num8 == $num2) {echo'Вишенки-средний столбец<br>';  $sum+="10";}
if ($num3 == 1 and $num6 == $num3 and $num9 == $num3) {echo'Вишенки-правый столбец<br>';  $sum+="5";}

if ($num1 == 2 and $num4 == $num1 and $num7 == $num1) {echo'Апельсины-левый столбец<br>'; $sum+="10";}
if ($num2 == 2 and $num5 == $num2 and $num8 == $num2) {echo'Апельсины-средний столбец<br>'; $sum+="15";}
if ($num3 == 2 and $num6 == $num3 and $num9 == $num3) {echo'Апельсины-правый столбец<br>'; $sum+="10";}

if ($num1 == 3 and $num4 == $num1 and $num7 == $num1) {echo'Виноград-левый столбец<br>'; $sum+="15";}
if ($num2 == 3 and $num5 == $num2 and $num8 == $num2) {echo'Виноград-средний столбец<br>'; $sum+="25";}
if ($num3 == 3 and $num6 == $num3 and $num9 == $num3) {echo'Виноград-правый столбец<br>'; $sum+="15";}

if ($num1 == 4 and $num4 == $num1 and $num7 == $num1) {echo'Бананы-левый столбец<br>'; $sum+="25";}
if ($num2 == 4 and $num5 == $num2 and $num8 == $num2) {echo'Бананы-средний столбец<br>'; $sum+="40";}
if ($num3 == 4 and $num6 == $num3 and $num9 == $num3) {echo'Бананы-правый столбец<br>'; $sum+="25";}

if ($num1 == 5 and $num4 == $num1 and $num7 == $num1) {echo'Яблоки-левый столбец<br>'; $sum+="40";}
if ($num2 == 5 and $num5 == $num2 and $num8 == $num2) {echo'Яблоки-средний столбец<br>'; $sum+="75";}
if ($num3 == 5 and $num6 == $num3 and $num9 == $num3) {echo'Яблоки-правый столбец<br>'; $sum+="40";}

if ($num1 == 6 and $num4 == $num1 and $num7 == $num1) {echo'BAR-левый столбец<br>'; $sum+="75";}
if ($num2 == 6 and $num5 == $num2 and $num8 == $num2) {echo'BAR-средний столбец<br>'; $sum+="100";}
if ($num3 == 6 and $num6 == $num3 and $num9 == $num3) {echo'BAR-правый столбец<br>'; $sum+="75";}

if ($num1 == 7 and $num4 == $num1 and $num7 == $num1) {echo'777-левый столбец<br>'; $sum+="100";}
if ($num2 == 7 and $num5 == $num2 and $num8 == $num2) {echo'777-средний столбец<br>'; $sum+="150";}
if ($num3 == 7 and $num6 == $num3 and $num9 == $num3) {echo'777-правый столбец<br>'; $sum+="100";}

if ($num1 == 8 and $num4 == $num1 and $num7 == $num1) {echo'$$$-левый столбец<br>'; $sum+="150";}
if ($num2 == 8 and $num5 == $num2 and $num8 == $num2) {echo'$$$-средний столбец<br>'; $sum+="200";}
if ($num3 == 8 and $num6 == $num3 and $num9 == $num3) {echo'$$$-правый столбец<br>'; $sum+="150";}

///////////////////// по диагонали /////////////////////////////////////////

if ($num1 == 1 and $num5 == $num1 and $num9 == $num1) {echo'Вишенки-по диагонали<br>';  $sum+="5";}
if ($num3 == 1 and $num5 == $num3 and $num7 == $num3) {echo'Вишенки-по диагонали<br>';  $sum+="5";}

if ($num1 == 2 and $num5 == $num1 and $num9 == $num1) {echo'Апельсины-по диагонали<br>';  $sum+="10";}
if ($num3 == 2 and $num5 == $num3 and $num7 == $num3) {echo'Апельсины-по диагонали<br>';  $sum+="10";}

if ($num1 == 3 and $num5 == $num1 and $num9 == $num1) {echo'Виноград-по диагонали<br>';  $sum+="15";}
if ($num3 == 3 and $num5 == $num3 and $num7 == $num3) {echo'Виноград-по диагонали<br>';  $sum+="15";}

if ($num1 == 4 and $num5 == $num1 and $num9 == $num1) {echo'Бананы-по диагонали<br>';  $sum+="25";}
if ($num3 == 4 and $num5 == $num3 and $num7 == $num3) {echo'Бананы-по диагонали<br>';  $sum+="25";}

if ($num1 == 5 and $num5 == $num1 and $num9 == $num1) {echo'Яблоки-по диагонали<br>';  $sum+="50";}
if ($num3 == 5 and $num5 == $num3 and $num7 == $num3) {echo'Яблоки-по диагонали<br>';  $sum+="50";} 

if ($num1 == 6 and $num5 == $num1 and $num9 == $num1) {echo'BAR-по диагонали<br>';  $sum+="100";}
if ($num3 == 6 and $num5 == $num3 and $num7 == $num3) {echo'BAR-по диагонали<br>';  $sum+="100";}

if ($num1 == 7 and $num5 == $num1 and $num9 == $num1) {echo'777-по диагонали<br>';  $sum+="150";}
if ($num3 == 7 and $num5 == $num3 and $num7 == $num3) {echo'777-по диагонали<br>';  $sum+="150";}

if ($num1 == 8 and $num5 == $num1 and $num9 == $num1) {echo'$$$-по диагонали<br>';  $sum+="333";}
if ($num3 == 8 and $num5 == $num3 and $num7 == $num3) {echo'$$$-по диагонали<br>';  $sum+="333";}


//------------------------------ Запись в профиль ----------------------------//
$ufile = file(BASEDIR."local/profil/$log.prof"); 
$udata = explode(":||:",$ufile[0]);

$udata[41]--;

for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}

if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen("../local/profil/$log.prof","a+");    
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);  
unset($utext);
}

if(!empty($sum)){echo'Ваш выигрыш составил: <b>'.(int)$sum.'</b><br>';

//------------------------------ Запись в профиль ----------------------------//
$ufiles = file(BASEDIR."local/profil/$log.prof"); 
$udatas = explode(":||:",$ufiles[0]);

$udatas[41]=$udata[41]+$sum;

for ($us=0; $us<$config_userprofkey; $us++){
$utexts.=$udatas[$us].':||:';}

if($udatas[0]!="" && $udatas[1]!="" && $udatas[4]!="" && $utexts!=""){
$fp=fopen("../local/profil/$log.prof","a+");    
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                
fputs($fp,$utexts);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp); 
unset($utexts); 
}
}
echo'<br><b><a href="bandit.php?action=go&amp;rand='.$rand.'&amp;'.SID.'">Играть</a></b><br>';
}else{echo'Вы не можете играть т.к. на вашем счете недостаточно средств<br>';}

sleep(1); //задержка 1 сек
}

echo'У вас в наличии '.(int)$udata[41].' монет<br>';
}else{echo'<br>Для того чтобы играть вы должны быть авторизованы<br>';}
echo'<hr><a href="bandit_faq.php?'.SID.'">Правила игры</a>';
echo'<br><a href="../index.php?'.SID.'">На главную</a>'; 
include_once"../themes/$config_themes/foot.php";
?>