Файл: l2ps_v5/tovesh.php
Строк: 45
<?php
include_once("files/zagarena.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
switch($go) {
default:
$id = htmlspecialchars(stripslashes(addslashes($id)));
$name = htmlspecialchars(stripslashes(addslashes($name)));
echo "<form action="tovesh.php?go=go&id=$id" method="post"><small>Сколько?:</small><br/>";
echo "<input name="kol" maxlength="3" value="1" title="Количество" /><br/>";
echo '<input type="submit" value="Продолжить" /></form>';
break;
case 'go':
$id = htmlspecialchars(stripslashes(addslashes($id)));
$kol = htmlspecialchars(stripslashes(addslashes($kol)));
if(eregi("[^0-9]",$kol)){echo"Вводите цифры а не буквы."; include_once"files/down.php"; exit;}
$qi = mysql_query("SELECT * from `item` WHERE `uda7`='".$log."' and `id`='".abs(intval($id))."' ");
if (mysql_affected_rows()==0)
{
echo "Вещь не сущствует!<br/>";
}
$row=mysql_fetch_array($qi);
if($row['uda3']<"$kol"){echo"У вас нет такого количества.";
include_once"files/down.php";
exit;
}
$col=$row['uda3']-$kol;
if($col>0){
mysql_query("UPDATE `item` SET `uda3`='$col' WHERE `id`='".$id."' and `uda7`='".$log."' ");
}else{
mysql_query("DELETE FROM `item` WHERE `id`='".$id."' and `uda7`='".$log."' "); }
if($row['uda4']=="HP-200"){$udata16=$udata16+200*$kol;}
if($row['uda4']=="HP-1000"){$udata16=$udata16+1000*$kol;}
if($row['uda4']=="HP-100"){$udata16=$udata16+100*$kol;}
if($row['uda4']=="MP-100"){$udata29=$udata29+100*$kol;}
if($row['uda4']=="MP-200"){$udata29=$udata29+200*$kol;}
if($row['uda4']=="MP-1000"){$udata29=$udata29+1000*$kol;}
if($row['uda4']=="Lesser Healing Potion"){$udata16=$udata16+15*$kol;}
if($row['uda4']=="Red Potion"){$udata16=$udata16+50*$kol;}
if($row['uda4']=="Healing Potion"){$udata16=$udata16+100*$kol;}
if($row['uda4']=="Greater Healing Potion"){$udata16=$udata16+150*$kol;}
if($row['uda4']=="Quick Healing Potion"){$udata16=$udata16+250*$kol;}
if($row['uda4']=="Mana Drug"){$udata29=$udata29+100*$kol;}
if($row['uda4']=="Mana Potion"){$udata29=$udata29+250*$kol;}
if($row['uda4']=="CP Potion"){$udata42=$udata42+50*$kol;}
if($row['uda4']=="Greater CP Potion"){$udata42=$udata42+200*$kol;}
if($udata42>$udata43){$udata42=$udata43;}
if($udata16>$udata17){$udata16=$udata17;}
if($udata29>$udata30){$udata29=$udata30;}
mysql_query("UPDATE `users` SET `udata16`='$udata16' WHERE `udata0`='$log'");
mysql_query("UPDATE `users` SET `udata29`='$udata29' WHERE `udata0`='$log'");
echo"Успешно использовано.";
break;
}}
include_once"files/down.php";
?>