Файл: zamok/naim1.php
Строк: 15
<?
include_once '../core/system.php';
echo only_reg();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `zamok` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$zamok = mysql_fetch_assoc(mysql_query("SELECT * FROM `zamok` WHERE `id` = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Нет такого замка!";
header('Location: index.php');
exit();
}
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".$zamok[id_user]."'"));
if($user[id] == $ank[id]){
if($user[gold] > 700){
mysql_query("UPDATE `zamok` SET `param` = '".($zamok[param]+700)."', `titan3` = '".($zamok[titan3]+1)."' WHERE `id` = '$_GET[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `gold` = '".($user[gold]-700)."' WHERE `id` = '$user[id]' LIMIT 1");
header("Location: zamok.php?id=$zamok[id]");
$_SESSION['message'] = 'Колдун нанят!';
exit();
}else{
header("Location: zamok.php?id=$zamok[id]");
$_SESSION['err'] = 'Нужно больше золота!';
exit();
}
}else{
header("Location: zamok.php?id=$zamok[id]");
$_SESSION['err'] = 'Это не ваш замок!';
exit();
}
?>