ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old March 18th, 2008, 09:02 PM
benjaminkang benjaminkang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 4 benjaminkang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 57 sec
Reputation Power: 0
How to update user login status upon close browser

Hi guys, sorry for posting this kind of petty questions, but i'm really facing problem with this,

is there a way for me to automatically logs out the user from the database when the user closes his browser? or is there a way to work around it?

the only success ive gotten so far is by timing out the user upon inactivity for n period.

any help will be useful

thanks.

Reply With Quote
  #2  
Old March 18th, 2008, 09:15 PM
curiousnewbie's Avatar
curiousnewbie curiousnewbie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 56 curiousnewbie User rank is Private First Class (20 - 50 Reputation Level)curiousnewbie User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 23 h 52 m 4 sec
Reputation Power: 2
Here is a solution

http://www.bennadel.com/blog/1131-Ask-Ben-Ending-ColdFusion-Session-When-User-Closes-Browser.htm

google is your friend

Reply With Quote
  #3  
Old March 18th, 2008, 09:56 PM
benjaminkang benjaminkang is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2008
Posts: 4 benjaminkang User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 57 sec
Reputation Power: 0
yeah i've checked out the link previously and have implemented session. But that only fixes the function part.

here, let me explain more on what i wanna do
Code:
   If cookie isDefined
	if cookie/session/etc values are the same
		if loginstatus is false
			then login is approved
		else, 
			send user back out
	else
		if loginstatus is false
			then login is approved
		else,
			if the user closes the window without logging out then login status is still true, and since its still true.
				function(check)<-- i can't figure out on how to do this, just having session variables is not enough.
			else
				send user out		 
Else
	Force User To Enable Cookie Before Attempting Log In

Reply With Quote
  #4  
Old March 18th, 2008, 10:05 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,475 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 7 m 51 sec
Reputation Power: 42
You can't reliably do this. HTTP is stateless, and when the user closes their browser, there is no reliable way to tell the server anything. There are probably JavaScript hacks floating around out there that will try to trigger some last-minute notification to the server, but those are not reliable.

The best you can do is set up per-session cookies. When the user closes their browser, they have lost their connection to that session. At that point, after whatever session timeout period you have set, the session will end (and OnSessionEnd() will be called if you are using Application.cfc). But other than this, there is nothing you can do, it's a result of the stateless nature of HTTP.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #5  
Old March 19th, 2008, 09:06 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,475 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 17 h 7 m 51 sec
Reputation Power: 42
To restate this, the only reliable way to end a user's session is if they press a logout button. Unless they do that, you have to wait for the session to expire.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > How to update user login status upon close browser


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway