Файл: inc/user/OpenChest.php
Строк: 700
<?
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']+5)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '5', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 5';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
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'");
$d1='<br><img src="/img/icons/ruby.png"> 10';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+25)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '25', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 25';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+1)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '1', `kuda` = 'Выигрыш в обычном сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 1';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp1='10000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp2='30000';
}
$RandRating3 = rand(9,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp3='50000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>200, 2=>3000, 3=>5000, 4=>7500, 5=>10000, 6=>500, 7=>1000, 8=>7500, 9=>2500, 10=>1000, 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=50000+$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/chest?open_ok");
$_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']+8)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '8', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 8';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+16)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '16', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 16';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+32)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '32', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 32';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+2)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '2', `kuda` = 'Выигрыш в бронзовом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 2';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp4='20000';
}
$RandRating2 = rand(0,100);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp5='60000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp6='100000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>400, 2=>6000, 3=>10000, 4=>15000, 5=>20000, 6=>1000, 7=>2000, 8=>10000, 9=>5000, 10=>2000, 11=>200000);
$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=50000+$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/chest?open_ok");
$_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']+10)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '10', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 10';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+18)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '18', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 18';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+38)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '38', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 38';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+3)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '3', `kuda` = 'Выигрыш в серебрянном сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 3';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp7='20000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp8='90000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp9='200000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>800, 2=>120000, 3=>15000, 4=>2000, 5=>3000, 6=>1500, 7=>3000, 8=>2100, 9=>7500, 10=>3000, 11=>300000);
$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=50000+$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/chest?open_ok");
$_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']+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']+20)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '20', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 20';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+50)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '50', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 50';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+4)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '4', `kuda` = 'Выигрыш в золотом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 4';
}
$RandRating1 = rand(0,50);
if($RandRating1==9 || $RandRating1==6 || $RandRating1==3 || $RandRating1==1) ///
{
$exp10='40000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp11='180000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp12='400000';
}
$RandMoney = rand(0,50);
if($RandMoney==19 || $RandMoney==6 || $RandMoney==30 || $RandMoney==45) ///
{
$array = array(1=>1600, 2=>12000, 3=>20000, 4=>2500, 5=>40000, 6=>2500, 7=>5000, 8=>2500, 9=>12000, 10=>5000, 11=>500000);
$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=50000+$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/chest?open_ok");
$_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']+15)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '15', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 15';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+25)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '25', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d1='<br><img src="/img/icons/ruby.png"> 25';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+75)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '75', `kuda` = 'Выигрыш в проклятом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 75';
}
$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) ///
{
$exp13='80000';
}
$RandRating2 = rand(0,50);
if($RandRating2==19 || $RandRating2==26 || $RandRating2==30 || $RandRating2==6) ///
{
$exp14='360000';
}
$RandRating3 = rand(0,500);
if($RandRating3==109 || $RandRating3==206 || $RandRating3==300 || $RandRating3==60) ///
{
$exp15='800000';
}
$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=50000+$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/chest?open_ok");
$_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']+3)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '3', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d='<br><img src="/img/icons/ruby.png"> 3';
}
$RandRuby1=rand(0,500);
if($RandRuby1==19 || $RandRuby1==26 || $RandRuby1==30 || $RandRuby1==96) ///
{
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'");
$d1='<br><img src="/img/icons/ruby.png"> 5';
}
$RandRuby2=rand(0,1000);
if($RandRuby2==19 || $RandRuby2==26 || $RandRuby2==30 || $RandRuby2==96) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+8)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '8', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d2='<br><img src="/img/icons/ruby.png"> 8';
}
$RandRuby3=rand(0,50);
if($RandRuby3==19 || $RandRuby3==26 || $RandRuby3==30 || $RandRub3y==6) ///
{
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']+1)."' WHERE `id` = '$ku[id]'");
mysql_query("INSERT INTO `info_user` SET `id_user` = '$ku[id]', `status` = '+', `many` = '1', `kuda` = 'Выигрыш в открытом сундуке', `time` = '$time'");
$d3='<br><img src="/img/icons/ruby.png"> 1';
}
$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=50000+$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/chest?open_ok");
$_SESSION['msg']='В открытом сундуке вы нашли: <br>
<img src="/img/icons/experience.png"> '.$rating.' '.$d.' '.$d1.' '.$d2.' '.$d3.''.$d7.'';
}
}
}
?>