View Full Version : Session end without global.asa

01-25-2005, 02:18 PM
I've got a simple but distressing.... the server that I have does not support Global.asa, yes, :o its a free server.

Is there possibly a way that I can get around that and find out when the user session ends and when an application starts? :eek:

Anyone? :p

01-25-2005, 02:47 PM
I'm not sure but I don't think there's a way to do that except maybe hard-coding it (This would depend on what you want to do at the beginning or end of the session)

01-25-2005, 03:51 PM
I have designed a system where there are six users that can sign into the system. When they sign into the system I make record of it in the database, and I was attempting to use the Application variable to store their name so that I can know and show it to the public that that particular user is online.

Now when the user clicks sign out.... I delete the record in the database and I can modify the Application variable to reflect this change. However, the problem starts if the user does NOT sign out... just say for example exits and does not click sign out.

That way the session expires. Now when the session expires... the record stays in my database (mind you, the user will have to sign in again because their session ID would be different from the one I stored). But I really would like to have some code that will delete the records when the session expires and do the same modification that I would have done to the application variable when the session ends.

01-25-2005, 04:01 PM
I'm sorry i have to confess i can't offer much help here. I've been thinking about it for about 45 minutes now but when i think i got a solution, i notice a flaw. Hope someone reads this thread and helps out cos i'm going to face a similar situation very soon

01-25-2005, 04:17 PM
:eek: okay..... tboss :thumbsup: :D

so any takers more? :confused:

01-25-2005, 04:35 PM
errm.. ive never found a case where you actually have to use application variablies...ever :p

heres what i would do, you already have most of the database, just put a last page load time in the database, and update it every time a page is loaded for that user. if the last time they loaded the page is under x minutes ago, they are still assumed to be logged in, this number can be set to the same as your session timeout so you can effectively see if their session is still open without using global.asa at all :thumbsup:

errm.. you might understand this.. i can be a little confusing :p

if logged in
update their lastLoadDate
if ip exists already in guests table
update the lastLoadDate of that ip
insert their ip and lastLoadDate into guests table
end if
end if
delete all old records in guest table

if you dont want guests ignore everything after "else" :p

then run a sql count(...) from.. where lastLoadDate < x mins ago

hope that helps, it uses database instead of global.asa

01-25-2005, 04:51 PM
Okay.... thanks for that suggestions....
I'm currently as we speak tryin to represent those changes in my database...

Quick question tho: How would I say manipulate the now() function to obtain 30 minutes ago?

01-25-2005, 04:54 PM
run a datediff in minutes i think :)

01-25-2005, 06:22 PM
Ghell, thanks man. I'll file this away ASAP.

01-25-2005, 06:31 PM
I tried that and it worked!!!! :thumbsup: But I just hope it doesn't take 2 much server eergy to do the delete!