I have this code lines in one page(login.asp)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/teste.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("textfield"
)
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="teste1.asp"
MM_redirectLoginFailed="invalidlog.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_teste_STRING
MM_rsUser.Source = "SELECT Colect, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM member WHERE Colect='" & Replace(MM_valUsername,"'","''"
&"' AND password='" & Replace(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 true 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
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<%=MM_LoginAction%>">
<label>username
<input type="text" name="textfield">
</label>
<br>
<label>password
<input type="text" name="textfield2">
<br>
<input type="submit" name="Submit" value="login">
</label>
</form>
<br>
</body>
</html>
when i get to the teste1.asp page i use request.querystring("textfield"
to make the SQL statement but i can't get the information passed from the first page.
Can you explain me how this works.
in this lines here i can understand that it's getting the value to assign to the URL from somewhere, but it doesn't work.
MM_LoginAction = Request.ServerVariables("URL"
If Request.QueryString <>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/teste.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("textfield"
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="teste1.asp"
MM_redirectLoginFailed="invalidlog.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_teste_STRING
MM_rsUser.Source = "SELECT Colect, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM member WHERE Colect='" & Replace(MM_valUsername,"'","''"
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
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<%=MM_LoginAction%>">
<label>username
<input type="text" name="textfield">
</label>
<br>
<label>password
<input type="text" name="textfield2">
<br>
<input type="submit" name="Submit" value="login">
</label>
</form>
<br>
</body>
</html>
when i get to the teste1.asp page i use request.querystring("textfield"
Can you explain me how this works.
in this lines here i can understand that it's getting the value to assign to the URL from somewhere, but it doesn't work.
MM_LoginAction = Request.ServerVariables("URL"
If Request.QueryString <>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString