【发布时间】:2012-07-20 15:52:30
【问题描述】:
我研究了这么久,我已经做了数百次了,但我现在忘记了。最简单的事情。如何在 PHP 中进行密码保护。请帮忙,当我点击提交时,什么都没有弹出。这是我的代码:
<html>
<style type="text/css">
#textbox1 {
text-shadow:2px 2px 3px #000000;
}
label {
text-shadow:2px 2px 3px #000000;
font-family:"Arial";
}
</style>
</style>
<script type="text/javascript">
function clearText(target){target.value= "";}
</script>
<head>
<center>
<form action="" method="POST">
<label face="Arial">Password: </label><input id="textbox1" type="password" name="password" value="" onfocus="clearText(this)">
<input id="button" type="submit" value="Login to Uploader">
</form>
</center>
</html>
<?php
$pass = $_POST['password'];
$submit = $_POST['submit'];
if (isset($_POST['submit'])) {
if ($pass == "pengsuploader123" || $pass="pass") {
echo "Test";
} else {
echo "Wrong!";
}
}
?>
【问题讨论】:
-
name=submit什么都没有,这就是为什么isset($_POST['submit'])===FALSE总是 -
你的 HTML 标记让我眼花缭乱。
标签: php forms passwords password-protection