30 lines
1.2 KiB
PHP
Executable File
30 lines
1.2 KiB
PHP
Executable File
<?php
|
||
|
||
ini_set('display_errors', 0);
|
||
$dostup=0;
|
||
if ($_SESSION['dostup']=='a')$dostup=1;
|
||
//Получаем ид автора страницы по ид коментария
|
||
$page_id=\DB::getValue("SELECT `page_id` FROM `pages_comments` WHERE `id`=? LIMIT 1", $_POST['id']);
|
||
$user_id=\DB::getValue("SELECT `user_id` FROM `pages` WHERE `id`=? LIMIT 1", $page_id);
|
||
if($user_id==$_SESSION['user_id'])$dostup=1;
|
||
if ($dostup==0)die("403");
|
||
|
||
|
||
/* ----------------------------------------------------------------------
|
||
11.02.2023
|
||
Получаем коментарии
|
||
---------------------------------------------------------------------- */
|
||
|
||
$comments=\DB::getAll("SELECT * FROM `pages_comments` WHERE `page_id`=? AND `status`=0 ORDER BY `id` DESC LIMIT 10", $_GET['id']);
|
||
//Получаем инфу о пользователе - аву и фио
|
||
for ($i=0; $i<count($comments); $i++){
|
||
$user_info=\DB::getAll("SELECT `fio`, `ava` FROM `users` WHERE `id`=? LIMIT 1", $comments[$i]['user_id'] );
|
||
$comments[$i]['ava']=$user_info[0]['ava'];
|
||
$comments[$i]['fio']=$user_info[0]['fio'];
|
||
unset($user_info);
|
||
}
|
||
|
||
$smarty->assign('comments', $comments);
|
||
|
||
|
||
?>
|