28 lines
1.0 KiB
PHP
Executable File
28 lines
1.0 KiB
PHP
Executable File
<?php
|
|
ini_set('display_errors', 0);
|
|
switch(@$_POST['act']) {
|
|
|
|
/* ----------------------------------------------------------------------
|
|
11.02.2023
|
|
Модерируем коментарии
|
|
---------------------------------------------------------------------- */
|
|
case 'moder':
|
|
//Проверяем права
|
|
$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");
|
|
|
|
if ($_POST['tip']=='good')
|
|
\DB::set("UPDATE `pages_comments` SET `status`=1 WHERE `id`=?", $_POST['id']);
|
|
else
|
|
\DB::set("DELETE FROM `pages_comments` WHERE `id`=?", $_POST['id']);
|
|
|
|
break;
|
|
default:
|
|
|
|
}
|
|
?>
|