Вход Регистрация
Файл: neuder/game/pets/name.php
Строк: 32
<?php
require ('../../config/func.php');
$title 'Кличка питомца';
require (
'../../config/header.php');
$pets mysql_query("SELECT * FROM `pets_user` WHERE `user`='".$user['id']."'");
if(
mysql_num_rows($pets) == '0'){
echo 
' <div class="block center"> У вас нет питомца</div>';
}else{
$mypets mysql_fetch_assoc(mysql_query("SELECT * FROM `pets_user` WHERE `user` = '".$user['id']."'"));
}
if(isset(
$_POST['name'])){
$name text($_POST['name']);
if(empty(
$name)) $err 'Введите кличку';
if(
$mypets['name'] == $name$err 'Ошибка';
if(
$user['cristal'] < 10$err 'Нужно 10 <img src="/style/spach/gold.png">';
if(!isset(
$err)){
mysql_query("update `pets_user` set `name` = '".$name."'  where `id`  = '".$mypets['id']."'");
mysql_query("update `user` set `cristal` = '".($user['cristal'] - 10)."' where `id` = '".$user['id']."'");
$_SESSION['notif'] = 'Кличка питомца успешно изменена на «'.$name.'»';
header('Location: ?');
exit;
}else{
$_SESSION['notif'] = $err;
header('Location: ?');
exit;
}
}
?><div class="block">Ты можешь сменить кличку своему питомцу за 10 <img src="/style/spach/cristal.png"> кристаллов</div><form class="block center" action="" method="post"><br/>
Кличка питомца:</br>
<input type="text" name="name" maxlength="50" value="<?=$mypets['name'];?>"/><br/><input type="submit" class="button_on" value="Изменить"></form><div class="block"><a href="/my_pets/">Питомец</a></div><?
require ('../../config/footer.php');
?>
Онлайн: 1
Реклама