feat: 实现管理员权限系统并本地化sweetalert资源
- 添加管理员权限系统,支持all/say/review三种权限类型 - 为各管理页面添加权限检查逻辑 - 将sweetalert从CDN改为本地资源 - 添加统一的登出确认弹窗和logout.php处理 - 更新config.php中的数据库和SMTP配置
This commit is contained in:
28
admin/logout.php
Normal file
28
admin/logout.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require_once '../config.php';
|
||||
|
||||
session_start();
|
||||
// 销毁所有会话变量
|
||||
$_SESSION = [];
|
||||
|
||||
// 如果使用了基于cookie的会话,也需要删除cookie
|
||||
if (ini_get("session.use_cookies")) {
|
||||
$params = session_get_cookie_params();
|
||||
setcookie(
|
||||
session_name(),
|
||||
'',
|
||||
time() - 42000,
|
||||
$params["path"],
|
||||
$params["domain"],
|
||||
$params["secure"],
|
||||
$params["httponly"]
|
||||
);
|
||||
}
|
||||
|
||||
// 销毁会话
|
||||
session_destroy();
|
||||
|
||||
// 使用Sweet Alert弹窗提示并跳转登录页
|
||||
echo '<script src="/js/sweetalert.js"></script>';
|
||||
echo '<script>Swal.fire({title: "登出成功", text: "您已安全登出系统", icon: "success", timer: 1500, showConfirmButton: false}).then(() => { window.location.href = "login.php"; });</script>';
|
||||
exit();
|
||||
Reference in New Issue
Block a user