我正在制作一个需要登录管理页面的简单网络应用程序。我在 web.py 网站 ( http://webpy.org/cookbook/userauth )上遇到了这个咒语:
import hashlib
import web
def POST(self):
i = web.input()
authdb = sqlite3.connect('users.db')
pwdhash = hashlib.md5(i.password).hexdigest()
check = authdb.execute('select * from users where username=? and password=?', (i.username, pwdhash))
if check:
session.loggedin = True
session.username = i.username
raise web.seeother('/results')
else: return render.base("Those login details don't work.")
然而,该页面也给出了一个不祥的警告:“请勿在真实站点上使用此代码 - 这仅用于说明。”。我想知道这是否有任何重大漏洞,我对网络编程有点不熟悉,所以只是想确保使用此代码不会在不知不觉中使应用程序对微不足道的攻击向量开放?
非常感谢