Файл: public_html/modules/library/edit_cat.php
Строк: 24
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.net *
* ------------------------------- *
* @package: PerfCMS Ultra *
* @year: 2013 *
* @author: wanya26ua & Tesla *
* @link: http://perfclub.ru *
**********************************/
$locate = 'in_library';
if($user['level'] < '5') { go('/'); }
if(isset($_GET['id'])) {
$id = cget($_GET['id']);
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$title = substr(input($_POST['title']), 0, 100);
$db->query("UPDATE `library_cats` SET `title` = '".$title."' WHERE `id` = '".$id."'");
// print_r($db->errorInfo());
go('/library/');
}
$title = $lang->word('edit_cat');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit_cat'));
$cat_sql = $db->query("SELECT * FROM `library_cats` WHERE `id` = '".$id."'")->fetch();
echo '<form action="/library/edit_cat/?act=edit&id='.$id.'" method="post">
<div class="menu">
<b>'. $lang->word('name') .'</b>:<br/>
<input name="title" type="text" value="'. $cat_sql['title'] .'" /><br/>
<input name="edit" type="submit" value="'. $lang->word('save') .'" /><br/>
</div>
</form>';
$tpl->div('block', NAV .'<a href="/library/">'. $lang->word('library') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
} else { go('/library/'); }
?>