Ask a Question related to ASP Database, Design and Development.
-
Rahul Chatterjee #1
Clearing a variable in a database thru ASP
Hello All
I have a website which has login and logoff features. When some one logs in,
I set a variable in the database to 1 and if he logs off, I set it to 0.
This is fine as long as the user actually clicks the button. If the user
were to just close down the browser, the variable would never get set to 0
and hence the next user would never be able to login until some one manually
sets that variable to 0. Is there any way to trap the windows close event
and update the database field on the happening of such event. Also would
such code be need to be included in all the pages of the website. I am using
frames and logoff feature is always displayed once the user logs in. The
right frame is where I display all relevant information for the website.
Examples would really be helpful
Thanks
Rahul Chatterjee Guest
-
Variable in database query?
Here is a function I am attempting to use in a web application I'm developining. Basically, I am attempting to create a function to generate a... -
ASP SQL Server Database Login - Session Variable
Hello, I have a tough one for you guys. (Atleast I've been pulling my hair out trying to figure this one out.) Thanks for taking a look at this... -
image into variable or database
hello, i want to have an image in a variable so i can show it were ever i want the only catch is that i want the image to be called in the same... -
ASP Email - clearing out a variable
I've got this code: With cdoMessage Set .Configuration = cdoConfig .From = strEmail .To = "donald.duck@disney.com" .Cc = strmEmail .Subject =... -
I need help. I am having trouble clearing a field in an Access database.
I don't know what to use to clear a field in an MSAccess database. I can update fields in the database and delete whole records but I have not... -
Bob Barrows [MVP] #2
Re: Clearing a variable in a database thru ASP
Rahul Chatterjee wrote:
This article, and the two aricles it links to, may be helpful.> Hello All
>
> I have a website which has login and logoff features. When some one
> logs in, I set a variable in the database to 1 and if he logs off, I
> set it to 0. This is fine as long as the user actually clicks the
> button. If the user were to just close down the browser, the variable
> would never get set to 0 and hence the next user would never be able
> to login until some one manually sets that variable to 0. Is there
> any way to trap the windows close event and update the database field
> on the happening of such event. Also would such code be need to be
> included in all the pages of the website. I am using frames and
> logoff feature is always displayed once the user logs in. The right
> frame is where I display all relevant information for the website.
>
> Examples would really be helpful
>
> Thanks
[url]http://www.aspfaq.com/show.asp?id=2095[/url]
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Evertjan. #3
Re: Clearing a variable in a database thru ASP
Rahul Chatterjee wrote on 09 jun 2004 in
microsoft.public.inetserver.asp.db:
Since you cannot know, if a not logged out user has "left", the only> I have a website which has login and logoff features. When some one
> logs in, I set a variable in the database to 1 and if he logs off, I
> set it to 0. This is fine as long as the user actually clicks the
> button. If the user were to just close down the browser, the variable
> would never get set to 0 and hence the next user would never be able
> to login until some one manually sets that variable to 0. Is there any
> way to trap the windows close event and update the database field on
> the happening of such event. Also would such code be need to be
> included in all the pages of the website. I am using frames and logoff
> feature is always displayed once the user logs in. The right frame is
> where I display all relevant information for the website.
>
> Examples would really be helpful
>
solution is to define a timeout time.
Do not put a 1 in your database position, but the actual time.
Refresh the time at every contact with the user.
If another user wants to log in [I suppose you want to limit the number of
concurrent users for some reason] all users datetimes are checked first
against the actual time and deleted where timed out.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest
-
Rahul Chatterjee #4
Re: Clearing a variable in a database thru ASP
I am really trying to prevent multiple users logging in with the same id
- for eg for one office, there is one ID and multiple users know that id
(I cant generate more ID's) and I want only one user on the system at a
time. I achieved this by the use of the flag 1(for logged in) and 0 for
logged out. But in the event if the user just shut the browser down,
this would cause the flag not to be updated.
*** Sent via Devdex [url]http://www.devdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Rahul Chatterjee Guest
-
Mark Schupp #5
Re: Clearing a variable in a database thru ASP
If you have a frameset that is present during the entire time the user is
logged on then you could add an onunload event which calls the logoff page
in a popup window (have the logoff page close itself).
or
When a user logs on assign a unique "logon session" id and save the login id
and the logon session id in the database. Put the logon session id in a
session var or a cookie as well. Change your "logged on" test code to use
the logon session id to determine if the current user is logged on. When the
user logs off clear the entry for the logon session id in the database
At the time a user tries to log on, look for the login id (not the unique
"logon session" id). If it exists, then display a message that someone is
already logged on with that id.
To clear the ID, you can:
allow the user attempting to log on to "bump" the existing session off
by clearing the entry in the database.
allow an "administrative" user to clear sessions
use a time-stamp and a periodic batch script to clear sessions.
--
Mark Schupp
Head of Development
Integrity eLearning
[url]www.ielearning.com[/url]
"Rahul Chatterjee" <rahul@benesysinc.com> wrote in message
news:OAq7W1jTEHA.332@TK2MSFTNGP11.phx.gbl...> I am really trying to prevent multiple users logging in with the same id
> - for eg for one office, there is one ID and multiple users know that id
> (I cant generate more ID's) and I want only one user on the system at a
> time. I achieved this by the use of the flag 1(for logged in) and 0 for
> logged out. But in the event if the user just shut the browser down,
> this would cause the flag not to be updated.
>
>
>
>
>
> *** Sent via Devdex [url]http://www.devdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Mark Schupp Guest
-
Evertjan. #6
Re: Clearing a variable in a database thru ASP
Rahul Chatterjee wrote on 09 jun 2004 in
microsoft.public.inetserver.asp.db:As I just said, use a timeout.> I am really trying to prevent multiple users logging in with the same id
> - for eg for one office, there is one ID and multiple users know that id
> (I cant generate more ID's) and I want only one user on the system at a
> time. I achieved this by the use of the flag 1(for logged in) and 0 for
> logged out. But in the event if the user just shut the browser down,
> this would cause the flag not to be updated.
[please quote part of the posting you are answering,
others want to be able to follow the thread too]
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest



Reply With Quote

