Файл: inc/shop/key.php
Строк: 55
<?
$title='Ключи';
include_once '../system/config.php';
echo"<div class='rzd2'></div><div class='menuin2'>";
echo'<div class="title">Покупка ключей</h2></div>
<div class="div">';
echo'Ключи нужны для открытия сундуков.<br>';
echo "<hr color='#CCCC00' size='1'>";
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
echo'<img src="/img/icons/key.png" alt="o"> Обычный ключ (у вас <img src="/img/icons/GoldKey.png" alt="o"> '.$key['normal'].')<br><a href="/shop/key/normal">купить</a> (<img src="/img/icons/ruby.png" alt="o"> 2)<br>';
echo "<hr color='#CCCC00' size='1'>";
echo'<img src="/img/icons/key.png" alt="o"> Бронзовый ключ (у вас <img src="/img/icons/GoldKey.png" alt="o"> '.$key['bronze'].')<br><a href="/shop/key/bronze">купить</a> (<img src="/img/icons/ruby.png" alt="o"> 5)<br>';
echo "<hr color='#CCCC00' size='1'>";
echo'<img src="/img/icons/key.png" alt="o"> Серебрянный ключ (у вас <img src="/img/icons/GoldKey.png" alt="o"> '.$key['silver'].')<br><a href="/shop/key/silver">купить</a> (<img src="/img/icons/ruby.png" alt="o"> 10)<br>';
echo "<hr color='#CCCC00' size='1'>";
echo'<img src="/img/icons/key.png" alt="o"> Золотой ключ (у вас <img src="/img/icons/GoldKey.png" alt="o"> '.$key['gold'].')<br><a href="/shop/key/gold">купить</a> (<img src="/img/icons/ruby.png" alt="o"> 25)<br>';
echo "<hr color='#CCCC00' size='1'>";
echo'<img src="/img/icons/key.png" alt="o"> Проклятый ключ (у вас <img src="/img/icons/GoldKey.png" alt="o"> '.$key['magic'].')<br><a href="/shop/key/magic">купить</a> (<img src="/img/icons/ruby.png" alt="o"> 35)';
echo "<hr color='#CCCC00' size='1'>";
?>
<?
if(isset($_GET['normal']) && ($ku['rubies']>1)){
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-2)."' WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `key_user` SET `normal` = '".($key['normal']+1)."' WHERE `id_user` = '".$ku['id']."'");
header("Location: /shop/key");
$_SESSION['msg']='Куплен обычный ключ';
}
?>
<?
if(isset($_GET['bronze']) && ($ku['rubies']>4)){
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-5)."' WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `key_user` SET `bronze` = '".($key['bronze']+1)."' WHERE `id_user` = '".$ku['id']."'");
header("Location: /shop/key");
$_SESSION['msg']='Куплен бронзовый ключ';
}
?>
<?
if(isset($_GET['silver']) && ($ku['rubies']>9)){
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-10)."' WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `key_user` SET `silver` = '".($key['silver']+1)."' WHERE `id_user` = '".$ku['id']."'");
header("Location: /shop/key");
$_SESSION['msg']='Куплен серебрянный ключ';
}
?>
<?
if(isset($_GET['gold']) && ($ku['rubies']>24)){
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-25)."' WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `key_user` SET `gold` = '".($key['gold']+1)."' WHERE `id_user` = '".$ku['id']."'");
header("Location: /shop/key");
$_SESSION['msg']='Куплен золотой ключ';
}
?>
<?
if(isset($_GET['magic']) && ($ku['rubies']>34)){
$key =mysql_fetch_array(mysql_query("SELECT * FROM `key_user` WHERE `id_user` = '$ku[id]'"));
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-35)."' WHERE `id` = '".$ku['id']."'");
mysql_query("UPDATE `key_user` SET `magic` = '".($key['magic']+1)."' WHERE `id_user` = '".$ku['id']."'");
header("Location: /shop/key");
$_SESSION['msg']='Куплен магический ключ';
}
?>
<img src="/icon/3.png" width='16' alt="o"><a href="/warehouse/chest">В сундуки</a>
</div>
</div>
<?echo"</div></div><div class='rzd2'></div>";
include_once '../system/foot.php';
?>