Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update database for logout when signout is not done properly

 
Indresh yadav
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am facing problem related with sign out...
the problem is...

i mentain a database related with loggedin and looggedout.
filed loginId contains value 1 when user loggedin.and 0 when user logged out.
if user signout properly thing are going well no problem..

but when user used to closed browser by using X without signing out...then database field loginId not changed and having value 1 for that user....

i need to update this field to 0 when user closed browser by using X.

thnks in advance..
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indresh yadav wrote:
i need to update this field to 0 when user closed browser by using X.


There is no reliable way of achieving this, I'd suggest to update the database when the user's session expires instead (e.g. HttpSessionListener).
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and Welcome to Javaranch
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Indresh, recently I have seen a website implementing your problem, it is www.reliancebroadband.com.
When we login the session is created with a logout link. If we want to logout we use the logout link. If the user tries close the window directly, then a confirm dialog box appears asking the user that he/she is sure to close the window. If the user clicks yes then session is expired and and some database transactions are done, if he clicks no he will remain in the same page. This is possible with javascript.
This is how you have to do this.
However there is another problem if you go with login and logout status. Think that there is a sudden power cut, than what is the situation.
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anusha chaitanya wrote:This is possible with javascript.


JS can be disabled...
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lorand Komaromi wrote:

JS can be disabled...


Yes, this is also one of the factor to be considered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic