我爲使用PHP的網站創建登錄名,但是當我嘗試登錄時,我總是得到相同的錯誤「您忘記輸入密碼了。」如果用戶忘記輸入密碼,則包括一個錯誤,但是我一直在輸入密碼。任何幫助將不勝感激。PHP密碼驗證錯誤
的PHP:
//check for a password and a match against the confirmed password:
if (empty($_POST['pass1']))
{
if($_POST['pass1'] != $_POST['pass2'])
{
$errors[] = 'Your passwords did not match.';
}
else
{
$p = trim($_POST['pass1']);
}
}
else
{
$errors[] = 'Your forgot to enter your password.';
}
if (empty($errors)) //if everything is okay
{
//register the user in the database
require_once
('../mysqli_connect.php'); //connect to the DB
HTML表單:
<p>Password: <input type="password" name="pass1" size="15" maxlength="20"/>*</p>
<p>Confirm Password: <input type="password" name="pass2" size="15" maxlength="20"/>*</p>
預先感謝!
它應該是'如果(!空($ _ POST [ 'PASS1']))' 。 – JJJ 2012-03-25 13:27:31