FireDesigner
Technical User
I am trying to make a portion of my site password protected. I went through the steps in Ultra Dev and created a database with a table of users in Access. I setup my conection without a DSN and used the connection string Driver={Microsoft Access Driver (*.mdb)};
DBQ=C:\decuments and settings\matt jl\desktop\framesite\newframes\users.mdb I then created an html document with a form with two text fields and a submit button. I then added the server behavior "log in user", which linked my two text fields to the table of users. I created a page that would open if a correct user and password were entered and a page for an error in the user and password. I saved my files and then tried to preview the document. When I entered the user and password values in the form and hit submit it gives me a page cannot be displayed error and up in the browser adress it diplays <%=MM_LoginAction%>. I searched through my documents in ultra dev and found that the <%=MM_LoginAction%> is the action given to the form. I tried all the previous steps multiple times but always the same problem.
Here is the code:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Certtest.asp" -->
<%
set Recordset2 = Server.CreateObject("ADODB.Recordset"
Recordset2.ActiveConnection = MM_Certtest_STRING
Recordset2.Source = "SELECT username, password FROM Table1"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open()
Recordset2_numRows = 0
%>
<%
' *** 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("textfield"
)
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="history.html"
MM_redirectLoginFailed="mission.html"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_Certtest_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 Table1 WHERE username='" & MM_valUsername &"' AND password='" & CStr(Request.Form("textfield2"
) & "'"
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
%>
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset"
;
Recordset1.ActiveConnection = MM_Cert_STRING;
Recordset1.Source = "SELECT ID, username, password FROM Table1";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 3;
Recordset1.LockType = 3;
Recordset1.Open();
var Recordset1_numRows = 0;
%>
<%
// *** Validate request to log in to this site.
var MM_LoginAction = Request.ServerVariables("URL"
;
if (Request.QueryString!=""
MM_LoginAction += "?" + Request.QueryString;
var MM_valUsername=String(Request.Form("textfield"
);
if (MM_valUsername != "undefined"
{
var MM_fldUserAuthorization="";
var MM_redirectLoginSuccess="file:///C|/Documents and Settings/Matt JL/Desktop/Frames site/NEWFRAMES/mission.html";
var MM_redirectLoginFailed="file:///C|/Documents and Settings/Matt JL/Desktop/Frames site/NEWFRAMES/history.html";
var MM_flag="ADODB.Recordset";
var MM_rsUser = Server.CreateObject(MM_flag);
MM_rsUser.ActiveConnection = MM_Cert_STRING;
MM_rsUser.Source = "SELECT username, password";
if (MM_fldUserAuthorization != ""
MM_rsUser.Source += "," + MM_fldUserAuthorization;
MM_rsUser.Source += " FROM Table1 WHERE username='" + MM_valUsername + "' AND password='" + String(Request.Form("textfield2"
) + "'";
MM_rsUser.CursorType = 0;
MM_rsUser.CursorLocation = 2;
MM_rsUser.LockType = 3;
MM_rsUser.Open();
if (!MM_rsUser.EOF || !MM_rsUser.BOF) {
// username and password match - this is a valid user
Session("MM_Username"
= MM_valUsername;
if (MM_fldUserAuthorization != ""
{
Session("MM_UserAuthorization"
= String(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value);
} else {
Session("MM_UserAuthorization"
= "";
}
if (String(Request.QueryString("accessdenied"
) != "undefined" && false) {
MM_redirectLoginSuccess = Request.QueryString("accessdenied"
;
}
MM_rsUser.Close();
Response.Redirect(MM_redirectLoginSuccess);
}
MM_rsUser.Close();
Response.Redirect(MM_redirectLoginFailed);
}
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="<%=MM_LoginAction%>">
<input type="text" name="textfield">
<input type="text" name="textfield2">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
<%
Recordset2.Close()
%>
<%
Recordset1.Close();
%>
DBQ=C:\decuments and settings\matt jl\desktop\framesite\newframes\users.mdb I then created an html document with a form with two text fields and a submit button. I then added the server behavior "log in user", which linked my two text fields to the table of users. I created a page that would open if a correct user and password were entered and a page for an error in the user and password. I saved my files and then tried to preview the document. When I entered the user and password values in the form and hit submit it gives me a page cannot be displayed error and up in the browser adress it diplays <%=MM_LoginAction%>. I searched through my documents in ultra dev and found that the <%=MM_LoginAction%> is the action given to the form. I tried all the previous steps multiple times but always the same problem.
Here is the code:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Certtest.asp" -->
<%
set Recordset2 = Server.CreateObject("ADODB.Recordset"
Recordset2.ActiveConnection = MM_Certtest_STRING
Recordset2.Source = "SELECT username, password FROM Table1"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 3
Recordset2.Open()
Recordset2_numRows = 0
%>
<%
' *** 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("textfield"
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="history.html"
MM_redirectLoginFailed="mission.html"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_Certtest_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 Table1 WHERE username='" & MM_valUsername &"' AND password='" & CStr(Request.Form("textfield2"
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"
If (MM_fldUserAuthorization <> ""
Session("MM_UserAuthorization"
Else
Session("MM_UserAuthorization"
End If
if CStr(Request.QueryString("accessdenied"
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
%>
<%
var Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_Cert_STRING;
Recordset1.Source = "SELECT ID, username, password FROM Table1";
Recordset1.CursorType = 0;
Recordset1.CursorLocation = 3;
Recordset1.LockType = 3;
Recordset1.Open();
var Recordset1_numRows = 0;
%>
<%
// *** Validate request to log in to this site.
var MM_LoginAction = Request.ServerVariables("URL"
if (Request.QueryString!=""
var MM_valUsername=String(Request.Form("textfield"
if (MM_valUsername != "undefined"
var MM_fldUserAuthorization="";
var MM_redirectLoginSuccess="file:///C|/Documents and Settings/Matt JL/Desktop/Frames site/NEWFRAMES/mission.html";
var MM_redirectLoginFailed="file:///C|/Documents and Settings/Matt JL/Desktop/Frames site/NEWFRAMES/history.html";
var MM_flag="ADODB.Recordset";
var MM_rsUser = Server.CreateObject(MM_flag);
MM_rsUser.ActiveConnection = MM_Cert_STRING;
MM_rsUser.Source = "SELECT username, password";
if (MM_fldUserAuthorization != ""
MM_rsUser.Source += " FROM Table1 WHERE username='" + MM_valUsername + "' AND password='" + String(Request.Form("textfield2"
MM_rsUser.CursorType = 0;
MM_rsUser.CursorLocation = 2;
MM_rsUser.LockType = 3;
MM_rsUser.Open();
if (!MM_rsUser.EOF || !MM_rsUser.BOF) {
// username and password match - this is a valid user
Session("MM_Username"
if (MM_fldUserAuthorization != ""
Session("MM_UserAuthorization"
} else {
Session("MM_UserAuthorization"
}
if (String(Request.QueryString("accessdenied"
MM_redirectLoginSuccess = Request.QueryString("accessdenied"
}
MM_rsUser.Close();
Response.Redirect(MM_redirectLoginSuccess);
}
MM_rsUser.Close();
Response.Redirect(MM_redirectLoginFailed);
}
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="<%=MM_LoginAction%>">
<input type="text" name="textfield">
<input type="text" name="textfield2">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
<%
Recordset2.Close()
%>
<%
Recordset1.Close();
%>