|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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:
|
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
|||
|
|||
|
well i have updates that happen *only* when the session times out.. oh well just gotta wait for my host to support 7
![]() Quote:
|
|
#6
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Need help changing this code.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|