有人從wikihow使用此script?來自wikihow的安全登錄腳本
默認情況下,無論是在登錄和註冊頁面您重定向到「protected_page.php」受保護的頁面應該驗證與您的登錄:`
<?php
include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
sec_session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Secure Login: Protected Page</title>
<link rel="stylesheet" href="styles/main.css" />
</head>
<body>
<?php if (login_check($mysqli) == true) : ?>
<p>Welcome <?php echo htmlentities($_SESSION['username']); ?>!</p>
<p>
或
<?php else : ?>
<p>
<span class="error">You are not authorized to access this page.</span> Please <a href="index.php">login</a>.
</p>
<?php endif; ?>
問題是我總是得到錯誤消息,即使我的數據庫配置和註冊信息發送到數據庫,我甚至編輯了註冊表單添加更多的信息沒有任何問題在數據庫端,但我仍然總是得到這個錯誤msg當試圖登錄該網站時。有人有這個問題嗎?
請問您能告訴我們您收到了哪些錯誤信息嗎? –
「您無權訪問此頁面」 – user3144965
您確定名稱和密碼是corect?嘗試在HTML下面打印'$ _SESSION'。像這樣:'
'。對POST也做同樣的事情,看看是否正在發送登錄細節。 –