关于MD5加密密码 网页制作高手进!!急急急

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:08:52
下面是原来的代码
<!--#include file="conn.asp"-->
<!--#include file="top.asp"-->
<%
if request("action")="chk" then
dim username,userpassword
username=checkstr(trim(request.form("username")))
userpassword=checkstr(trim(request.form("userpassword")))
if username="" or userpassword="" then
call mb("请输入帐号或密码!","",0)
end if

set rs=server.createobject("adodb.recordset")
sql="select * from dv_user where username='"&username&"'"
rs.open sql,conn,1,3

if rs.bof and rs.eof then
call mb("对不起,您的帐号或密码有错误!","",0)
elseif rs("userpassword")<>userpassword then
call mb("对不起,您的帐号或密码有错误!","",0)
else
rs("logins")=rs("logins")+1
rs.update
session

看看你的md5文件里面的的调用说明!!MD5文件都是不一样的!调用的方法也是不一样的!!如 md5(userpassword,16) md5(userpassword,long)等

1.先在前面加个<!--#include file="md5.asp"--> ,当然你要有md5.asp这个文件,没有的话给你一个:http://mblog.137.tofor.com/01/md5.rar
2.如下代码:
elseif rs("userpassword")<>userpassword then
call mb("对不起,您的帐号或密码有错误!","",0)
加上md5,修改为:
elseif rs("userpassword")<>md5(userpassword) then
call mb("对不起,您的密码有错误!","",0)

试试看能不能成功?

1,先把用户注册的帐号中的密码通过MD5函数加密后,在保存进 数据库。
2,登录的时候,先把登录密码用MD5函数转换后,在和数据库里的字符比较,这就是常用的加密方法啦,
至于MD5函数,你可而已参照楼上的朋友给的信息,也可以在baidu上搜索

具体请看ASP 关于使用MD5函数加密的方法示例和说明