求助,VB调用MD5
我有一VB写的DLL供网站调用.网站注册登陆密码需要MD5加密.大侠们帮帮忙 俺一小白..感激不尽.代码如下Rem 注冊
Public Sub doReg()
On Error GoTo ErrHandle
Dim sStr, sUserId, sPassword, sPassword2, sSupterPassword, sSex
Dim sUserName, sEmail, sQQ, sMSN, sValidCode, sIP, sAdUserNum, sAdIp
sUserId = ChkSql(Request.Form("Userid"))
sPassword = ChkSql(Request.Form("Password"))
sPassword2 = ChkSql(Request.Form("passwd"))
sEmail = ChkSql(Request.Form("email"))
sSex = ChkSql(Request.Form("sex"))
sUserName = ChkSql(Request.Form("username"))
sQQ = ChkSql(Request.Form("qq"))
sMSN = ChkSql(Request.Form("msn"))
sIP = getIP
sValidCode = Request.Form("verifycode")
If Session("ValidCode") <> sValidCode Then
Response.Write cHtml.ShowAlter("驗証碼錯誤!", 2)
Exit Sub
End If
sAdUserNum = Session("AdUserNum")
sAdIp = Session("AdIp")
If Len(sAdUserNum) = 0 Or Len(sAdIp) = 0 Then
sAdUserNum = 0
sAdIp = 1
End If
sStr = "@UserName|200|1|20|" & sUserName & "~~"
sStr = sStr & "@UserID|200|1|20|" & sUserId & "~~"
sStr = sStr & "@UserPass|200|1|20|" & sPassword & "~~"
sStr = sStr & "@UserPass2|200|1|20|" & sPassword2 & "~~"
sStr = sStr & "@Email|200|1|20|" & sEmail & "~~"
sStr = sStr & "@Sex|200|1|20|" & sSex & "~~"
sStr = sStr & "@QQ|200|1|20|" & sQQ & "~~"
sStr = sStr & "@MSN|200|1|20|" & sMSN & "~~"
sStr = sStr & "@IP|200|1|20|" & sIP & "~~"
sStr = sStr & "@ADUserNum|20|1|8|" & sAdUserNum & "~~"
sStr = sStr & "@ADIP|200|1|20|" & sAdIp
Select Case cDataBase.ExecuteProc("Web_Register", sStr)
Case 0:
Response.Write cHtml.ShowAlter("注冊成功\n Θ !", 2)
Case 1:
Response.Write cHtml.ShowAlter("帳號已存在\nID !", 2)
Case 2:
Response.Write cHtml.ShowAlter("帳號已存在\nID !", 2)
Case 3:
Response.Write cHtml.ShowAlter("未知原因,注冊失敗\n , 毖!", 2)
End Select
cDataBase.CloseConn
Exit Sub
ErrHandle:
Response.Write Err.Description
End Sub
登陆
Public Sub doLogin()
On Error GoTo ErrHandle
Dim rs, sUserId, sUserNum, sUserName, sQQ, sEmail, sMSN
Dim sSex, sPoint, sMoney, sChanged, sPassword, sUserType
sUserId = ChkSql(Request.Form("Userid"))
sPassword = ChkSql(Request.Form("Password"))
Set rs = cDataBase.RecordSet("Select * from RanUser.dbo.FullUserInfo a,RanUser.dbo.UserInfo b,RanGame1.dbo.Web_Userinfo c" & _
" Where a.UserId='" & sUserId & _
"' And a.UserPass ='" & sPassword & "' And a.UserId = b.UserId and b.UserNum=c.UserNum")
If rs.BOF Or rs.EOF Then
Response.Write cHtml.ShowAlter("用戶名或密碼錯誤!", 2)
cDataBase.CloseConn
Exit Sub
End If
sUserId = rs("UserId")
sUserNum = rs("UserNum")
sUserName = rs("UserName")
sQQ = rs("QQ")
sEmail = rs("Email")
sMSN = rs("MSN")
sSex = rs("Sex")
sPoint = rs("Point")
sMoney = rs("Money")
sChanged = rs("Changed")
sUserType = rs("UserType")