<?php
session_start();
include_once "inc/db_connect.php";
include_once "inc/fnc.php";
header('Content-Type: text/html;charset=utf8');
$err = "";
if(isset($_POST['regok'])){unset($_SESSION['reg_ok']);}
if(!isset($_SESSION['user'])){
	header("Location: index.php?");
	exit();
}else{
	$data_user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE nick='".$_SESSION['user']."'")) or die(mysql_error());
{
include 'head.php';
if($data_user['level']<3)
{
echo "<div class='menu'>";
echo' <center>Смена статуса доступна с 3 уровня.</center>';
echo "</div>";
echo "<img src='/img/levelmal.png'>";
include 'foot.php';
exit;
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html>';
echo '<head>';
echo '<title>AvtoGame</title>';
	echo '<meta http-equiv="Content-Type" content="text/html" charset="windows-1251" />';
	echo '<meta name="description" content="Мобильные онлайн гонки">';
if(empty($data_user['theme']) or $data_user['theme'] == 'default')
{
$style="/style/default/mobile.css";
}
if($data_user['theme'] == "twotheme")
{
$style="style/twotheme/mobile.css";
}
echo '<link rel="stylesheet" href="'.$style.'" type="text/css" />';
?>
<?
echo '</center></div>';
echo "<div class='title'>Смена Статуса</div>";
{
if(isset($_POST['statusok']))
{
	$status = mysql_real_escape_string(strip_tags($_POST['status']));
mysql_query("UPDATE `users` SET mystatus='".$status."' WHERE nick='".$_SESSION['user']."'");
echo "<div class='menu'><center>Статус изменен!</center></div>";
}
$data = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE nick='".$_SESSION['user']."'")) or die(mysql_error());
echo "<div class='mono'>
Ваш статус: ".$data['mystatus']."
</div>";
echo "<div class='mono'>
<form action='' method='post'>
Введите новый статус<br/><textarea name='status' value='".$data['mystatus']."' /></textarea><br/>
<input type='submit' name='statusok' class='btn' value='Изменить' />
</form>
</div>";
}
?>
</div>
</div>
</body>
</html>
<?
}
}
include 'foot.php';
?>