Файл: sumerki.mobi/sumerki.mobi/lambard.php
Строк: 345
<?
//////////////////////////////////////////////////////////////
//////////////////////Онлайн игра "Сумерки"///////////////////
//////////////////////Основатель: Mc Laren////////////////////
///////////////////Контакты: ICQ - 597687549//////////////////
/////////////////////Пример: Sumerki.Mobi/////////////////////
///////////Если ты это читаешь, значит скрипт слили :D////////
//////////////////////////////////////////////////////////////
define('PROTECTOR', 1);
$headmod = 'lambard';//фикс. места
$textl='Ломбард';
include('files/path.php');
include('files/gzips.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
going();
ryd();
place_okr();
place_tower();
place_zamok();
include($path.'files/core.php');
include($path.'files/head.php');
include($path.'files/zag.php');
switch($_GET[mod]){
default:
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Ломбард';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bg"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo 'Привет, тут ты можеть продать всё что тебе не нужно!';
echo '</div></div></div></div></div></div></div></div></div>';
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?mod=item">    <img src='/theme/standart/images/galochka.png'/> Продать вещи</a></div>";
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?mod=res">    <img src='/theme/standart/images/galochka.png'/> Продать ресурсы</a></div>";
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?mod=shems">    <img src='/theme/standart/images/galochka.png'/> Продать cхемы</a></div>";
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?mod=rec">    <img src='/theme/standart/images/galochka.png'/> Продать рецепты</a></div>";
break;
case 'rec':
$aura2 = mysql_result(mysql_query("SELECT COUNT(*) FROM shems WHERE usr='$log' and `bonus` = '2'"),0);
echo"» <a href="lambard.php?mod=rs2">Рецепты магии</a> ($aura2)<br/>";
$aura = mysql_result(mysql_query("SELECT COUNT(*) FROM shems WHERE usr='$log' and `bonus` = '1'"),0);
echo"» <a href="lambard.php?mod=rs1">Продать жизни</a> ($aura)";
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?">    <img src='/theme/standart/images/galochka.png'/> В ломбард</a></div>";
break;
case 'rs2':
if ($_GET[page] == "" || $_GET[page] < 0 || $_GET[page] == "0")
{
$_GET[page] = 0;
}
$next = $_GET[page] + 1;
$back = $_GET[page] - 1;
$num = $_GET[page] * 5;
if($_GET[page] == "0")
{$i = 1;}
else{$i = ($_GET[page]*5)+1;}
$viso = mysql_num_rows(mysql_query("SELECT usr FROM shems"));
$puslap = floor($viso/5);
$times = date("H:i");
$req = mysql_query("SELECT * FROM `shems` WHERE `usr` = '$log' and `bonus`='2' ORDER BY id DESC LIMIT $num,5");
////////////////////////////
$avto=mysql_num_rows($req);
if(empty($_GET[id])){
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
if($mag['unknow']=='0'){$mag['name']='Схема скрыта';}
$cena=round($mag[cena]/3);
$w=explode("*",$mag[name]);
echo"<img src="pic/tip/$w[0].gif" height=32 width=32> <a href="lambard.php?mod=rs2&id=$mag[id]">$mag[name]</a> ($mag[kol] штук, цена за 1, $cena серебра)<br/>";
}
echo'<hr>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=rs2&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
echo"|";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo "<a href="lambard.php?mod=rs2&page=$next">дальше</a>";}
else
{echo "дальше";}
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет рецептов...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=rs2&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
}
}else{
if(empty($_POST[num])){
echo" <form action="lambard.php?mod=rs2&id=".mysql_real_escape_string($_GET[id])."" method="post">";
echo 'Сколько?<br/>';
echo '<input name="num"/><br/>';
echo '<input type="submit" value="Продолжить"/></form>';
}else{
if($_POST[num]<=0){
echo"Ошибка!";
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req = mysql_query("SELECT * FROM `shems` WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==1){
$res = mysql_fetch_array($req);
/////////////////////
if($res[kol]-$_POST[num]<=0){
mysql_query("DELETE FROM `shems` WHERE usr='$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$res[kol];
}else{
$res[kol]=$res[kol]-$_POST[num];
mysql_query("UPDATE `shems` SET `kol` = '$res[kol]' WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$_POST[num];
}
///////////////////////
$cena=round($res[cena]/3);
////////////////////////
$udata[money]=round($udata[money]+$cena*$nkol);
$cena=round($cena*$nkol);
/////////////////////
mysql_query("UPDATE `users` SET `money` = '$udata[money]' WHERE `usr` = '$log'");
//////////////////////////////////////
echo"Рецепт продан: [$nkol штук] за $cena серебра!<br/>";
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет рецептов...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
}
}
}
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?">    <img src='/theme/standart/images/galochka.png'/> В ломбард</a></div>";
break;
case 'rs1':
if ($_GET[page] == "" || $_GET[page] < 0 || $_GET[page] == "0")
{
$_GET[page] = 0;
}
$next = $_GET[page] + 1;
$back = $_GET[page] - 1;
$num = $_GET[page] * 5;
if($_GET[page] == "0")
{$i = 1;}
else{$i = ($_GET[page]*5)+1;}
$viso = mysql_num_rows(mysql_query("SELECT usr FROM shems"));
$puslap = floor($viso/5);
$times = date("H:i");
$req = mysql_query("SELECT * FROM `shems` WHERE `usr` = '$log' and `bonus`='1' ORDER BY id DESC LIMIT $num,5");
////////////////////////////
$avto=mysql_num_rows($req);
if(empty($_GET[id])){
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
if($mag['unknow']=='0'){$mag['name']='Схема скрыта';}
$cena=round($mag[cena]/3);
$w=explode("*",$mag[name]);
echo"<img src="pic/tip/$w[0].gif" height=32 width=32> <a href="lambard.php?mod=rs1&id=$mag[id]">$mag[name]</a> ($mag[kol] штук, цена за 1, $cena серебра)<br/>";
}
echo'<hr>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=rs1&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
echo"|";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo "<a href="lambard.php?mod=rs1&page=$next">дальше</a>";}
else
{echo "дальше";}
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет рецептов...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=rs1&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
}
}else{
if(empty($_POST[num])){
echo" <form action="lambard.php?mod=rs1&id=".mysql_real_escape_string($_GET[id])."" method="post">";
echo 'Сколько?<br/>';
echo '<input name="num"/><br/>';
echo '<input type="submit" value="Продолжить"/></form>';
}else{
if($_POST[num]<=0){
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Ошибка!<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req = mysql_query("SELECT * FROM `shems` WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==1){
$res = mysql_fetch_array($req);
/////////////////////
if($res[kol]-$_POST[num]<=0){
mysql_query("DELETE FROM `shems` WHERE usr='$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$res[kol];
}else{
$res[kol]=$res[kol]-$_POST[num];
mysql_query("UPDATE `shems` SET `kol` = '$res[kol]' WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$_POST[num];
}
///////////////////////
$cena=round($res[cena]/3);
////////////////////////
$udata[money]=round($udata[money]+$cena*$nkol);
$cena=round($cena*$nkol);
/////////////////////
mysql_query("UPDATE `users` SET `money` = '$udata[money]' WHERE `usr` = '$log'");
//////////////////////////////////////
echo"Рецепт продан: [$nkol штук] за $cena серебра!<br/>";
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет рецептов...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
}
}
}
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?">    <img src='/theme/standart/images/galochka.png'/> В ломбард</a></div>";
break;
case 'shems':
if ($_GET[page] == "" || $_GET[page] < 0 || $_GET[page] == "0")
{
$_GET[page] = 0;
}
$next = $_GET[page] + 1;
$back = $_GET[page] - 1;
$num = $_GET[page] * 5;
if($_GET[page] == "0")
{$i = 1;}
else{$i = ($_GET[page]*5)+1;}
$viso = mysql_num_rows(mysql_query("SELECT usr FROM shems"));
$puslap = floor($viso/5);
$times = date("H:i");
$req = mysql_query("SELECT * FROM `shems` WHERE `usr` = '$log' and `bonus`='0' ORDER BY id DESC LIMIT $num,5");
////////////////////////////
$avto=mysql_num_rows($req);
if(empty($_GET[id])){
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
if($mag['unknow']=='0'){$mag['name']='Схема скрыта';}
$cena=round($mag[cena]/3);
echo"<a href="lambard.php?mod=shems&id=$mag[id]">$mag[name]</a> ($mag[kol] штук, цена за 1, $cena серебра)<br/>";
}
echo'<hr>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=shems&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
echo"|";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo "<a href="lambard.php?mod=shems&page=$next">дальше</a>";}
else
{echo "дальше";}
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет схем...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=shems&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
}
}else{
if(empty($_POST[num])){
echo" <form action="lambard.php?mod=shems&id=".mysql_real_escape_string($_GET[id])."" method="post">";
echo 'Сколько?<br/>';
echo '<input name="num"/><br/>';
echo '<input type="submit" value="Продолжить"/></form>';
}else{
if($_POST[num]<=0){
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Ошибка!<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req = mysql_query("SELECT * FROM `shems` WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==1){
$res = mysql_fetch_array($req);
/////////////////////
if($res[kol]-$_POST[num]<=0){
mysql_query("DELETE FROM `shems` WHERE usr='$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$res[kol];
}else{
$res[kol]=$res[kol]-$_POST[num];
mysql_query("UPDATE `shems` SET `kol` = '$res[kol]' WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$_POST[num];
}
///////////////////////
$cena=round($res[cena]/3);
////////////////////////
$udata[money]=round($udata[money]+$cena*$nkol);
$cena=round($cena*$nkol);
/////////////////////
mysql_query("UPDATE `users` SET `money` = '$udata[money]' WHERE `usr` = '$log'");
//////////////////////////////////////
echo"Схема: [$nkol штук] продана за $cena серебра!<br/>";
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет схем...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
}
}
}
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?">    <img src='/theme/standart/images/galochka.png'/> В ломбард</a></div>";
break;
case 'item':
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Продажа вещей';
echo '</div><div class="clearFix"></div></div></div></div>';
if ($_GET[page] == "" || $_GET[page] < 0 || $_GET[page] == "0")
{
$_GET[page] = 0;
}
$next = $_GET[page] + 1;
$back = $_GET[page] - 1;
$num = $_GET[page] * 5;
if($_GET[page] == "0")
{$i = 1;}
else{$i = ($_GET[page]*5)+1;}
$viso = mysql_num_rows(mysql_query("SELECT usr FROM item"));
$puslap = floor($viso/5);
$times = date("H:i");
$req = mysql_query("SELECT * FROM `item` WHERE `usr` = '$log' and `image`='not' ORDER BY id DESC LIMIT $num,5");
////////////////////////////
$avto=mysql_num_rows($req);
if(empty($_GET[id])){
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
$cena=round($mag[cena]/3);
$w=explode("*",$mag[name]);
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"<a href="inventar.php?mod=info&id=$mag[id]">$mag[name]</a><br><img src="pic/tip/$w[0].png" height=40 width=40><br>";
echo" <a class="buuut" href="lambard.php?mod=item&id=$mag[id]">Продать за $cena серебра</a> ";
echo '</div></div></div></div></div></div></div></div></div>';
}
echo'<hr>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=item&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
echo"|";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo "<a href="lambard.php?mod=item&page=$next">дальше</a>";}
else
{echo "дальше";}
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет вещей...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=item&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
}
}else{
$req = mysql_query("SELECT * FROM `item` WHERE `usr` = '$log' and `image`='not' and `id`='".mysql_real_escape_string($_GET['id'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==1){
$item = mysql_fetch_array($req);
$cena=round($item[cena]/3);
$udata[money]=$udata[money]+$cena;
mysql_query("UPDATE `users` SET `money` = '$udata[money]' WHERE `usr` = '$log'");
mysql_query("DELETE FROM `item` WHERE usr='$log' and `image`='not' and `id`='".mysql_real_escape_string($_GET['id'])."'");
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Вещь $item[name] продана за $cena серебра!";
echo '</div></div></div></div></div></div></div></div></div>';
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет такой вещи...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
}
}
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?">    <img src='/theme/standart/images/galochka.png'/> В ломбард</a></div>";
break;
case 'res':
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Продажа ресурсов';
echo '</div><div class="clearFix"></div></div></div></div>';
if ($_GET[page] == "" || $_GET[page] < 0 || $_GET[page] == "0")
{
$_GET[page] = 0;
}
$next = $_GET[page] + 1;
$back = $_GET[page] - 1;
$num = $_GET[page] * 5;
if($_GET[page] == "0")
{$i = 1;}
else{$i = ($_GET[page]*10)+1;}
$viso = mysql_num_rows(mysql_query("SELECT usr FROM res"));
$puslap = floor($viso/5);
$times = date("H:i");
$req = mysql_query("SELECT * FROM `res` WHERE `usr` = '$log' ORDER BY id DESC LIMIT $num,5");
////////////////////////////
$avto=mysql_num_rows($req);
if(empty($_GET[id])){
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
$cena=round($mag[cena]/3);
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"$mag[name]<br><img src="pic/tip/$mag[name].png" height=40 width=40><br><a href="lambard.php?mod=res&id=$mag[id]">Продать</a><br>
Количество: $mag[kol] шт.<br>Стоимость за 1, $cena серебра";
echo '</div></div></div></div></div></div></div></div></div>';
}
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=res&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
echo"|";
if($_GET[page] < $puslap || $_GET[page] == "" || $_GET[page] == 0)
{echo "<a href="lambard.php?mod=res&page=$next">дальше</a>";}
else
{echo "дальше";}
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет ресурсов...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
if ($_GET[page] > 0)
{
echo "<a href="lambard.php?mod=res&page=$back">назад</a>";
}
elseif ($_GET[page] == 0)
{
echo "назад";
}
}
}else{
if(empty($_POST[num])){
echo" <form action="lambard.php?mod=res&id=".mysql_real_escape_string($_GET[id])."" method="post">";
echo 'Сколько?<br/>';
echo '<input name="num"/><br/>';
echo '<input type="submit" value="Продолжить"/></form>';
}else{
if($_POST[num]<=0){
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Ошибка!<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
include($path.'files/down.php');
include($path.'files/meny.php');
exit;
}
$req = mysql_query("SELECT * FROM `res` WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto==1){
$res = mysql_fetch_array($req);
/////////////////////
if($res[kol]-$_POST[num]<=0){
mysql_query("DELETE FROM `res` WHERE usr='$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$res[kol];
}else{
$res[kol]=$res[kol]-$_POST[num];
mysql_query("UPDATE `res` SET `kol` = '$res[kol]' WHERE `usr` = '$log' and `id`='".mysql_real_escape_string($_GET['id'])."'");
$nkol=$_POST[num];
}
///////////////////////
$cena=round($res[cena]/3);
////////////////////////
$udata[money]=round($udata[money]+$cena*$nkol);
$cena=round($cena*$nkol);
/////////////////////
mysql_query("UPDATE `users` SET `money` = '$udata[money]' WHERE `usr` = '$log'");
//////////////////////////////////////
echo"$res[name] [$nkol штук] продано за $cena серебра!<br/>";
}else{
echo '<div class="zagolovok"><div class="zagolovok1"> <div class="zagolovok2"><div class="zagolovok_right"></div><div class="zagolovok_left"></div><div class="ch_name">';
echo 'Упс!';
echo '</div><div class="clearFix"></div></div></div></div>';
echo '<div class="fon bgray"><div class="bg1"><div class="bg2"><div class="bg3"><div class="bg4"><div class="bg5"><div class="bg6"><div class="bg7"><div class="bg8">';
echo"Нет ресурсов...<br/>";
echo '</div></div></div></div></div></div></div></div></div>';
}
}
}
echo "<div class='button pad_bot_5 pad'><a href="lambard.php?">    <img src='/theme/standart/images/galochka.png'/> В ломбард</a></div>";
break;
}
include($path.'files/down.php');
include($path.'files/meny.php');
?>