require_once '../includes/functions.php'; $error = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $username = sanitizeInput($_POST['username']); $password = $_POST['password']; if (empty($username) || empty($password)) { $error = '请输入用户名和密码'; } else { $admin = validateAdmin($username, $password); if ($admin) { $_SESSION['admin_id'] = $admin['id']; $_SESSION['admin_username'] = $admin['username']; header('Location: ../index.php'); exit; } else { $error = '用户名或密码错误'; } } } ?> 管理员登录 - IP管理系统