Просмотр файла modules/news/add_news.php

Размер файла: 1.22Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_news';
if($user['level'] < '6') { go('/'); }
if(isset($_POST['create']) && $_GET['act'] == 'create') {
$name = substr(input($_POST['name']), 0, 100);
$text = substr(input($_POST['text']), 0, 3000);
$db->query("INSERT INTO `news`(`name`, `text`, `time`, `user_id`) VALUES('".$name."', '". $text ."', '". time() ."', '". $user['id']."')");
go('/news/');
}
$title = $lang->word('add_news');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('add_news'));
echo '<form action="/news/add_news/?act=create" method="post">
		<div class="menu">
			<b>'. $lang->word('name') .'</b>:<br/>
			<input name="name" type="text" /><br/>
			<b>'. $lang->word('message') .'</b>:<br/>
			<textarea name="text" rows="5" cols="26"></textarea><br/>
			<input name="create" type="submit" value="'. $lang->word('create') .'" /><br/>
		</div>
		</form>';
		
$tpl->div('block', NAV .'<a href="/news/">'. $lang->word('news') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>