Файл: vkollektive2014/play_gamescool/bar/buy.recept.php
Строк: 37
<?php
include_once '../../connect.php';
include_once '../../head.php';
include_once 'inc/start.php';
if(isset($_GET['id'])){
$id=abs(intval($_GET['id']));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_my_recept` WHERE `id_u`='".$user_id."' AND `id_r`='".$id."'"),0)==0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_recept` WHERE `id`='".$id."'"),0)!=0){
if($bar_user['money']>=mysql_result(mysql_query("SELECT `cost` FROM `bar_recept` WHERE `id`='".$id."'"),0)){
if($bar_user['level']>=mysql_result(mysql_query("SELECT `level` FROM `bar_recept` WHERE `id`='".$id."'"),0)){
mysql_query("UPDATE `bar_user` SET `money`=`money`-".mysql_result(mysql_query("SELECT `cost` FROM `bar_recept` WHERE `id`='".$id."'"),0)." WHERE `id_u`='".$user_id."'");
$arr=mysql_fetch_array(mysql_query("SELECT * FROM `bar_recept` WHERE `id`='".$id."'"));
mysql_query("INSERT INTO `bar_my_recept`(`id_u`,`id_r`,`name`,`in`,`alc`,`exp`) VALUES('".$user_id."','".$id."','".$arr['name']."','".$arr['in']."','".$arr['alc']."','".$arr['exp']."')");
bar_msg($diz['msg'],'Покупка успешно осуществлена');
}
else
bar_msg($diz['msg'],'У вас низкий уровень!');
}
else
bar_msg($diz['msg'],'У вас не хватает денег');
}
else
bar_msg($diz['msg'],'Ошибка');
}
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>
";
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_recept`"),0);
$quert=mysql_query("SELECT * FROM `bar_recept` ORDER BY `level` ASC LIMIT ".$start.",5");
while($array=mysql_fetch_array($quert)){
echo '<table cellpadding="0">
<tr>
<td style="border: 2px solid #0090C4;
background-color: #fff;
height:48px;
width:48px;" align="center">
<img src="i/r_'.$array['id'].'.png" alt="." />
</td>
<td>
'.$array['name'].'('.$array['level'].'ур./'.$array['exp'].'exp)
<br/>
А/В : '.$array['alc'].'<br/>
'.(mysql_result(mysql_query("SELECT COUNT(*) FROM `bar_my_recept` WHERE `id_u`='".$user_id."' AND `id_r`='".$array['id']."'"),0)==0 ? '<a href="buy.recept.php?id='.$array['id'].'&start='.$start.'">Купить за
<img src="i/mmoney.png" alt="." />
'.$array['cost'].'</a>' : "Куплено").'
</td></tr></table>';
}
if ($total > 5) {
echo bar_pagenav('buy.recept.php?', $start, $total, 5);
}
echo "<br/>*А/В - алкогольное воздействие</div>";
ret($diz['ret'],'Кабинет','cab.php');
ret($diz['ret'],'Мой бар','index.php');
include_once '../../foot.php';
?>