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:
  #1  
Old February 10th, 2005, 08:25 PM
Tyler7282 Tyler7282 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 50 Tyler7282 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 28 m 34 sec
Reputation Power: 4
Need help changing this code..

Ok i am needing to do mutliple updates to the database a few seconds before the session times out...... someone showed me this code which pops up window says 60 seconds until timeout - would you like to keep your session going, and told me it could be edited to do what i want... however, i am new to CF and don't know how to analyze this new code.. here it is:

you put

<cf_sessionWatch launchTime="19"> on the top of every page

then this file is the part i need help with:

Code:
<cfif IsDefined("url.sessionwatch")>
<html>
<head><title></title></head>
<body>
<table width="100%"><tr><td align="center"><form>
Session extended.<br>
<input type="submit" onclick="window.close();" value="OK">
</form></td></tr>
</table>
<script>
window.close();
</script>
</body></html>
<cfabort>
</cfif>

<cfparam name="attributes.launchTime" default="20">

<cfoutput>
<cfset thisLaunchTime = (attributes.launchTime * 60 * 1000)>

<script language="Javascript">
	function watchSession() {
		timerID = setTimeout("refreshSession()", #thisLaunchTime#);
	}
	
	function refreshSession() {
		if (confirm("Your session will timeout in 60 seconds. Would you like to extend the session?")) {
			
			
			serverCall = window.open(document.location.href.split("?")[0]+"?sessionwatch=1&<cfif IsDefined("URLTOKEN")>#URLToken#</cfif>", "RefreshSession", "width=150, height=50");
			watchSession();
		}
	}

	watchSession();
</script>
</cfoutput>



i dont know how to begin, someone please help!

Reply With Quote
  #2  
Old February 10th, 2005, 08:48 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 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 4 Days 14 h 23 m 22 sec
Reputation Power: 53
All that code does is have a Javascript countdown on the client. I'm not aware of any way you can use that to trigger anything to happen on the server.

The reality is that until CFMX 7 and it's onSessionEnd() application event, there is no reliable way to trigger code to run at timeout of a session.
__________________
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
  #3  
Old February 10th, 2005, 09:01 PM
Tyler7282 Tyler7282 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 50 Tyler7282 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 28 m 34 sec
Reputation Power: 4
I know I've heard about that command and It'd definately be perfect, and do exactly what i need.. but my host isn't supporting 7 yet. There has to be some way


Quote:
Originally Posted by kiteless
All that code does is have a Javascript countdown on the client. I'm not aware of any way you can use that to trigger anything to happen on the server.

The reality is that until CFMX 7 and it's onSessionEnd() application event, there is no reliable way to trigger code to run at timeout of a session.

Reply With Quote
  #4  
Old February 10th, 2005, 11:17 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 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 4 Days 14 h 23 m 22 sec
Reputation Power: 53
Having code fire when a user's session runs out has been a problem for a long time...I'm afraid you're not going to find a very good solution, except to use client variables and keep the whole thing in a database all the time, so you never have to worry about when the session times out.

Reply With Quote
  #5  
Old February 11th, 2005, 04:59 PM
Tyler7282 Tyler7282 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 50 Tyler7282 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 28 m 34 sec
Reputation Power: 4
well i have updates that happen *only* when the session times out.. oh well just gotta wait for my host to support 7


Quote:
Originally Posted by kiteless
Having code fire when a user's session runs out has been a problem for a long time...I'm afraid you're not going to find a very good solution, except to use client variables and keep the whole thing in a database all the time, so you never have to worry about when the session times out.

Reply With Quote
  #6  
Old February 12th, 2005, 08:28 AM
Shane_Z Shane_Z is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: In denial
Posts: 22 Shane_Z User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 57 m 52 sec
Reputation Power: 0
Send a message via MSN to Shane_Z
There is a way to kill your session structure by using:

Code:
<cfset result=StructDelete("Session")>


I don't know that this is exactly what you want, but if you want to force a session to time out, that should work.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Need help changing this code..


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


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





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