Forums

ASP

This topic is locked

User authentication asp & ms sql 2008

Posted 29 May 2009 17:13:35
1
has voted
29 May 2009 17:13:35 sofie sof posted:
Hello,
For the last few years we have been using the same script / user authentication form in dreamweaver.
Now for the first time we use a ms sql 2008 database instead of ms sql 2005 and the script does not work anymore.
I checked discussion google discussion groups and connectionstrings.com , seams i have to add something like Trusted_Connection=True.
Can anyone help me out here please. Scipt :

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/conn_usa.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_conn_usa_STRING
Recordset1.Source = "SELECT * FROM dbo.tb_login"
Recordset1.CursorType = 3
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
' *** 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("User")
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="../databeheer/index.asp"
MM_redirectLoginFailed="index.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_conn_usa_STRING
MM_rsUser.Source = "SELECT user, wachtwoord"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.tb_login WHERE user='" & Replace(MM_valUsername,"'","''" &"' AND wachtwoord='" & Replace(Request.Form("Wachtwoord","'","''" & "'"
MM_rsUser.CursorType = 3
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 XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../stijl/databeheer.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="800" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td bgcolor="#F0F0F0">&nbsp;</td>
</tr>
<tr>
<td><table width="600" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td>Naam : </td>
<td><label>
<input name="User" type="text" id="User" />
</label></td>
</tr>
<tr>
<td>Wachtwoord : </td>
<td><label>
<input name="Wachtwoord" type="password" id="Wachtwoord" />
</label></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><label>
<input type="submit" name="Submit" value="Check" />
</label></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#F0F0F0"><a href="www.travel2usa.be">Terug naar www.travel2usa.be </a></td>
</tr>
</table>
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

Reply to this topic