md5的用法问题,大家教教我

wangqijyl 2006-03-21 02:06:35
我是用Dreamweaver作的。
代码见下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="md5.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL"
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("username")
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="login_ok.asp"
MM_redirectLoginFailed="login_bad.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_conn_STRING
MM_rsUser.Source = "SELECT username, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.Login_User WHERE username='" & Replace(MM_valUsername,"'","''" &"' AND password='" & Replace(Request.Form("password","'","''" & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username" = MM_valUsername
If (MM_fldUserAuthorization <> "" Then
Session("MM_UserAuthorization" = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization" = ""
End If
if CStr(Request.QueryString("accessdenied") <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied"
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<form ACTION="<%=MM_LoginAction%>" METHOD="POST" name="form1">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" bgcolor="#00FFFF"> 用户帐号:<input name="username" type="text" id="username"></td>
</tr>
<tr>
<td height="30" bgcolor="#00FFFF"> 用户密码:<input name="password" type="text" id="password"></td>
</tr>
<tr>
<td height="50" align="center" bgcolor="#CCCCCC"><input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit" value="重置"></td>
</tr>
</table>
</form>
</body>
</html>

Dreamweaver生成的语句奇怪,不知加在哪,请看下代码然后教我怎么弄,谢谢大家了!
...全文
58 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nhr 2006-03-21
  • 打赏
  • 举报
回复
汗一个,刚在蓝色论坛也看到你的帖子。
你就用
<!--#include file="md5.asp" -->
<%
xxx=md5(xxx) '这样生成的是16位的
xxx=md5("xxx",32)'这样生成的是32位的
%>
  • 打赏
  • 举报
回复
md5(str)

然后返回的是 经过加密后的字符串
孟子E章 2006-03-21
  • 打赏
  • 举报
回复
MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.Login_User WHERE username='" & Replace(MM_valUsername,"'","''" &"' AND password='" & MD5(Request.Form("password")) & "'"

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧