<?
require_once '../core/system.php';
echo only_reg();
$header = 'Смена Пола!';
require_once H.'core/head.php';
switch($act) {
case 'post':
if(isset($_POST['gender'])){
$gender = check($_POST['gender']);
if($user[gold] <= 100) $err =  'Недостаточно золота';
if(!isset($err)) {
mysql_query("UPDATE `user` SET `gold` = '".($user['gold']-100)."' WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `pol` = '".$gender."' WHERE `id` = '$user[id]' LIMIT 1");
setcookie('pol', $pol, time()+86400*365, '/');
header('Location: /change_gender');
$_SESSION['message'] = 'Пол изменен!';
exit();
}else{
header('Location: /change_gender');
$_SESSION['err'] = $err;
// Вывод ошибки 
exit();
} 
}else{
header('Location: /change_gender');
$_SESSION['err'] = 'Выберите пол';
exit();
}
break;
default:
echo '<center><form class="player" method="post" action="?act=post">
Пол:<br />
<select  name="gender">
<option value="1">Мужской</option>
<option value="0">Женский</option>
</select><br />
<span class="btn"><span class="end"><input class="label" type="submit" value="Сменить">Сменить</span></span>
</form></center>';
}
require_once H.'core/foot.php';
?>