Файл: test.masteram.us/games/fermer/storage.php
Строк: 71
<?php
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
$int=intval($_GET['id']);
$set['title']='Моя ферма! - Склад';
include_once '../../sys/inc/thead.php';
title();
err();
if(isset($_GET['sell_ok']))msg('Продано +20 опыта!');
echo '<center><img src="/fermer/img/warehouse.gif" /> </center>';
include 'inc/str.php';
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_oput` = `fermer_oput`+ '20' WHERE `id` = $user[id] LIMIT 1");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>".htmlspecialchars(my_esc($semen['name']))."</b><br/>";
echo "» Количество урожая: <b>".htmlspecialchars(my_esc($post['kol']))."</b> <br/>";
echo "» Цена за единицу: <b>".htmlspecialchars(my_esc($semen['dohod']))."</b> <br/>";
echo "» Общий доход: <b>".htmlspecialchars(my_esc($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);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if($k_post==0){echo "<div class='block'>На складе товаров нет</div>";}
$res = mysql_query("select * from `fermer_sclad` WHERE `id_user` = '$user[id]' LIMIT $start, $set[p_str];");
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' ><b>»</b> <a href='?id=$post[id]'>".htmlspecialchars(my_esc($semen['name']))."</a> [".htmlspecialchars(my_esc($post['kol']))."] ";
echo "(<a href='?id=$post[id]&sell'><span class='off'>Продать!</span></a>)<br />";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
}
echo "<div class='foot'>";
echo "« <a href='index.php'>Назад</a><br/>";
echo "</div>";
include_once '../../sys/inc/tfoot.php';
?>