我正在寻找一个PHP脚本,所以我的整个网站需要密码才能访问。我不想要一个sql数据库,我只想让一个凭证的用户在一个变量中设置。php登录脚本,只有一个用户设置在一个变量
我
的config.php
<?php
$secured = false;
$username = "user"; // Set manually by editing config
$password = "pass"; //Set manually by editing config
?>
那么index.html
<form action="auth.php" method="post">
Username: <input type='text' name="user" value='' />
Password: <input type='password' name="password" value='' />
<input type='submit' value='Log in' />
</form>
然后auth.php(这是我需要的编码)
<?php
require once "config.php"
If $secured = false the redirect to page1.html
//所以如果它的false不需要的话在现场任何地方进行认证。
If $secured = true then ask for username and password.
If wrong display error message.
If right redirect to page1.html
?>
这就是我想要实现的。然后,我还需要将登录信息存储为会话变量,以便记住您登录并检查每个登录的页面,然后终止注销。所以一个我可以坚持到某个地方的按钮就可以完成这项工作。希望这一切都有道理。
问题:auth.php脚本是怎么样的?
感谢
但是,什么是你的问题? – 2011-05-28 22:01:48
这不是一个“请让我做脚本”的网站! – 2011-05-29 14:58:57
然后去回答另一个问题! – Michael 2011-05-29 20:25:25