Файл: chest.php
Строк: 294
<?php
session_start();
include ('private/mysql.php');
include ('tmp/head.php');
if($user['level']<'5'){
header('Location: main.php');
exit;
}
switch($sd){
default:
if($_SESSION['chest']!==''){
echo $_SESSION['chest'];
$_SESSION['chest']="";
}
echo "Ключей: <img src='img/key.png'> $user[key]<br><br>";
echo "<center><font size=2 color=grey>Выберите один из сундуков:</font><br><br>";
$c1 = rand(1,3);
$c2 = rand(1,3);
$c3 = rand(1,3);
if($c1=='1'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c1=='2'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c1=='3'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c2=='1'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c2=='2'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c2=='3'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c3=='1'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c3=='2'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
if($c3=='3'){
echo "<a href='chest.php?sd=open'><img src='img/chest1.png' width='70 'height='50'></a> ";
}
echo "<br><br></center>";
echo "<font size=2 color=grey>
Стоимость открытия сундука - <img src='img/key.png'> 1 ключ<br>
В сундуке можно найти: Серебро,Алмазы,Ключ,а также редкое снаряжение</font>";
break;
case 'open':
if($user['key']<='0'){
header('Location: chest.php');
exit;
}
mysql_query("UPDATE `users` SET `key`=`key`-'1' WHERE `id`='$uid'");
$chest = rand(1,3);
if($chest=='3'){
$rand=rand(0,6);
if($rand=='6'){
$randh=rand(0,150);
if($randh=='47'){
mysql_query("INSERT INTO `item` SET
`user`='$uid',
`name`='Усиленная булава Крушителя Теней',
`tip`='weapon',
`level`='6',
`img`='chestweapon1.png',
`min_u`='50',
`max_u`='70'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/shmot/chestweapon1.png'> Усиленная булава Крушителя Теней</font><hr>";
header('Location: chest.php');
exit;
}
if($randh=='34'){
mysql_query("INSERT INTO `item` SET
`user`='$uid',
`name`='Усиленный топор Крушителя Теней',
`tip`='weapon',
`level`='6',
`img`='cheastweapon2.png',
`min_u`='40',
`max_u`='80'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/shmot/cheastweapon2.png'> Усиленный топор Крушителя Теней</font><hr>";
header('Location: chest.php');
exit;
}
if($randh=='63'){
mysql_query("INSERT INTO `item` SET
`user`='$uid',
`name`='Кираса Крушителя Теней',
`tip`='armor',
`level`='15',
`img`='chestarmor1.png',
`hp`='3100'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/shmot/cheastarmor1.png'> Кираса Крушителя Теней</font><hr>";
header('Location: chest.php');
exit;
}
if($randh=='81'){
mysql_query("INSERT INTO `item` SET
`user`='$uid',
`name`='Поножи Крушителя Теней',
`tip`='pants',
`level`='12',
`img`='chestpants1.png',
`hp`='3000'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/shmot/chestpants1.png'> Поножи Крушителя Теней</font><hr>";
header('Location: chest.php');
exit;
}
}
// серебро
if($rand=='2'){
$rands=rand(1,5);
if($rands=='1'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'1000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 1000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='2'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'5000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 5000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='3'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='4'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'25000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 25000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='5'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'50000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 50000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
}
// ключи
if($rand=='4'){
$randk=rand(1,4);
if($randk=='1'){
mysql_query("UPDATE `users` SET `key`=`key`+'1' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/key.png'> 1 ключ</font><hr>";
header('Location: chest.php');
exit;
}
if($randk=='2'){
mysql_query("UPDATE `users` SET `key`=`key`+'3' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/key.png'> 3 ключа</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='3'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randk=='4'){
mysql_query("UPDATE `users` SET `key`=`key`+'5' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/key.png'> 5 ключей</font><hr>";
header('Location: chest.php');
exit;
}
}
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($chest=='2'){
$rand=rand(0,6);
// алмазы
if($rand=='6'){
$randa=rand(1,10);
if($randa=='1'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='2'){
mysql_query("UPDATE `users` SET `almaz`=`almaz`+'1' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/almaz.png'> 1 алмаз</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='3'){
mysql_query("UPDATE `users` SET `almaz`=`almaz`+'3' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/almaz.png'> 3 алмаза</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='4'){
mysql_query("UPDATE `users` SET `almaz`=`almaz`+'1' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/almaz.png'> 1 алмаз</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='5'){
mysql_query("UPDATE `users` SET `almaz`=`almaz`+'5' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/almaz.png'> 5 алмазов</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='6'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='7'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='8'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='9'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randa=='10'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
}
// серебро
if($rand=='2'){
$rands=rand(1,5);
if($rands=='1'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'1000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 1000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='2'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'5000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 5000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='3'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='4'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'25000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 25000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='5'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'50000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 50000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
}
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($chest=='1'){
$rand=rand(0,5);
// серебро
if($rand=='2'){
$rands=rand(1,5);
if($rands=='1'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'1000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 1000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='2'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'5000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 5000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='3'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='4'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'25000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 25000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='5'){
mysql_query("UPDATE `users` SET `silver`=`silver`+'50000' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/silver.png'> 50000 серебра</font><hr>";
header('Location: chest.php');
exit;
}
}
// ключи
if($rand=='4'){
$randk=rand(1,4);
if($randk=='1'){
mysql_query("UPDATE `users` SET `key`=`key`+'1' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/key.png'> 1 ключ</font><hr>";
header('Location: chest.php');
exit;
}
if($randk=='2'){
mysql_query("UPDATE `users` SET `key`=`key`+'3' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/key.png'> 3 ключа</font><hr>";
header('Location: chest.php');
exit;
}
if($rands=='3'){
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
if($randk=='4'){
mysql_query("UPDATE `users` SET `key`=`key`+'5' WHERE `id`='$uid'");
$_SESSION['chest']="<font color=lightgreen>Вы выиграли <img src='img/key.png'> 5 ключей</font><hr>";
header('Location: chest.php');
exit;
}
}
$_SESSION['chest']="<font color=red>Вы ничего не выиграли</font><hr>";
header('Location: chest.php');
exit;
}
break;
}
include ('tmp/foot.php');
?>