Файл: soc-set/moduls/fermer/storage.php
Строк: 37
<?php
require_once('../../core/start.php');
include_once 'inc.php';
check_auth();
head('Веселая ферма');
echo DIV_TITLE . 'Веселая ферма' . CLOSE_DIV;
if(isset($_GET['sell_ok']))msg('Продано!');
echo "<div class='grad32'><img src='fermer.gif'></div><div class='ferm3'><img src='warehouse.gif'><br/><div class='grad16'>Склад</div>";
include 'inc/str.php';
echo"</div></center><div class='ferm3'>";
if(isset($_GET['id'])){
$post=mysql_fetch_array(mysql_query("select * from `fermer_sclad` WHERE `id`= '$_GET[id]' LIMIT 1"));
$semen=mysql_fetch_array(mysql_query("select * from `fermer_name` WHERE `id` = '$post[semen]' LIMIT 1"));
$dohod=$post['kol']*$semen['dohod'];
if(isset($_GET['sell']))
{
mysql_query("UPDATE `user` SET `fermer_money` = `fermer_money`+ $dohod WHERE `id` = $user[id] LIMIT 1");
mysql_query("DELETE FROM `fermer_sclad` WHERE `id` = $_GET[id] ");
header('Location: storage.php?sell_ok');
}
echo "<img src='img/$post[semen].gif' alt=''><br/>» <b>".$semen['name']."</b><br/>";
echo "» Количество урожая: <b>".$post['kol']."</b> <br/>";
echo "» Цена за единицу: <b>".$semen['dohod']."</b> <br/>";
echo "» Общий доход: <b>".$dohod."</b> <br/>";
echo "<form method='post' action='?id=".$int."&sell'>n";
echo "<input type='submit' name='save' value='Продать!' />n";
echo "</form>n";
echo "<div class='foot'>";
echo "« <a href='storage.php'>Склад</a><br/>";
echo "</div>";
}else{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `fermer_sclad` WHERE `id_user` = '$user[id]'"),0);
if($k_post==0){echo "<div class='block'>На складе товаров нет</div>";}
$res = mysql_query("select * from `fermer_sclad` WHERE `id_user` = '$user[id]' ");
while ($post = mysql_fetch_array($res)){
$semen=mysql_fetch_array(mysql_query("select * from `fermer_name` WHERE `id` = '$post[semen]' LIMIT 1"));
echo "<img src='img/$post[semen].gif' height='30' width='30'><b> </b> <a href='?id=$post[id]'>".$semen['name']."</a> [".$post['kol']."] ";
echo "(<a href='?id=$post[id]&sell'><span class='off'>Продать!</span></a>)<br />";
}
}
echo "<div class='foot'>";
echo "<a href='index.php'><img src='egg.png'> В игру</a><br/>";
echo "</div>";
require_once('../../core/stop.php');
?>