• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Update database for logout when signout is not done properly

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and Welcome to Javaranch
 
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

anusha chaitanya wrote:This is possible with javascript.



JS can be disabled...
 
chaitanya karthikk
Ranch Hand
Posts: 806
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lorand Komaromi wrote:

JS can be disabled...



Yes, this is also one of the factor to be considered.
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic