<?php

$title = 'Админка новостей';

include_once '../protected/sys.php';

if (!$user OR $user['access']!='3')
{
	header("Location:/");
	exit;
}


if (isset($_GET['q']))
{
	$ttl = trim(htmlspecialchars($_POST['title']));
	$txt = trim(htmlspecialchars($_POST['text']));

	$sma = $db->query("INSERT INTO `news` SET `user`=?,`title`=?,`text`=?,`time`=?",
										array($user['id'],$ttl,$txt,time()));

	$_SESSION['info'] = 'Новость добавлена';
	header("Location:?");
	exit;


}

?>
<div class='content'/>
	<form action ='?q' method='post'/>
		Input title:<br/>
		<input class ='input' name ='title'/>
		<br/>
		input text<br/>
		<textarea class ='input' name ='text' >
		</textarea>
		<br/>
		<input class ='input' type ='submit' value ='send'/>
	</form>
</div>
<?

include_once $config['root'].'/protected/footermain.php';
