Вход Регистрация
Файл: backup/info/komm.php
Строк: 65
<?
require_once('../core/start.php');
$inf core::$dbs->queryFetch("SELECT * FROM `info` WHERE `id` = ? LIMIT 1",array($id));
if(empty(
$inf['id'])){
header('location:/');
die();
}
$title $inf['name'].' / Комментарии';
require_once(
root.'core/header.php');
echo 
'<div class="wizart"><a href="/info/view/'.$id.'">'.$inf['name'].'</a> / Комментарии</div>';
func::head_menu();
if(isset(
$user['id'])){
if(isset(
$_GET['del'])){
$uid func::num($_GET['uid']);
if(
$user['level']<1){
header('location:/');
die();
}
core::$dbs->query("DELETE FROM `info_komm` where `id` = ? limit 1",array($uid));
header('location: /info/komm/'.$id);
die();
}
if(isset(
$_POST['ok'])){
$text func::check($_POST['text']);
if(empty(
$text)){
func::error('Сообщение не введено!');
} else {
core::$dbs->query("INSERT INTO `info_komm` SET `user_id` = ?, `text` = ?, `time` = ?, `id_info` = ?",array($user['id'],$text,time(),$id));
header('location: /info/komm/'.$id);
die();
}
}
if(isset(
$_GET['uid'])){
$uid abs(intval($_GET['uid']));
if(!
func::user_inf($uid)){
func::error('Нет такого пользователя!');
func::footer_menu();
require_once(
root.'core/footer.php');
exit();
}
$otv func::user_inf($uid'login').', ';
} else
$otv '';
echo 
'<form action="/info/komm/'.$id.'" method="post">Сообщение:<br/><textarea rows="3" cols="20" name="text">'.$otv.'</textarea><br/><input type="submit" name="ok" value="Написать"/></form>';
}
$total core::$dbs->querySingle("SELECT count(id) FROM `info_komm` where `id_info` = ?",array($id));
func::nav($total,$num);
$q core::$dbs->query("SELECT * FROM `info_komm` where `id_info` = ? order by `time` desc limit $start,$num",array($id));
if(
$total==0){
func::error('Сообщений нет!');
}
while(
$a $q->fetch()){
echo 
'<div class="main">'.($user['level']>='[<a href="/info/komm/'.$id.'/'.$a['id'].'?del">del</a>]':NULL).' '.func::nick($a['user_id']).': ('.func::times($a['time']).')<br/>'.func::out($a['text']).' '.(isset($user['id']) ? '[<a href="/info/komm/'.$id.'/'.$a['user_id'].'?otv">отв</a>]':NULL).'</div>';
}
func::navig('/info/komm/'.$id.'?');
func::footer_menu();
require_once(
root.'core/footer.php');
?>
Онлайн: 2
Реклама