Kat*_*lyn 0 php debugging login
此代码在浏览器中返回一个空白页面.你能发现任何错误吗?权限和网址已检查.phpcodechecker.com说它没关系
<?php
# Check for POST login data, else set initial values
if (isset($_POST["user"])) {
$user=$_POST['user'];
$pass=hash('sha256',$_POST['pass']);
}
else {
$user="";
$pass="";
}
# Check Login Data
#
# Password is hashed (SHA256). In this case it is 'admin'.
if($user == "admin"
&& $pass == "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918")
{
# Load content from local storage
include("../localstorage/content.html");
}
else
{
# Show login form. Request for username and password
echo
'<html>
<body>
<form method="POST" action="">
Username: <input type="text" name="user"><br/>
Password: <input type="password" name="pass"><br/>
<input type="submit" name="submit" value="Login">
</form>
</body>
</html>'
}
?>
Run Code Online (Sandbox Code Playgroud)
(我从http://www.canbike.org/information-technology/2014/02/05/php-simple-password-protection-with-session-timeout.html下载了它,我很清楚它缺乏安全性)
使用echo语句打印html代码如下.
echo '<html>
<body>
<form method="POST" action="">
Username: <input type="text" name="user"><br/>
Password: <input type="password" name="pass"><br/>
<input type="submit" name="submit" value="Login">
</form>
</body>
</html>';
Run Code Online (Sandbox Code Playgroud)
并删除PHP标签之间,在开始和结束时只使用外部的PHP标签.
| 归档时间: |
|
| 查看次数: |
143 次 |
| 最近记录: |