You're awsome thanks! I am checking out client variables now 
and I think I will rewrite my apps to use them and then let CF 
store them in a DB and just purge them every day.

BJ

= = = Original message = = =

see I found a mistake already :P.

<cfset request.thissession = "#session.cfid#:#session.cftoken#">

should be

<cfset request.thissession = "#cfid#:#cftoken#">

this way it would grab it if you passed the cfid and cftoken 
in the url or
in seperate cookies called cfid and cftoken (which is what I 
would do).


Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 10:43 AM
To: CF-Talk
Subject: RE: storing session variables in DB


i think i read this wrong. you WANT people to be able to jump 
from one
server to the other during a session. Well then, client variables 
to the
rescue. you could probably mimic with session variables:

in your database create a table that has these columns

CDATA
------
cfid~char(100)
app~char(64)
data~text  ** note in msaccess, use memo



Application.cfm
===============
<cflock timeout="10" throwontimeout="No" type="READONLY">
~<cfset request.thissession = "#session.cfid#:#session.cftoken#">
~<cfset request.thisapp = application.applicationname>
</cflock>
<cfquery name="GetSessionInfo"
         datasource="#request.dsn#"
         username="#request.username#"
         password="#request.password#">
~select
~~data
~from cdata
~where cfid = '#request.thissession#' and app = '#request.thisapp#'
</cfquery>
<cfset temp = request.session1 = StructNew()>
<cfif GetSessionInfo.RecordCount NEQ 0>
~<cfloop index="i" list="#GetSessionInfo.data#" delimiters="##">
~~<cfif trim(i) NEQ "">
~~~<cfset a = ListGetAt(i, 1, "=")>
~~~<cfset b = ListGetAt(i, 2, "=")>
~~~<cfset temp = StructInsert(request.session1, a, b)>
~~</cfif>
~</cfloop>
<cfelse>
<cfquery name="InsertSessionInfo"
         datasource="#request.dsn#"
         username="#request.username#"
         password="#request.password#">
~INSERT INTO CDATA
~(cfid, app)
~VALUES
~('#request.thissession#', '#request.thisapp#')
</cfquery>
</cfif>


Onrequestend.cfm
================

<cfset request.thisdata = "">
<cfloop collection="#request.session1#" item="i">
~<cfset request.thisdata = request.thisdata & i & "##">
</cfloop>

<cfquery name="UpdateSessionInfo"
         datasource="#request.dsn#"
         username="#request.username#"
         password="#request.password#">
~UPDATE CDATA
~SET
~~data = '#request.thisdata#'
~WHERE where cfid = '#request.thissession#' and app =
'#request.thisapp#'
</cfquery>



************** PLEAS READ******************************

Now understand that I don't use session variables at all in my 
apps and
never will. this is just a rough idea of what you would most 
likely do to
mimic client variables with session variables. Personally i would 
rewrite
the app to use client variables. But each to their own. You will 
probably
need to correct / rewrite some of this code. Hey I wrote it off 
a whime and
without testing :P.


Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 10:10 AM
To: CF-Talk
Subject: RE: storing session variables in DB


dude all you have to do is make sure that each app has it's own 
application
name in the cfapplication tag.

name of app1
<cfapplication name="test">

name of app2
<cfapplication name="test2">

now the user's can't share session variables.




Anthony Petruzzi
Webmaster
954-321-4703
[EMAIL PROTECTED]
http://www.sheriff.org


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 04, 2002 10:06 AM
To: CF-Talk
Subject: storing session variables in DB


I have a set of mirrored servers that are running off 1 SQL_server. 

I have to recode the apps that use session variables because 

a user could jump to a different server during a session. Is 

there a simple way to fix this? Can 2 different servers be aware 

of the same session? Can I store the session variables in the 

SQL-server DB?

I am running Win2k, SQL-Server 2000, and (I know) CF%.0 Professional.

There is no need to tell me that the Enterprise version will 

allow me to isolate a user to one server during a session.

Thanks in advance,
BJ

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.





______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to