md5的用法问题,大家教教我
我是用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生成的语句奇怪,不知加在哪,请看下代码然后教我怎么弄,谢谢大家了!