Forums

This topic is locked

Need help with Dreamweaver Login behavior and MD5

Posted 03 Dec 2004 22:20:31
1
has voted
03 Dec 2004 22:20:31 Robert Loverin posted:
I'm using a the DW Login behavoir to interface with a SQL database. The passwords in this database are stored in MD5. Can anyone give me some ideas about how to adapt my code to make this work? Here's the code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/connect.asp" -->

<%
' *** Validate request to log in to this site.

MM_LoginAction = Request.ServerVariables("URL"
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?"
+ Request.QueryString
MM_valUsername=CStr(Request.Form("email")
If MM_valUsername <> "" Then
MM_fldDynamicRedirect="user_redirect"
MM_fldUserAuthorization=""
MM_redirectLoginSuccessDynamic=""
MM_redirectLoginFailed="rdlog.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_status_STRING
MM_rsUser.Source = "SELECT username, user_password"
If MM_fldDynamicRedirect <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldDynamicRedirect
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM tablehere WHERE username='" & Replace(MM_valUsername,"'","''" &"' AND user_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)
ElseIf (MM_fldDynamicRedirect <> "" Then
MM_redirectLoginSuccessDynamic =
CStr(MM_rsUser.Fields.Item(MM_fldDynamicRedirect).Value)
Else
Session("MM_UserAuthorization" = ""
End If
if CStr(Request.QueryString("accessdenied") <> "" And false Then
MM_redirectLoginSuccessDynamic =
Request.QueryString("accessdenied"
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccessDynamic)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Welcome to qteams.net</title> <style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-color: #E7E7E7;
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css">


</head>

<body>
<table width="740" height="75" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/ibanner.gif" width="740" height="75" border="0"></td>
</tr>
</table>
<table width="740" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" colspan="3"><img src="images/lbread.gif" width="740" height="20"></td>
</tr>
</table>
<table width="740" height="350" border="0" cellpadding="1" cellspacing="0" class="tableback">
<tr>
<td width="245" valign="top" background="images/w1.jpg" class="tdborder"><h4 align="center"> </h4>
</td>
<td width="245" valign="top" background="images/w2.jpg" class="tdborder"><h4 align="center">Welcome!</h4>
<h5 align="center">Please Log In</h5>
<form ACTION="<%=MM_LoginAction%>" method="POST" name="login" id="login">
<p>
<strong>User Name :</strong>
<input name="email" type="text" id="email">
</p>
<p>
<strong>Password:</strong>
<input name="password" type="text" id="password">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form> <p align="center">  </p>
<p align="left">  </p>
</td>
<td width="245" valign="top" background="images/w3.jpg"><h5 align="center"> </h5>
<p align="center">
<em><br>
</em></p>
</td>
</tr>
</table>
</body>
</html>

Thanks for any help!!!

Reply to this topic