<?php
session_start();
include ('private/mysql.php');
include ('tmp/head.php');



switch($sd){
default:

echo "Очков навыков: $user[skills]<hr>";

echo "<form action='skills.php?sd=uron' method='post'>
Увеличить урон:<br>
<input type='text' name='skills' class='enter'>
<input type='submit' name='submit' value='Увеличить' class='enter'></form><br>";


echo "<form action='skills.php?sd=hp' method='post'>
Увеличить здоровье:<br>
<input type='text' name='skills' class='enter'>
<input type='submit' name='submit' value='Увеличить' class='enter'></form><hr>";


echo "<font size=1 color=grey>1 очко навыка = +2 к урону/+15 к здоровью</font>";

break;

case 'hp':
if($user['skills']<='0'){
    header('Location: skills.php');
    exit;
}

$kol = (int)mysql_real_escape_string(htmlspecialchars($_POST['skills']));

if($kol>$user['skills']){
    header('Location: skills.php');
    exit;
}

$hp = $kol*15;

mysql_query("UPDATE `users` SET `hpall`=`hpall`+'$hp',`skills`=`skills`-'$kol' WHERE `id`='$uid'");

header('Location: skills.php');
exit;

break;

case 'uron':
if($user['skills']<='0'){
    header('Location: skills.php');
    exit;
}

$kol = (int)mysql_real_escape_string(htmlspecialchars($_POST['skills']));

if($kol>$user['skills']){
    header('Location: skills.php');
    exit;
}

$min = $kol*2;
$max = $kol*2;

mysql_query("UPDATE `users` SET `min_u`=`min_u`+'$min',`max_u`=`max_u`+'$max',`skills`=`skills`-'$kol' WHERE `id`='$uid'");

header('Location: skills.php');
exit;

break;



}
include ('tmp/foot.php');
?>