Файл: play_gamescool/bar/view.zakaz.php
Строк: 32
<?php
include_once '../../connect.php';
include_once '../../head.php';
include_once 'inc/start.php';
echo "
<div class='".$diz['main']."'>
<img src='i/4.png' /> ".$bar_user['level']."
<img src='i/exp.png' /> ".$bar_user['exp']."
<img src='i/d.png' /> ".$bar_user['money']."
<br/><img src='i/bottle.png' />".$bar_user['alc']." ".nap($bar_user['alc'])."
<div class='".$diz['title2']."'>Мои коктейли</div>
";
$id=abs(intval($_GET['id']));
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_zakaz` WHERE `id_u`='".$user_id."' AND `id`='".$id."'"),0);
if($total==0)
echo "Ошибка! Такого заказа нет!";
else
{
$arr=mysql_fetch_array(mysql_query("SELECT * FROM `bar_zakaz` WHERE `id_u`='".$user_id."' AND `id`='".$id."'"));
if(isset($_POST['submit']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_coctails` WHERE `id_u`='".$user_id."' AND `act`!='2' AND `id_r`='".$arr['id_r']."'"),0)!=0){
$exp=mysql_result(mysql_query("SELECT `exp` FROM `bar_recept` WHERE `id`='".$arr['id_r']."'"),0);
mysql_query("UPDATE `bar_user` SET `money`=`money`+".(($bar_user['level']+1)*20).", `exp`=`exp`+".$exp." WHERE `id_u`='".$user_id."'");
mysql_query("DELETE FROM `bar_zakaz` WHERE `id`='".$id."'");
mysql_query("DELETE FROM `bar_coctails` WHERE `id_u`='".$user_id."' AND `id_r`='".$arr['id_r']."' LIMIT 1");
bar_msg($diz['msg'],'Вы успешно продали коктейль!');
echo "</div>";
ret($diz['ret'],'Мой бар','index.php');
include '../../foot.php';
exit;
}
echo "Посeтитель ".($arr['bot']!=0 ? "<a href='profile.php?id=".$arr['bot']."'>".$arr['name']."</a>" : $arr['name'])." заказaл коктейль "".mysql_result(mysql_query("SELECT `name` FROM `bar_recept` WHERE `id`='".$arr['id_r']."'"),0).""<br/>";
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_coctails` WHERE `id_u`='".$user_id."' AND `act`!='2' AND `id_r`='".$arr['id_r']."'"),0)==0)
echo "У вас нет такого коктейля=(";
else
echo "У вас в наличии ".mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_coctails` WHERE `id_u`='".$user_id."' AND `act`!='2' AND `id_r`='".$arr['id_r']."'"),0)." коктейлей "".mysql_result(mysql_query("SELECT `name` FROM `bar_coctails` WHERE `id_u`='".$user_id."' AND `id_r`='".$arr['id_r']."'"),0).""<br/><form method='post' action='view.zakaz.php?id=".$id."'><input type='submit' name='submit' value='Продать'/></form>";
}
echo "</div>";
ret($diz['ret'],'Мой бар','index.php');
include_once '../../foot.php';
?>