TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

PHP MD5 Secure login script.

1 点作者 neinsun超过 13 年前

5 条评论

infinity超过 13 年前
In the verifier.php I see a problem here:<p><pre><code> $uid=$_COOKIE['uid']; $uname=$_COOKIE['uname']; $sql="SELECT * FROM users WHERE username='$uname'"; </code></pre> The $uname is set from the value of 'uname' in the $_COOKIE array, but I see no input validation here.<p>If I were an evil attacker, I could send arbitrary cookie data to the server, it would end up in the $_COOKIE superglobal. If I include some SQL code, ... All input is evil!<p>Later, in the welcome.php the $_COOKIE['uname'] is echoed without any escapes.
评论 #3096170 未加载
gregjor超过 13 年前
Use mysql_real_escape_string() instead of addslashes(). And the cookie contents can't be trusted. The usual way to do this is with a server-side session, but if a cookie is used the user id and name have to be protected; MD5 can be used to do that, too.
_ud4a超过 13 年前
why are you adding slashes to the password before converting it into md5? even if they have ' in the password the md5 would get rid of it when you use it in the query.
bornonthebull超过 13 年前
Please add some salt to your password.
adamjleonard超过 13 年前
DO NOT USE THIS CODE !