Файл: adm_panel/avatar_del.php
Строк: 105
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/adm_check.php';
include_once '../sys/inc/user.php';
user_access('ava_dell', null, '/');
adm_check();
if (isset($_GET['id'])) {
$ank['id'] = intval($_GET['id']);
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = '{$ank['id']}' LIMIT 1"), 0) == 0) {
exit(header("Location: /"));
}
$ank = get_user($ank['id']);
if ($user['group_access'] < $ank['group_access'] and user_access('dell_avatar')) {
$_SESSION['message'] = lang('Не хватает прав');
exit(header("Location: /"));
}
if ($user['id'] == $ank['id']) {
$_SESSION['message'] = lang('Свои аватары удалять нельзя');
exit(header("Location: /"));
}
if (!is_file(H . 'files/avatars/' . $ank['id'] . '.png')) {
$_SESSION['message'] = lang('У пользователя не установлен аватар');
exit(header("Location: /"));
}
$set['title'] = lang('Удаление аватара');
include_once '../sys/inc/thead.php';
title();
aut();
#блокировка статуса
if (isset($_POST['delete_avatar'])) {
$msg = my_esc($_POST['prich']);
if (strlen2($msg) < 3) {
$_SESSION['message'] = lang('Нужно указать причину подробнее ');
exit(header("Location: " . APANEL . "/avatar_del.php?id=" . $ank['id']));
}
if (isset($_POST['avtor'])) {
$av = ($_POST['avtor'] == 1 ? ' Модератор [url=/' . $user['mylink'] . ']' . $user['nick'] . '[/url]' : false);
} else {
$av = null;
}
$text = 'Ваш Аватар Удален! Причина удаления : ' . $msg . $av;
mail_send(0, $ank['id'], $text);
$_SESSION['message'] = lang('Автар Удален');
@unlink(H . "files/avatars/{$ank['id']}.png");
$_SESSION['message'] = lang('Аватар удален');
exit(header("Location: /id" . $ank['id']));
}
echo "<center><div class='list-group-item'>";
avatar($ank['id'], 200, 200);
echo "</div></center>";
echo "<form action='' class='list-group-item' method='post'>";
echo lang('Причина') . " <textarea name='prich' class='form-control'></textarea>";
echo "<label class='c-input c-checkbox'><input type='checkbox' name='avtor' value='1' /><span class='c-indicator'></span> " . lang('Указать кто удалил') . "</label><br/>";
echo "<button class='btn btn-success' name='delete_avatar' type='submit'>" . lang('Удалить Аватар') . "</button> ";
echo "<a class='btn btn-secondary' href='/{$ank['mylink']}'>" . lang('Отмена') . "</a>";
echo "</form>";
echo "<div class='list-group-item'><a href='" . APANEL . "/'><span class='fa fa-arrow-left'></span> Панель управления</a></div>";
include_once '../sys/inc/tfoot.php';