Файл: zfarm.mobi/inc/user/OpenChest.php
Строк: 694
<?
include_once '../system/config.php';
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
$q=mysql_query("SELECT * FROM `chest` WHERE `id_user` = '$ku[id]' AND `time` >='$time'");
while($post=mysql_fetch_array($q)){
if(isset($_GET['normal']) && intval($_GET['normal'])!=NULL && ($post['type']==2) && ($key['normal']>0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chest` WHERE `id_user` = '$ku[id]' AND `id` = '".intval($_GET['normal'])."'"),0)!=0)
{
$RandRuby=rand(0,100);
if($RandRuby==19 || $RandRuby==26 || $RandRuby==30 || $RandRuby==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+100)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '100', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 100';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+500)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '500', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 500';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+1000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '1000', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 1000';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+10)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '10', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 10';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp1='100000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp2='300000';
}
$RandRating3 = rand(9,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp3='500000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>2000, 2=>30000, 3=>50000, 4=>75000, 5=>100000, 6=>5000, 7=>10000, 8=>75000, 9=>25000, 10=>10000, 11=>1000000);
$rand = rand(1,11);
$money=$array[$rand];
{
$ku['money']=plus_money($money);
$d7='<br><img src="/img/icons/money.png"> '.$money.'';
}
}
if($ku['level']>=0)
{
$rating=500000+$exp1+$exp2+$exp3;
$rat=$rating;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat/2;
$rat=$rat_drakon_act+$rat_medal+$rat_school_act+$rat_lib_act+$rat;
$rating=$rat;
}
{
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `key_user` SET `normal` = '".($key['normal']-1)."' WHERE `id_user` = '$ku[id]'");
mysql_query("Delete From `chest` Where `id_user` = '".$ku['id']."' AND `id` = '".intval($_GET['normal'])."'");
header("Location: /warehouse");
$_SESSION['msg']='В обычном сундуке вы нашли : <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.' '.$d7.'';
}
}
}
?>
<?
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
$q=mysql_query("SELECT * FROM `chest` WHERE `id_user` = '$ku[id]' AND `time` >='$time'");
while($post=mysql_fetch_array($q)){
if(isset($_GET['bronze']) && intval($_GET['bronze'])!=NULL && ($post['type']==3) && ($key['bronze']>0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chest` WHERE `id_user` = '$ku[id]' AND `id` = '".intval($_GET['bronze'])."'"),0)!=0)
{
$RandRuby=rand(0,100);
if($RandRuby==19 || $RandRuby==26 || $RandRuby==30 || $RandRuby==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+200)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '200', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 200';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+1000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '1000', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 1000';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+2000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '2000', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 2000';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+20)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '20', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 20';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp4='200000';
}
$RandRating2 = rand(0,100);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp5='600000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp6='1000000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>4000, 2=>60000, 3=>100000, 4=>150000, 5=>200000, 6=>10000, 7=>20000, 8=>150000, 9=>50000, 10=>20000, 11=>2000000);
$rand = rand(1,11);
$money=$array[$rand];
{
$ku['money']=plus_money($money);
$d7='<br><img src="/img/icons/money.png"> '.$money.'';
}
}
if($ku['level']>=0)
{
$rating=500000+$exp4+$exp5+$exp6;
$rat=$rating;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat/2;
$rat=$rat_drakon_act+$rat_medal+$rat_school_act+$rat_lib_act+$rat;
$rating=$rat;
}
{
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `key_user` SET `bronze` = '".($key['bronze']-1)."' WHERE `id_user` = '$ku[id]'");
mysql_query("Delete From `chest` Where `id_user` = '".$ku['id']."' AND `id` = '".intval($_GET['bronze'])."'");
header("Location: /warehouse");
$_SESSION['msg']='В бронзовом сундуке вы нашли: <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.''.$d7.'';
}
}
}
?>
<?
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
$q=mysql_query("SELECT * FROM `chest` WHERE `id_user` = '$ku[id]' AND `time` >='$time'");
while($post=mysql_fetch_array($q)){
if(isset($_GET['silver']) && intval($_GET['silver'])!=NULL && ($post['type']==4) && ($key['silver']>0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chest` WHERE `id_user` = '$ku[id]' AND `id` = '".intval($_GET['silver'])."'"),0)!=0)
{
$RandRuby=rand(0,100);
if($RandRuby==19 || $RandRuby==26 || $RandRuby==30 || $RandRuby==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+300)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '300', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 300';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+1500)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '1500', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 1500';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+3000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '3000', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 3000';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+30)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '30', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 30';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp7='200000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp8='900000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp9='2000000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>8000, 2=>1200000, 3=>150000, 4=>21000, 5=>300000, 6=>15000, 7=>30000, 8=>21000, 9=>75000, 10=>30000, 11=>3000000);
$rand = rand(1,11);
$money=$array[$rand];
{
$ku['money']=plus_money($money);
$d7='<br><img src="/img/icons/money.png"> '.$money.'';
}
}
if($ku['level']>=0)
{
$rating=500000+$exp7+$exp8+$exp9;
$rat=$rating;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat/2;
$rat=$rat_drakon_act+$rat_medal+$rat_school_act+$rat_lib_act+$rat;
$rating=$rat;
}
{
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `key_user` SET `silver` = '".($key['silver']-1)."' WHERE `id_user` = '$ku[id]'");
mysql_query("Delete From `chest` Where `id_user` = '".$ku['id']."' AND `id` = '".intval($_GET['silver'])."'");
header("Location: /warehouse");
$_SESSION['msg']='В серебрянном сундуке вы нашли: <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.' '.$d7.'';
}
}
}
?>
<?
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
$q=mysql_query("SELECT * FROM `chest` WHERE `id_user` = '$ku[id]' AND `time` >='$time'");
while($post=mysql_fetch_array($q)){
if(isset($_GET['gold']) && intval($_GET['gold'])!=NULL && ($post['type']==5) && ($key['gold']>0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chest` WHERE `id_user` = '$ku[id]' AND `id` = '".intval($_GET['gold'])."'"),0)!=0)
{
$RandRuby=rand(0,100);
if($RandRuby==19 || $RandRuby==26 || $RandRuby==30 || $RandRuby==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+600)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '600', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 600';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+3000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '3000', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 3000';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+6000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '6000', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 6000';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+60)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '60', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 60';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp10='400000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp11='1800000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp12='4000000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>16000, 2=>120000, 3=>200000, 4=>25000, 5=>400000, 6=>25000, 7=>50000, 8=>25000, 9=>125000, 10=>50000, 11=>5000000);
$rand = rand(1,11);
$money=$array[$rand];
{
$ku['money']=plus_money($money);
$d7='<br><img src="/img/icons/money.png"> '.$money.'';
}
}
if($ku['level']>=0)
{
$rating=500000+$exp10+$exp11+$exp12;
$rat=$rating;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat/2;
$rat=$rat_drakon_act+$rat_medal+$rat_school_act+$rat_lib_act+$rat;
$rating=$rat;
}
{
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `key_user` SET `gold` = '".($key['gold']-1)."' WHERE `id_user` = '$ku[id]'");
mysql_query("Delete From `chest` Where `id_user` = '".($ku['id'])."' AND `id` = '".intval($_GET['gold'])."'");
header("Location: /warehouse");
$_SESSION['msg']='В золотом сундуке вы нашли: <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.''.$d7.'';
}
}
}
?>
<?
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
$q=mysql_query("SELECT * FROM `chest` WHERE `id_user` = '$ku[id]' AND `time` >='$time'");
while($post=mysql_fetch_array($q)){
if(isset($_GET['magic']) && intval($_GET['magic'])!=NULL && ($post['type']==6) && ($key['magic']>0) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chest` WHERE `id_user` = '$ku[id]' AND `id` = '".intval($_GET['magic'])."'"),0)!=0)
{
$RandRuby=rand(0,100);
if($RandRuby==19 || $RandRuby==26 || $RandRuby==30 || $RandRuby==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+1200)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '1200', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 1200';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+6000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '6000', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 6000';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+10000)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '10000', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 10000';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+120)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '120', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 120';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp13='800000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp14='3600000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp15='8000000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>12000, 2=>180000, 3=>300000, 4=>400000, 5=>600000, 6=>300000, 7=>60000, 8=>400000, 9=>150000, 10=>60000, 11=>6000000);
$rand = rand(1,11);
$money=$array[$rand];
{
$ku['money']=plus_money($money);
$d7='<br><img src="/img/icons/money.png"> '.$money.'';
}
}
if($ku['level']>=0)
{
$rating=500000+$exp13+$exp14+$exp15;
$rat=$rating;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat/2;
$rat=$rat_drakon_act+$rat_medal+$rat_school_act+$rat_lib_act+$rat;
$rating=$rat;
}
{
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("UPDATE `key_user` SET `magic` = '".($key['magic']-1)."' WHERE `id_user` = '$ku[id]'");
mysql_query("Delete From `chest` Where `id_user` = '".$ku['id']."' AND `id` = '".intval($_GET['magic'])."'");
header("Location: /warehouse");
$_SESSION['msg']='В проклятом сундуке вы нашли: <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.''.$d7.'';
}
}
}
?>
<?
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
$q=mysql_query("SELECT * FROM `chest` WHERE `id_user` = '$ku[id]' AND `time` >='$time'");
while($post=mysql_fetch_array($q)){
if(isset($_GET['open']) && intval($_GET['open'])!=NULL && ($post['type']==1) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chest` WHERE `id_user` = '$ku[id]' AND `id` = '".intval($_GET['open'])."'"),0)!=0)
{
$RandRuby=rand(0,100);
if($RandRuby==19 || $RandRuby==26 || $RandRuby==30 || $RandRuby==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+12)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '12', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 12';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+60)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '60', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 60';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+100)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '100', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 100';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+5)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '5', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 5';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp16='4000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp17='18000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp18='80000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>2000, 2=>3000, 3=>5000, 4=>75000, 5=>10000, 6=>5000, 7=>10000, 8=>75000, 9=>25000, 10=>10000, 11=>100000);
$rand = rand(1,11);
$money=$array[$rand];
{
$ku['money']=plus_money($money);
$d7='<br><img src="/img/icons/money.png"> '.$money.'';
}
}
if($ku['level']>=0)
{
$rating=500000+$exp16+$exp17+$exp18;
$rat=$rating;
$rat_drakon_act=0;
$rat_school_act=0;
$rat_lib_act=0;
if(isset($drakon_act))$rat_drakon_act=(($rat/100)*300);
if(isset($school_act))$rat_school_act=$rat*2;
if(isset($lib_act))$rat_lib_act=$rat/2;
$rat=$rat_drakon_act+$rat_medal+$rat_school_act+$rat_lib_act+$rat;
$rating=$rat;
}
{
mysql_query("UPDATE `kolhoz_user` SET `rating` = '".($ku['rating']+$rat)."' WHERE `id` = '$ku[id]'");
mysql_query("Delete From `chest` Where `id_user` = '".$ku['id']."' AND `id` = '".intval($_GET['open'])."'");
header("Location: /warehouse");
$_SESSION['msg']='В открытом сундуке вы нашли: <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.''.$d7.'';
}
}
}
?>