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

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

$db->query("UPDATE `forum_c` SET `name` = '". $name ."', `desc` = '$desc' WHERE `id` = '".abs(intval($_GET['cat_id']))."'");
go('/forum/cat/'.abs(intval($_GET['cat_id'])).'/');
// 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_cat/'.abs(intval($_GET['cat_id'])).'/?act=edit" method="post">
		<div class="menu">
			<b>'. $lang->word('name') .'</b>:<br/>
			<input typr="text" name="name" value="'. $edit_cat['name'] .'" /><br/>
			<b>'. $lang->word('desc') .'</b>:<br/>
			<input typr="text" name="desc" value="'. $edit_cat['desc'] .'" /><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');
?>