simon315
12-22-2003, 01:46 AM
Hi. I have a very urgent question that I need to figure out ASAP. This is very urgent. I have a page of mine that pops up when a user clicks on a link. The pop-up is a small login page. Once the user is authenticated, the page is supposed to close and the main page is supposed to load a different page. So far, I've got everything working well except the past where it swithces the main page. On the main page I've created the following copy to create the pop-up:
function opensmall(url)
{
nwW = window.open(url,"opensmall","toolbar=no,scrollbars=no,width=300,height=200")
self.name = "main";
}
This code for the closing of the authentication is as follows:
<%
dim conn
dim strconn
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & _
Server.MapPath("../database/users.mdb") 'change the path as necessary
set conn = server.createobject("adodb.connection")
conn.open strconn
'Replace single quotes in username/password with two single quotes
'to protect from SQL Injection Attack
Username = Replace(Request("username"), "'", "''")
Password = Replace(Request("password"), "'", "''")
SQL = "SELECT * FROM clients WHERE username = '" & username & "'" & _
"AND password ='" & password & "'"
set oRs = conn.Execute(SQL)
If oRs.EOF then
Response.Redirect("../extranet/login_failure.htm")
Else
session("ID") = "extranet_session" 'any word you'd like
End If
Set conn = Nothing
Set oRs = Nothing
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT language="JavaScript">
onload="window.location.reload('../extranet/clienta/test.asp','main')"
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT language="JavaScript">
var gWindowCloseWait = 0;
function SetupWindowClose()
{
window.setTimeout("window.close()",gWindowCloseWait*1000);
}
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
if (IEmac && IE4)
{
window.onload = SafeOnload;
gSafeOnload[gSafeOnload.length] = f;
}
else if (window.onload)
{
if (window.onload != SafeOnload)
{
gSafeOnload[0] = window.onload;
window.onload = SafeOnload;
}
gSafeOnload[gSafeOnload.length] = f;
}
else
window.onload = f;
}
function SafeOnload()
{
for (var i=0;i<gSafeOnload.length;i++)
gSafeOnload[i]();
}
SafeAddOnload(SetupWindowClose);
</SCRIPT>
</BODY>
</HTML>
The lcosing works, but the loading of the other page does not. Can someone please help me??? I thought an onload command would work, but maybe it doesn't please help.
Simon315
function opensmall(url)
{
nwW = window.open(url,"opensmall","toolbar=no,scrollbars=no,width=300,height=200")
self.name = "main";
}
This code for the closing of the authentication is as follows:
<%
dim conn
dim strconn
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & _
Server.MapPath("../database/users.mdb") 'change the path as necessary
set conn = server.createobject("adodb.connection")
conn.open strconn
'Replace single quotes in username/password with two single quotes
'to protect from SQL Injection Attack
Username = Replace(Request("username"), "'", "''")
Password = Replace(Request("password"), "'", "''")
SQL = "SELECT * FROM clients WHERE username = '" & username & "'" & _
"AND password ='" & password & "'"
set oRs = conn.Execute(SQL)
If oRs.EOF then
Response.Redirect("../extranet/login_failure.htm")
Else
session("ID") = "extranet_session" 'any word you'd like
End If
Set conn = Nothing
Set oRs = Nothing
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT language="JavaScript">
onload="window.location.reload('../extranet/clienta/test.asp','main')"
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT language="JavaScript">
var gWindowCloseWait = 0;
function SetupWindowClose()
{
window.setTimeout("window.close()",gWindowCloseWait*1000);
}
var gSafeOnload = new Array();
function SafeAddOnload(f)
{
isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
IEmac = ((document.all)&&(isMac)) ? true : false;
IE4 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 4.")!=-1)) ? true : false;
if (IEmac && IE4)
{
window.onload = SafeOnload;
gSafeOnload[gSafeOnload.length] = f;
}
else if (window.onload)
{
if (window.onload != SafeOnload)
{
gSafeOnload[0] = window.onload;
window.onload = SafeOnload;
}
gSafeOnload[gSafeOnload.length] = f;
}
else
window.onload = f;
}
function SafeOnload()
{
for (var i=0;i<gSafeOnload.length;i++)
gSafeOnload[i]();
}
SafeAddOnload(SetupWindowClose);
</SCRIPT>
</BODY>
</HTML>
The lcosing works, but the loading of the other page does not. Can someone please help me??? I thought an onload command would work, but maybe it doesn't please help.
Simon315