Hello
I am making a internal site for our company.
I want to allow acces to people only if they have a user name and Password (that is stored in a access database)
I have a login page that collects their username and Password and if it matches they are then redirected to the next Page.
What i would also like is a function that is called each time a page is loaded to verify that they have indeed been to the login page.
this first pice of code creates a session variable called accessLevel and passes it a value of correct
now i have a function that i want to place on each page that will check to see if a user has been to the loginpage
But i am getting a error on the Function(valida)
any suggestions??
Thanks
I am making a internal site for our company.
I want to allow acces to people only if they have a user name and Password (that is stored in a access database)
I have a login page that collects their username and Password and if it matches they are then redirected to the next Page.
What i would also like is a function that is called each time a page is loaded to verify that they have indeed been to the login page.
this first pice of code creates a session variable called accessLevel and passes it a value of correct
Code:
<%
uName = String(Request.Form("uName"));
pword = String(Request.Form("pword"));
var connect = Server.CreateObject("ADODB.Connection");
var recordSet = Server.CreateObject("ADODB.RecordSet");
connect.Open("DSN=12345");
var loginMatch = false;
recordSet.Open("select * from Members'" , connect, adOpenKeyset, adLockOptimistic);
while(!recordSet.EOF)
{
var Username = recordSet("Username");
var Password = recordSet("Password");
var Firstname = recordSet("FirstName")
if(uName == String(Username) && pword == String(Password))
{
Session("AccessLevel") = "correct";
loginMatch = true;
break;
}
recordSet.MoveNext();
}
if(loginMatch)
{
Response.Redirect("Shome.html");
}
else
{
Response.Redirect("login.asp?login=false");
}
%>
now i have a function that i want to place on each page that will check to see if a user has been to the loginpage
Code:
var mink = Session("AccessLevel")
function valida()
{
if Session("AccessLevel") != mink;
{
Response.Redirect("login.asp?login=false")
}
}
But i am getting a error on the Function(valida)
any suggestions??
Thanks