-1

我已经研究了这么久,我已经这样做了数百次,但我现在忘记了。最简单的事情。如何在 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!";
}
}

?>
4

1 回答 1

3

您需要为提交按钮name="submit"提供 PHP 检测它的属性。此外,$pass="pass"应该是$pass == "pass".

于 2012-07-21T19:13:21.650 回答