@@ -197,15 +197,15 @@ $user = $stmt->fetch();
diff --git a/admin_login.php b/admin_login.php new file mode 100644 index 0000000..7812d16 --- /dev/null +++ b/admin_login.php @@ -0,0 +1,47 @@ +prepare("SELECT * FROM admin_users WHERE username = ?"); + $stmt->execute([$username]); + $admin = $stmt->fetch(); + + if ($admin && password_verify($password, $admin['password_hash'])) { + $_SESSION['admin_id'] = $admin['id']; + header('Location: /admin.php'); + exit; + } else { + $error = '用户名或密码错误'; + } +} +?> + + +
+ +