doowle
09-09-2002, 02:57 AM
Hi,
Hope you can help me. I have an app that starts out with aspen.asp which just contains an iframe aspen01.asp. On this page, the user logs in and if authenticated moves on to aspen02.asp. If not authenticated, error messagebox pops up and user can try again. This was working fine.
I had to add a javascript function in the middle of my asp authentication code to open aspen02.asp full screen though, and this is where I ran into trouble. The first time it runs it always runs fine. If user fails to authenticate, throws error messagebox. If user successfully authenticates, it opens aspen02.asp fullscreen.
But when the window launches fullscreen, it still leaves the original login window open underneath. I wouldn't care, except that if someone logs in, gets to aspen02.asp does their stuff and logs out, if someone tries to reuse that original login window that was left underneath and fails to authenticate, although it throws the error messagebox, it also launches aspen02.asp again -- regardless of whether user authentication was successful or not --.
Please help! I have been at this all weekend, and my boss wants it in the morning. I am panicking now...
I am guessing it has to do with the if not rs.eof part, but nothing I have tried to resolve it is fixing the problem *sob*
This is my sourcecode for aspen01.asp (aspen.asp contains nothing but the iframe tag for aspen01.asp):
<!--#include file="source/include/common.asp" -->
<%
If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" Then
' declare variables
intMEPS = Request("cboMEPS")
strProctor = Trim(Request("txtProctor"))
strPassword = Trim(Request("txtPassword"))
' check to ensure the supplied authentication information is valid
strSQL = "SELECT * " & _
"FROM tblProctor " & _
"WHERE LastName = '" & formatString(strProctor, 1) & "' " & _
"AND Password = '" & formatString(strPassword, 1) & "' " & _
"AND Deleted = 'N'"
Set rs = objConn.Execute(strSQL)
' if it is retrieve and store pertinent information into the users session
If Not rs.EOF Then
Session.Timeout = 120
Session("PID") = rs("PID")
Session("ProctorName") = rs("FirstName") & " " & rs("LastName")
intLogins = rs("Logins") + 1
strSQL = "SELECT * " & _
"FROM tblMEPS " & _
"WHERE MID = " & intMEPS & ""
Set rs = objConn.Execute(strSQL)
Session("MID") = intMEPS
Session("MEPSName") = rs("Name")
'store last login information, update logins
strSQL = "UPDATE tblProctor " & _
"SET LastLogin = '" & Now() & "', " & _
"Logins = " & intLogins & " " & _
"WHERE LastName = '" & formatString(strProctor, 1) & "' " & _
"AND Password = '" & formatString(strPassword, 1) & "'"
Set cmd = objConn.Execute(strSQL)
Set cmd = Nothing
%>
<script language="JavaScript">
window.open('aspen02.asp', '', 'fullscreen=yes, scrollbars=auto')
</script>
<%
Else
' return an error if the user information was not found or not valid
Call returnError("User information not found...", 1)
%>
<script language="JavaScript">
window.location.reload()
</script>
<%
End If
End If
' retrieve the list of MEPS to populate the drop menu
strSQL = "SELECT * " & _
"FROM tblMEPS " & _
"ORDER BY Name"
Set rs = objConn.Execute(strSQL)
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><%=Application("Title")%></title>
<link rel="stylesheet" href="source/style/default.css" type="text/css">
<script LANGUAGE="JavaScript">
// function used to handle a variety of actions
function handleAction(strAction)
{
// used when the submit button has been clicked
if(strAction == 'validateForm')
{
// ensure all required fields were satisfied
if(document.frm.cboMEPS.value != ''
&& document.frm.txtProctor.value != ''
&& document.frm.txtPassword.value != '')
{
// check to ensure the text fields do not soely contain a number
if(isNaN(document.frm.txtProctor.value))
// && isNaN(document.frm.txtPassword.value))
{
document.frm.submit();
}
else
{
alert('A value supplied for one or more field(s) appears to be invalid...');
}
}
else
{
alert('At least one required field was left blank...');
}
}
}
</script>
</head>
<body class="body">
<table height=100% align="center"><tr><td align="center" valign="top" class="table" >
<br><br><br>
<br><p align="center"><font size=7><strong>ASPEN</strong></font><br><br>
</p>
<br><br >
<form name="frm" method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<table width="100%" border="0" align="left" cellspacing="10"
style="font-size: 8pt; font-family: arial, Verdana, sans-serif; font-weight: bold">
<tr>
<td height="33">MEPS Name:<br>
<select name="cboMEPS" id="cboMEPS" size="1">
<option></option>
<%
' loop through the MEPS recordset writing select option for each value
While Not rs.EOF
Response.Write("<option value='" & rs("MID") & "'>" & rs("Name") & "</option>")
rs.MoveNext
WEND
%> </select> </td>
</tr>
<tr>
<td height="33"> Proctor Last Name:<br>
<input name="txtProctor" type="text" id="txtProctor" size="35"
maxlength="35"> </td>
</tr>
<tr>
<td height="33">Password:<br>
<input name="txtPassword" type="password" id="txtPassword" size="6"
maxlength="6"> </td>
</tr>
<tr>
<td width="193"></td>
<td width="381"> </td>
</tr>
</table>
<tr><td valign="bottom" align="left">
<input name="btnSubmit" type="button" id="btnSubmit" value="Submit" onClick="handleAction('validateForm')">
<input name="btnReset" type="reset" id="btnReset" value="Reset">
</td>
<td valign="bottom" align="right"><font size=1, style="normal"><a href="default.asp">Admin Utilities</a></font></td>
</tr>
</table>
</form>
</body>
</html>
Hope you can help me. I have an app that starts out with aspen.asp which just contains an iframe aspen01.asp. On this page, the user logs in and if authenticated moves on to aspen02.asp. If not authenticated, error messagebox pops up and user can try again. This was working fine.
I had to add a javascript function in the middle of my asp authentication code to open aspen02.asp full screen though, and this is where I ran into trouble. The first time it runs it always runs fine. If user fails to authenticate, throws error messagebox. If user successfully authenticates, it opens aspen02.asp fullscreen.
But when the window launches fullscreen, it still leaves the original login window open underneath. I wouldn't care, except that if someone logs in, gets to aspen02.asp does their stuff and logs out, if someone tries to reuse that original login window that was left underneath and fails to authenticate, although it throws the error messagebox, it also launches aspen02.asp again -- regardless of whether user authentication was successful or not --.
Please help! I have been at this all weekend, and my boss wants it in the morning. I am panicking now...
I am guessing it has to do with the if not rs.eof part, but nothing I have tried to resolve it is fixing the problem *sob*
This is my sourcecode for aspen01.asp (aspen.asp contains nothing but the iframe tag for aspen01.asp):
<!--#include file="source/include/common.asp" -->
<%
If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" Then
' declare variables
intMEPS = Request("cboMEPS")
strProctor = Trim(Request("txtProctor"))
strPassword = Trim(Request("txtPassword"))
' check to ensure the supplied authentication information is valid
strSQL = "SELECT * " & _
"FROM tblProctor " & _
"WHERE LastName = '" & formatString(strProctor, 1) & "' " & _
"AND Password = '" & formatString(strPassword, 1) & "' " & _
"AND Deleted = 'N'"
Set rs = objConn.Execute(strSQL)
' if it is retrieve and store pertinent information into the users session
If Not rs.EOF Then
Session.Timeout = 120
Session("PID") = rs("PID")
Session("ProctorName") = rs("FirstName") & " " & rs("LastName")
intLogins = rs("Logins") + 1
strSQL = "SELECT * " & _
"FROM tblMEPS " & _
"WHERE MID = " & intMEPS & ""
Set rs = objConn.Execute(strSQL)
Session("MID") = intMEPS
Session("MEPSName") = rs("Name")
'store last login information, update logins
strSQL = "UPDATE tblProctor " & _
"SET LastLogin = '" & Now() & "', " & _
"Logins = " & intLogins & " " & _
"WHERE LastName = '" & formatString(strProctor, 1) & "' " & _
"AND Password = '" & formatString(strPassword, 1) & "'"
Set cmd = objConn.Execute(strSQL)
Set cmd = Nothing
%>
<script language="JavaScript">
window.open('aspen02.asp', '', 'fullscreen=yes, scrollbars=auto')
</script>
<%
Else
' return an error if the user information was not found or not valid
Call returnError("User information not found...", 1)
%>
<script language="JavaScript">
window.location.reload()
</script>
<%
End If
End If
' retrieve the list of MEPS to populate the drop menu
strSQL = "SELECT * " & _
"FROM tblMEPS " & _
"ORDER BY Name"
Set rs = objConn.Execute(strSQL)
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title><%=Application("Title")%></title>
<link rel="stylesheet" href="source/style/default.css" type="text/css">
<script LANGUAGE="JavaScript">
// function used to handle a variety of actions
function handleAction(strAction)
{
// used when the submit button has been clicked
if(strAction == 'validateForm')
{
// ensure all required fields were satisfied
if(document.frm.cboMEPS.value != ''
&& document.frm.txtProctor.value != ''
&& document.frm.txtPassword.value != '')
{
// check to ensure the text fields do not soely contain a number
if(isNaN(document.frm.txtProctor.value))
// && isNaN(document.frm.txtPassword.value))
{
document.frm.submit();
}
else
{
alert('A value supplied for one or more field(s) appears to be invalid...');
}
}
else
{
alert('At least one required field was left blank...');
}
}
}
</script>
</head>
<body class="body">
<table height=100% align="center"><tr><td align="center" valign="top" class="table" >
<br><br><br>
<br><p align="center"><font size=7><strong>ASPEN</strong></font><br><br>
</p>
<br><br >
<form name="frm" method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<table width="100%" border="0" align="left" cellspacing="10"
style="font-size: 8pt; font-family: arial, Verdana, sans-serif; font-weight: bold">
<tr>
<td height="33">MEPS Name:<br>
<select name="cboMEPS" id="cboMEPS" size="1">
<option></option>
<%
' loop through the MEPS recordset writing select option for each value
While Not rs.EOF
Response.Write("<option value='" & rs("MID") & "'>" & rs("Name") & "</option>")
rs.MoveNext
WEND
%> </select> </td>
</tr>
<tr>
<td height="33"> Proctor Last Name:<br>
<input name="txtProctor" type="text" id="txtProctor" size="35"
maxlength="35"> </td>
</tr>
<tr>
<td height="33">Password:<br>
<input name="txtPassword" type="password" id="txtPassword" size="6"
maxlength="6"> </td>
</tr>
<tr>
<td width="193"></td>
<td width="381"> </td>
</tr>
</table>
<tr><td valign="bottom" align="left">
<input name="btnSubmit" type="button" id="btnSubmit" value="Submit" onClick="handleAction('validateForm')">
<input name="btnReset" type="reset" id="btnReset" value="Reset">
</td>
<td valign="bottom" align="right"><font size=1, style="normal"><a href="default.asp">Admin Utilities</a></font></td>
</tr>
</table>
</form>
</body>
</html>