Вход Регистрация
Файл: public_html/train.php
Строк: 30
<?php
include ('./dev/db.php');
include (
'./dev/functions.php');
include (
'./dev/user.php');
$title 'Тренировка';
include (
'./dev/head.php');
if(!
$user) {
header('location: /index.php');
exit();
}
if(
$_GET['act'] == strength && $user['gold'] != 0) {
mysql_query("update `users` set `gold` = `gold`- 1, `strength` = `strength` + 1 where `id` = '".$user['id']."'");
header('location: ?');
$_SESSION['result'] = 'Тренировка завершена!';
exit();
}
if(
$_GET['act'] == armor && $user['gold'] != 0) {
mysql_query("update `users` set `gold` = `gold`- 1, `armor` = `armor` + 1 where `id` = '".$user['id']."'");
header('location: ?');
$_SESSION['result'] = 'Тренировка завершена!';
exit();
}
if(
$_GET['act'] == health && $user['gold'] != 0) {
mysql_query("update `users` set `gold` = `gold`- 1, `max_health` = `max_health` + 1 where `id` = '".$user['id']."'");
header('location: ?');
$_SESSION['result'] = 'Тренировка завершена!';
exit();
}
echo 
'<div class="block">Стоимость: 1 <img src="/img/gold.png"><br>Ваши параметры: '.$user['strength'].' <img src="/img/strength.png"> '.$user['armor'].' <img src="/img/armor.png"> '.$user['max_health'].' <img src="/img/health.png"></div>';
echo 
'<a href="?act=strength" class="link"><img src="/img/strength.png"> Атака + 1</a>';
echo 
'<a href="?act=armor" class="link"><img src="/img/armor.png"> Защита + 1</a>';
echo 
'<a href="?act=health" class="link"><img src="/img/health.png"> Здоровье + 1</a>';
include (
'./dev/foot.php');
?>
Онлайн: 0
Реклама