mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
39 lines
752 B
PHP
39 lines
752 B
PHP
<?php
|
|
if (!defined('IN_PONEPASTE')) {
|
|
die('This file may not be accessed directly.');
|
|
}
|
|
|
|
require_once('../includes/common.php');
|
|
|
|
use PonePaste\Models\AdminLog;
|
|
use PonePaste\Models\User;
|
|
|
|
function updateAdminHistory(User $admin, int $action) {
|
|
$log = new AdminLog([
|
|
'user_id' => $admin->id,
|
|
'action' => $action,
|
|
'ip' => $_SERVER['REMOTE_ADDR']
|
|
]);
|
|
|
|
$log->save();
|
|
}
|
|
|
|
if ($current_user === null || !$current_user->admin) {
|
|
header('Location: ..');
|
|
die();
|
|
}
|
|
|
|
if (!isset($_SESSION['admin_login'])) {
|
|
header('Location: .');
|
|
exit();
|
|
}
|
|
|
|
if (isset($_GET['logout'])) {
|
|
if (isset($_SESSION['login']))
|
|
unset($_SESSION['login']);
|
|
|
|
session_destroy();
|
|
header("Location: .");
|
|
exit();
|
|
}
|
|
|