Файл: ferma/rubalka/shop.php
Строк: 184
<?php
echo "<div class='event'><h1>Магазин снастей (Рай рыбалки)</h1></div>";
echo "<div class='content'>";
echo '<div class="block"><div>';
$ref1 = $id['ref1'];
$ref2 = $id['ref2'];
$ref3 = $id['ref3'];
$ref4 = $id['ref4'];
if(isset($_GET['select']) && intval($_GET['select'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_udochka` WHERE `id` = '".intval($_GET['select'])."' AND (`level` < '$ku[level]' OR `level` = '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_udochka` WHERE `id` = '".intval($_GET['select'])."'"));
$cena = $plant['cena'];
$level = $plant['level'];
if($ku['rubies']>=$cena)
{
mysql_query("UPDATE `kolhoz_snacti_user` SET `udochka` = '".$plant['id']."', `udochka_level` = '".$level."', `udochka_name` = '".$plant['name']."' WHERE `id_user` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
msg_game('Товар успешно куплен.');
header("Location:?LinkIndexRyba");
exit;
}
else
{
no_rubies($cena-$ku['rubies']);
}
}
/////////////////////////////////////////////////////////////////////
if(isset($_GET['select2']) && intval($_GET['select2'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_leska` WHERE `id` = '".intval($_GET['select2'])."' AND (`level` < '$ku[level]' OR `level` = '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_leska` WHERE `id` = '".intval($_GET['select2'])."'"));
$cena = $plant['cena'];
$level = $plant['level'];
if($ku['rubies']>=$cena)
{
mysql_query("UPDATE `kolhoz_snacti_user` SET `leska` = '".$plant['id']."', `leska_level` = '".$level."', `leska_name` = '".$plant['name']."' WHERE `id_user` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
msg_game('Товар успешно куплен.');
header("Location:?LinkIndexRyba");
exit;
}
else
{
no_rubies($cena-$ku['rubies']);
}
}
/////////////////////////////////////////////////////////////////////
if(isset($_GET['select3']) && intval($_GET['select3'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_krychki` WHERE `id` = '".intval($_GET['select3'])."' AND (`level` < '$ku[level]' OR `level` = '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_krychki` WHERE `id` = '".intval($_GET['select3'])."'"));
$cena = $plant['cena'];
$level = $plant['level'];
if($ku['rubies']>=$cena)
{
mysql_query("UPDATE `kolhoz_snacti_user` SET `krychki` = '".$plant['id']."', `krychki_level` = '".$level."', `krychki_name` = '".$plant['name']."' WHERE `id_user` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
msg_game('Товар успешно куплен.');
header("Location:?LinkIndexRyba");
exit;
}
else
{
no_rubies($cena-$ku['rubies']);
}
}
/////////////////////////////////////////////////////////////////////
if(isset($_GET['select4']) && intval($_GET['select4'])!=NULL && mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_nazhivka` WHERE `id` = '".intval($_GET['select4'])."' AND (`level` < '$ku[level]' OR `level` = '$ku[level]')"),0)!=0)
{
$plant=mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_nazhivka` WHERE `id` = '".intval($_GET['select4'])."'"));
$cena = $plant['cena'];
$col = 50;
$level = $plant['level'];
if($ku['rubies']>=$cena)
{
mysql_query("UPDATE `kolhoz_snacti_user` SET `nazhivka` = '".$plant['id']."', `col_nazhivka` = '".$col."', `nazhivka_name` = '".$plant['name']."' WHERE `id_user` = '$ku[id]'");
mysql_query("UPDATE `kolhoz_user` SET `rubies` = '".($ku['rubies']-$cena)."' WHERE `id` = '$ku[id]'");
msg_game('Товар успешно куплен.');
header("Location:?LinkIndexRyba");
exit;
}
else
{
no_rubies($cena-$ku['rubies']);
}
}
@$refs1 = $_GET[''.$ref1.''];
@$refs2 = $_GET[''.$ref2.''];
@$refs3 = $_GET[''.$ref3.''];
@$refs4 = $_GET[''.$ref4.''];
if(isset($refs1)){
echo '<img src="rubalka/soap.png" alt="o" height="16" width="16" /> Список удочек:<br />';
/////////////////////////////////////
/////////////////////////////////////
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_udochka`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_udochka` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:2px'>";
echo "<img width='48' height='48' src='images/kolhoz_udochka/$post[id].png' alt='o' />";
echo "<div class='small'>";
echo "<span>".hsc($post['name'])."</span> <span class='minor'>, ".($ku['level']>=$post['level']?" <a href='?LinkIndexRybaShop&select=$post[id]'>Купить</a> цена: </span><span><img width='16' height='16' src='images/icons/ruby.png' alt='o'><span class='title'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div></li>";
}
echo "</ul><br />";
if ($k_page>1)str("?LinkIndexRybaShop&$ref1&",$k_page,$page); // Вывод страниц
}elseif(isset($refs2)){
echo '<img src="rubalka/soap.png" alt="o" height="16" width="16" /> Набор лески!<br />';
/////////////////////////////////////
/////////////////////////////////////
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_leska`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_leska` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:2px'>";
echo "<img width='48' height='48' src='images/kolhoz_leska/$post[id].png' alt='o' />";
echo "<div class='small'>";
echo "<span>".hsc($post['name'])."</span> <span class='minor'>, ".($ku['level']>=$post['level']?" <a href='?LinkIndexRybaShop&select2=$post[id]'>Купить</a> цена: </span><span><img width='16' height='16' src='images/icons/ruby.png' alt='o'><span class='title'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div></li>";
}
echo "</ul><br />";
if ($k_page>1)str("?LinkIndexRybaShop&$ref2&",$k_page,$page); // Вывод страниц
}elseif(isset($refs3)){
echo '<img src="rubalka/soap.png" alt="o" height="16" width="16" /> Набор крючков!<br />';
/////////////////////////////////////
/////////////////////////////////////
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_krychki`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_krychki` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:2px'>";
echo "<img width='48' height='48' src='images/kolhoz_krychki/$post[id].png' alt='o' />";
echo "<div class='small'>";
echo "<span>".hsc($post['name'])."</span> <span class='minor'>, ".($ku['level']>=$post['level']?" <a href='?LinkIndexRybaShop&select3=$post[id]'>Купить</a> цена: </span><span><img width='16' height='16' src='images/icons/ruby.png' alt='o'><span class='title'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div></li>";
}
echo "</ul><br />";
if ($k_page>1)str("?LinkIndexRybaShop&$ref3&",$k_page,$page); // Вывод страниц
}elseif(isset($refs4)){
echo '<img src="rubalka/soap.png" alt="o" height="16" width="16" /> Набор наживок!<br />';
/////////////////////////////////////
/////////////////////////////////////
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_nazhivka`"),0);
if ($k_post==0)
{
echo "Список пуст...";
}
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `kolhoz_nazhivka` ORDER BY `level` ASC LIMIT $start, $set[p_str]");
echo "<ul>";
while($post=mysql_fetch_array($q))
{
echo "<li style='padding-bottom:2px'>";
echo "<img width='48' height='48' src='images/kolhoz_nazhivka/$post[id].png' alt='o' />";
echo "<div class='small'>";
echo "<span>".hsc($post['name'])."</span> <span class='minor'>, ".($ku['level']>=$post['level']?" <a href='?LinkIndexRybaShop&select4=$post[id]'>Купить</a> цена: </span><span><img width='16' height='16' src='images/icons/ruby.png' alt='o'><span class='title'>$post[cena]</span></span>":"доступно с $post[level] уровня</span>")."</div></li>";
}
echo "</ul><br />";
if ($k_page>1)str("?LinkIndexRybaShop&$ref4&",$k_page,$page); // Вывод страниц
}else{
header('Location: ?LinkIndexRyba&LinkNoUser');
exit;
}
echo "<li><img width='16' height='16' src='images/icons/center.png' alt='o'> <a href='?center'>Вернуться в город</a></li>";
echo '</div></div>';
?>