Hi,
I'm using a login script and everything is working great. I have managed to customize it so far, but there is one thing I can't manage.
When a user clicks the login button, I would like the result to be a redirect to another page named client_area.htm.
Here is the code, I'm sure it's something really simple.
<%@ Language = "VBScript" %>
<%
Option Explicit
Dim cnnLogin
Dim rstLogin
Dim strUsername, strPassword
Dim strSQL
%>
<html>
<head><title>IO Edit Login Page</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body bgcolor="white">
<%
If Request.Form("action") <> "validate_login" Then
%>
<form action="login_db.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" name="login" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td align="right"></TD>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>
<%
Else
strSQL = "SELECT * FROM tblLoginInfo " _
& "WHERE username='" & Replace(Request.Form("login"), "'", "''") & "' " _
& "AND password='" & Replace(Request.Form("password"), "'", "''") & "';"
Set cnnLogin = Server.CreateObject("ADODB.Connection")
cnnLogin.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("IOlogin.mdb"))
Set rstLogin = cnnLogin.Execute(strSQL)
If Not rstLogin.EOF Then
%>
<p>
<strong>All the Good Stuff We Want to Hide</strong>
</p>
<%
Else
%>
<p>
<font size="4" face="arial,helvetica"><strong>
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="#" onClick="MM_goToURL('parent','login_db.asp');return document.MM_returnValue"login_db.asp">Try Again</a>
</p>
<%
'Response.End
End If
' Clean Up
rstLogin.Close
Set rstLogin = Nothing
cnnLogin.Close
Set cnnLogin = Nothing
End If
%>
</body>
</html>
I'm using a login script and everything is working great. I have managed to customize it so far, but there is one thing I can't manage.

When a user clicks the login button, I would like the result to be a redirect to another page named client_area.htm.
Here is the code, I'm sure it's something really simple.
<%@ Language = "VBScript" %>
<%
Option Explicit
Dim cnnLogin
Dim rstLogin
Dim strUsername, strPassword
Dim strSQL
%>
<html>
<head><title>IO Edit Login Page</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body bgcolor="white">
<%
If Request.Form("action") <> "validate_login" Then
%>
<form action="login_db.asp" method="post">
<input type="hidden" name="action" value="validate_login" />
<table border="0">
<tr>
<td align="right">Login:</td>
<td><input type="text" name="login" /></td>
</tr>
<tr>
<td align="right">Password:</td>
<td><input type="password" name="password" /></td>
</tr>
<tr>
<td align="right"></TD>
<td><input type="submit" VALUE="Login" /></td>
</tr>
</table>
</form>
<%
Else
strSQL = "SELECT * FROM tblLoginInfo " _
& "WHERE username='" & Replace(Request.Form("login"), "'", "''") & "' " _
& "AND password='" & Replace(Request.Form("password"), "'", "''") & "';"
Set cnnLogin = Server.CreateObject("ADODB.Connection")
cnnLogin.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("IOlogin.mdb"))
Set rstLogin = cnnLogin.Execute(strSQL)
If Not rstLogin.EOF Then
%>
<p>
<strong>All the Good Stuff We Want to Hide</strong>
</p>
<%
Else
%>
<p>
<font size="4" face="arial,helvetica"><strong>
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="#" onClick="MM_goToURL('parent','login_db.asp');return document.MM_returnValue"login_db.asp">Try Again</a>
</p>
<%
'Response.End
End If
' Clean Up
rstLogin.Close
Set rstLogin = Nothing
cnnLogin.Close
Set cnnLogin = Nothing
End If
%>
</body>
</html>
Comment