lylme_spage/include/go.php

54 lines
1.5 KiB
PHP
Raw Normal View History

2022-05-21 05:45:07 +08:00
<?php
2023-12-16 17:20:06 +08:00
if(!empty($_GET['url'])) {
2022-06-12 02:24:05 +08:00
$url = $_GET['url'];
header("Location:$url");
exit();
}
2022-05-21 05:45:07 +08:00
include("common.php");
session_start(); //设置session
2023-12-16 17:20:06 +08:00
if($_POST['exit'] == 'exit') {
2022-05-21 17:40:40 +08:00
//注销登录
2023-12-16 17:20:06 +08:00
$_SESSION['pass'] = null;
$_SESSION['list'] = array();
header("Location: " . $_SERVER['HTTP_REFERER']);
exit('注销登录成功');
2022-05-21 05:45:07 +08:00
}
2024-05-06 00:37:40 +08:00
$pass = isset($_POST['pass']) ? daddslashes($_POST['pass']) : '';
2023-12-16 17:20:06 +08:00
if($_SESSION['pass'] != 1) {
2022-05-21 05:45:07 +08:00
//未登录
2023-12-16 17:20:06 +08:00
if(!empty($pass)) {
2022-05-21 05:45:07 +08:00
//用户提交登录
$show = array();
2023-12-16 17:20:06 +08:00
$pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '" . $pass . "';");
while ($pwd = $DB->fetch($pwds)) {
array_push($show, $pwd['pwd_id']);
}
if(empty($show)) {
//无数据
exit('<script>alert("密码错误!");window.location.href="' . $_SERVER['HTTP_REFERER'] . '";</script>');
} else {
//有数据
$_SESSION['list'] = $show;
$_SESSION['pass'] = 1;
}
2022-05-21 05:45:07 +08:00
}
2023-12-16 17:20:06 +08:00
} else {
2022-05-21 05:45:07 +08:00
//已登录
2023-12-16 17:20:06 +08:00
if(!empty($pass)) {
2022-05-21 05:45:07 +08:00
$show = array();
2023-12-16 17:20:06 +08:00
$pwds = $DB->query("SELECT `pwd_id`, `pwd_key` FROM `lylme_pwd` WHERE `pwd_key` LIKE '" . $pass . "';");
while ($pwd = $DB->fetch($pwds)) {
array_push($show, $pwd['pwd_id']);
}
if(empty($show)) {
$_SESSION['pass'] = null;
2022-05-21 05:45:07 +08:00
$_SESSION['list'] = array();
2023-12-16 17:20:06 +08:00
}
2022-05-21 05:45:07 +08:00
}
}
2023-12-16 17:20:06 +08:00
if(basename($_SERVER['PHP_SELF']) != basename(__FILE__)) {
return;
}
header("Location: ../");