我想隱藏一個頁面的內容使用PHP,但總是得到一個錯誤 這是我正在使用的代碼。從$pass
數據來自從其他網頁submited形式:PHP頁面加載錯誤
<?php
$pass = $_POST['pass'];
$password = "content"; // Modify Password to suit for access, Max 10 Char.
?>
<html>
<title></title>
<head>
<?php
// If password is valid let the user get access
if ("$pass" == "$password") {
?>
<!-- START OF HIDDEN HTML - PLACE YOUR CONTENT HERE -->
</head>
<body>
You have gained access!
<!-- END OF HIDDEN HTML -->
<?php
} else {
// Wrong password or no password entered display this message
print "<p align=\"center\"><font color=\"red\"><b>Restricted Area!</b><br>Please enter from the log in page</font></p>";}
}
?>
</body>
</html>
什麼是錯誤? –
你會得到什麼錯誤?另外,你爲什麼將變量作爲字符串進行比較?爲什麼不直接比較它們呢? – David