Просмотр файла modules/forum/edit_forum.php

Размер файла: 1.36Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_forum';
if($user['level'] < '6' || !isset($_GET['f_id'])) { go('/'); }
if($db->query("SELECT * FROM `forum` WHERE `id` = '".abs(intval($_GET['f_id']))."'")->rowCount() == 0) {
go('/forum/');
}
$edit_cat = $db->query("SELECT * FROM `forum` WHERE `id` = '".abs(intval($_GET['f_id']))."'")->fetch();
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$name = substr(input($_POST['name']), 0, 45);

$db->query("UPDATE `forum` SET `name` = '". $name ."' WHERE `id` = '".abs(intval($_GET['f_id']))."'");
go('/forum/');
// print_r($db->errorInfo());
}
$title = $lang->word('edit');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit'));
echo '<form action="/forum/edit_forum/'.abs(intval($_GET['f_id'])).'/?act=edit" method="post">
		<div class="menu">
			<b>'. $lang->word('name') .'</b>:<br/>
			<input typr="text" name="name" value="'. $edit_cat['name'] .'" /><br/>
			<input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
		</div>
		</form>';
		
$tpl->div('block', NAV .'<a href="/forum/">'. $lang->word('forum') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>