【发布时间】:2018-06-17 08:42:24
【问题描述】:
我有一个受密码保护的网页,只有一个密码。但是,我想在那个网页上使用多个密码......我对 PHP 很陌生...... 那么,谁能给我一些关于如何做到这一点的建议! 提前致谢! 这是我正在使用的代码:
<?php
$password = "anything";
?>
在该代码上,我想同时使用“anything”并同时使用“mypass”作为密码! 我只是使用此代码来乘以通行证。但是,行不通!
<?php
$password = "anything" + "mypass";
?>
&完整代码为:
<?php
if (isset($_POST["password"]) && ($_POST["password"]=="$password")) {
?>
### anything to hide before password given!
<?php
}
else
{
if (isset($_POST['password']) || $password == "") {
print "<p align=\"center\"><font color=\"red\"><b>Wrong Password !!!</b><br>Please enter the correct Password</font></p>";}
print "<form method=\"post\"><p align=\"center\"><b>Please enter the Password</b><br/><br/>";
print "<b>Password </b><input class=\"box\" name=\"password\" type=\"password\" maxlength=\"10\"><input class=\"button\" value=\"Download\" type=\"submit\"></p></form>";
}
?>
【问题讨论】:
-
那个网页上有多个密码是什么意思?就目前而言,您的问题尚不清楚
-
最好使用现有的login framework/library 或查找php认证教程
-
在该代码上,我想使用“anything”并同时使用“mypass”作为密码!我只是使用此代码来乘以通行证。但是,行不通!
-
使用数组,然后检查密码是否存在于数组中。
-
不工作! #Qirel
标签: php