<?php
ini_set('display_errors', 'Off');
header("Content-Type: text/html; charset=utf-8");

	session_start();
	if ($_SESSION['uid'] == null) header("Location: index.php");
	include "config.php";
	$user = mysql_fetch_array(mysql_query("SELECT `blocknote` FROM `users` WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;"));
	$uss = mysql_fetch_array(mysql_query("SELECT `date_out` FROM `hellround_pohod` WHERE `owner` = '{$_SESSION['uid']}' ORDER BY id DESC  LIMIT 1;"));
	include "functions.php";
	if ($user['battle'] != 0) { header('location: fbattle.php'); die(); }
#echo '<strong>Возможности</strong><BR/><BR/>	';
#echo 'Вход в Излом Хаоса - ';
if(time()-259200 > strtotime($uss['date_out'])) {
#echo "<strong>доступен</strong><br/>";
} else {
$timer=strtotime($uss['date_out'])-time()+259200;

echo 'до след. похода ' . $timer . '  сек <br/><br/>';
}
$uss2 = mysql_query("SELECT `id`, `datetime` FROM `turnament` ORDER BY `datetime` DESC LIMIT 1;");
$i=0;
while($val = mysql_fetch_array($uss2)) {
#echo 'Ближайший турнир в БС - ' . strftime('%d %b %Y, %H:%M', $val[++$i]) . '<br/>';
#echo '<br>';
#echo time();
}
?>
<?php 
 if(isset($_POST['edit'])) {
$text = htmlspecialchars($_POST['text'],ENT_QUOTES, "UTF-8");
mysql_query("UPDATE `users` SET `blocknote` = '{$text}' WHERE `id` = '{$_SESSION['uid']}' LIMIT 1;");
echo("
			<script>
				function cityg(){
					location.href='blocknote.php';
				}
				setTimeout('cityg()', 1000);
			</script>
			<center><BR><BR><BR>
				<i>Записываем... </i>
			</center>
		");
					
}
?>

<HTML><HEAD>
<link rel=stylesheet type="text/css" href="css/main.css">
<meta content="text/html; charset=utf-8" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=no-cache>
<meta http-equiv=PRAGMA content=NO-CACHE>
<META http-equiv=Expires content=0><LINK href="css/main.css" type=text/css rel=stylesheet>
<META Http-Equiv=Expires Content=0>
</HEAD>
</HEAD>
<BODY bgcolor=e2e0e0>
<br>
<INPUT TYPE=button  onclick="location.href='blocknote.php';" value=Обновить>
<p align=right><INPUT TYPE=button value="Вернуться" onclick="location.href='main.php?edit=0.467837356797105';"></p>
<center>
<strong>Блокнот ( 180 слов макс.)</strong>
<form  method="POST"><table><tr><td>  

<textarea  name="text" cols="60" rows="10"  maxlength="6144"  class="zap"><?=strip_tags($user['blocknote'], '<i><tt><strong><a><img>');?></textarea>
<td><button name="edit"  /><img src=./i/pencil.gif alt="Записать" title="Записать"></button>
<td></tr></table>
</form>
</center>
</BODY>
</HTML>