S
shikha
Hi Everyone,
I have a website where users enter login information to log on, and each
page is password protected. It times out every 5 mins or so it there is no
activity. I am not too sure how to increase the limit so instead of every 5
mins...it will be 30 mins or so...
Any help will be greatly appreciated!!!!
Here is my login.inc file
<% Response.CacheControl = "no-cache"
' Check to see whether you have a current user name.
If isLP Then'Are you currently on the logon page?
Session("REFERRER")=Request.ServerVariables("URL")
Response.Redirect("./")
End If
function isLP()'do not modify this function may cause an icorrect running
on error resume next
isLP=False
If Len(Session("uid"))=0 then
if isEmpty(LPage) Then
isLP=True
End If
end if
end function
' This function checks for a username/password combination.
Function ComparePassword(uid,pwd)
' Define your variables.
Dim strSQL, objCN, objRS
' Set up your SQL string.
strSQL = "SELECT * FROM " & USERS_TABLE & " WHERE (UID='" & uid & "' AND
PWD='" & pwd & "');"
' Create a database connection object.
Set objCN = Server.CreateObject("ADODB.Connection")
' Open the database connection object.
'objCN.Open "driver={Microsoft Access Driver (*.mdb)}; dbq=" &
Server.MapPath(MDB_URL) & "; uid=admin; pwd="
objCN.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath(MDB_URL), dbUserName, dbPassword
' Run the database query.
Set objRS = objCN.Execute(strSQL)
if Not objRS.EOF then
if len(objRS("Admin"))=4 then
Session("admin")="1" ' TRUE or true = 4 it's a little trick
else Session("admin")=Empty
end if
if len(objRS("Enabled"))=4 then
Session("enabled")="1"
else Session("enabled")=Empty
end if
ComparePassword = True
else
ComparePassword = False 'Wrong UID or PWD
end if
' Close your database objects.
Set objRS = Nothing
Set objCN = Nothing
End Function
Function isLogged() ' Function Return True for Logged User, something like
this must called in the begin of each protected asp file.
if Len(Session("uid"))=0 then
isLogged=False
else isLogged=True
end if
End Function
Function logState() ' Function Return String Shows user state in system and
logout text link
If Len(Session("uid")) = 0 Then
Response.Write "<p><b>You are not logged on.</b></p>"
Else
Response.Write "<p>You are logged on as: <b>" & Session("uid") &
"</b> | <a href='" & LOGOUT_PAGE & "'>Logout</a></p>"
End If
End Function
Function isAdmin() 'Function Return True for Admin and Else for other users.
isAdmin=Cbool(Len(Session("admin")))
End function
Function isEnabled() ' Function return True for Enabled users and Else for
others.
isEnabled=CBool(Len(Session("enabled")))
End function
%>
I have a website where users enter login information to log on, and each
page is password protected. It times out every 5 mins or so it there is no
activity. I am not too sure how to increase the limit so instead of every 5
mins...it will be 30 mins or so...
Any help will be greatly appreciated!!!!
Here is my login.inc file
<% Response.CacheControl = "no-cache"
' Check to see whether you have a current user name.
If isLP Then'Are you currently on the logon page?
Session("REFERRER")=Request.ServerVariables("URL")
Response.Redirect("./")
End If
function isLP()'do not modify this function may cause an icorrect running
on error resume next
isLP=False
If Len(Session("uid"))=0 then
if isEmpty(LPage) Then
isLP=True
End If
end if
end function
' This function checks for a username/password combination.
Function ComparePassword(uid,pwd)
' Define your variables.
Dim strSQL, objCN, objRS
' Set up your SQL string.
strSQL = "SELECT * FROM " & USERS_TABLE & " WHERE (UID='" & uid & "' AND
PWD='" & pwd & "');"
' Create a database connection object.
Set objCN = Server.CreateObject("ADODB.Connection")
' Open the database connection object.
'objCN.Open "driver={Microsoft Access Driver (*.mdb)}; dbq=" &
Server.MapPath(MDB_URL) & "; uid=admin; pwd="
objCN.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath(MDB_URL), dbUserName, dbPassword
' Run the database query.
Set objRS = objCN.Execute(strSQL)
if Not objRS.EOF then
if len(objRS("Admin"))=4 then
Session("admin")="1" ' TRUE or true = 4 it's a little trick
else Session("admin")=Empty
end if
if len(objRS("Enabled"))=4 then
Session("enabled")="1"
else Session("enabled")=Empty
end if
ComparePassword = True
else
ComparePassword = False 'Wrong UID or PWD
end if
' Close your database objects.
Set objRS = Nothing
Set objCN = Nothing
End Function
Function isLogged() ' Function Return True for Logged User, something like
this must called in the begin of each protected asp file.
if Len(Session("uid"))=0 then
isLogged=False
else isLogged=True
end if
End Function
Function logState() ' Function Return String Shows user state in system and
logout text link
If Len(Session("uid")) = 0 Then
Response.Write "<p><b>You are not logged on.</b></p>"
Else
Response.Write "<p>You are logged on as: <b>" & Session("uid") &
"</b> | <a href='" & LOGOUT_PAGE & "'>Logout</a></p>"
End If
End Function
Function isAdmin() 'Function Return True for Admin and Else for other users.
isAdmin=Cbool(Len(Session("admin")))
End function
Function isEnabled() ' Function return True for Enabled users and Else for
others.
isEnabled=CBool(Len(Session("enabled")))
End function
%>