I'm putting together a database - one for employee's and on for supervisors - the database for the supervisors is to accessed thru a User and Password.
I have built the web pages and also built a users.mdb file.
Everything works fine.
The problem is that when the page2.asp loads I would like it to close so no one can see the URL.
This is for a internal web site.
Here is the code:
**PW1.asp**
<title>Input User and Password</title>
</head>
<body onload="window.close(" bgcolor="#000000">
<form method="POST" action="PAGE2.ASP">
<font color="#FF0000"><b><font face="Book Antiqua" size="5" color="#FF0000">User:</font></b>
</font><input name="USERNAME" size="20" style="font-family: Comic Sans MS; color: #0000FF; font-weight: bold" type="password">
<font color="#FF0000"><b><font face="Book Antiqua" size="5" color="#FF0000">Password:
</font></b></font><input name="PASSWORD" type="password" size="20" style="font-family: Comic Sans MS; color: #0000FF">
<input name="SUBMIT" type="SUBMIT" value="LOGIN">
</form>
</body>
</html>
**page2.asp**
<title>[ ====== ]</title>
</head>
<body onload="window.close(" "" bgcolor="#C0C0C0" style="text-transform: uppercase; font-family: AR Sans Serif; color: #FF0000; font-style: italic; font-weight: bold">
<%
Username = Request.Form("USERNAME"
Password = Request.Form("PASSWORD"
'Get username and password from previous page
SQL = "SELECT * FROM Users Where Username='" & Username & "'"
set adoConn = Server.CreateObject ("ADODB.Connection"
set adoRS = Server.CreateObject ("ADODB.RecordSet"
dbPath = Server.MapPath("users.mdb"
adoConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
adoRS.Open SQL,adoConn
' OPen a DSN less connection to an access database and get the username and password for the record where username=username
If adoRS.EOF Then
'The username doesn't exist, do an error.
Response.Write "Username Doesn't Exist!"
Else
If Trim(Password) = Trim(adoRS("Password") Then
'If the passwords match
Session("LoggedIn"="TRUE"
'Set a session variable to true
%>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function open_new_window(){
window.open("}
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
window.location="JavaScriptpen_new_window()"
</SCRIPT>
<%
'Forward user to next page
Else
'Passwords don't match
Response.Write "Password is incorrect"
End If
End IF
set adoRS = Nothing
set adoConn = Nothing
%>
</body>
</html>
===========================================================
I have tried several ways to close the page2.asp when pages load and also by javascript. The javascript gives me a popup about the page closing but I would like to do it with out any user intervention.
Thanks and have a great day.
< I want to work in Theory - everything and everybody works in Theory !!>
I have built the web pages and also built a users.mdb file.
Everything works fine.
The problem is that when the page2.asp loads I would like it to close so no one can see the URL.
This is for a internal web site.
Here is the code:
**PW1.asp**
<title>Input User and Password</title>
</head>
<body onload="window.close(" bgcolor="#000000">
<form method="POST" action="PAGE2.ASP">
<font color="#FF0000"><b><font face="Book Antiqua" size="5" color="#FF0000">User:</font></b>
</font><input name="USERNAME" size="20" style="font-family: Comic Sans MS; color: #0000FF; font-weight: bold" type="password">
<font color="#FF0000"><b><font face="Book Antiqua" size="5" color="#FF0000">Password:
</font></b></font><input name="PASSWORD" type="password" size="20" style="font-family: Comic Sans MS; color: #0000FF">
<input name="SUBMIT" type="SUBMIT" value="LOGIN">
</form>
</body>
</html>
**page2.asp**
<title>[ ====== ]</title>
</head>
<body onload="window.close(" "" bgcolor="#C0C0C0" style="text-transform: uppercase; font-family: AR Sans Serif; color: #FF0000; font-style: italic; font-weight: bold">
<%
Username = Request.Form("USERNAME"
Password = Request.Form("PASSWORD"
'Get username and password from previous page
SQL = "SELECT * FROM Users Where Username='" & Username & "'"
set adoConn = Server.CreateObject ("ADODB.Connection"
set adoRS = Server.CreateObject ("ADODB.RecordSet"
dbPath = Server.MapPath("users.mdb"
adoConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath
adoRS.Open SQL,adoConn
' OPen a DSN less connection to an access database and get the username and password for the record where username=username
If adoRS.EOF Then
'The username doesn't exist, do an error.
Response.Write "Username Doesn't Exist!"
Else
If Trim(Password) = Trim(adoRS("Password") Then
'If the passwords match
Session("LoggedIn"="TRUE"
'Set a session variable to true
%>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function open_new_window(){
window.open("}
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
window.location="JavaScriptpen_new_window()"
</SCRIPT>
<%
'Forward user to next page
Else
'Passwords don't match
Response.Write "Password is incorrect"
End If
End IF
set adoRS = Nothing
set adoConn = Nothing
%>
</body>
</html>
===========================================================
I have tried several ways to close the page2.asp when pages load and also by javascript. The javascript gives me a popup about the page closing but I would like to do it with out any user intervention.
Thanks and have a great day.
< I want to work in Theory - everything and everybody works in Theory !!>