2 Replies Latest reply on Sep 7, 2007 12:49 PM by Irish-Phoenix

    Using session management on a DB function, please help

    Irish-Phoenix Level 1
      I am writting a little application that utalizes a table in my DB. It is like an on / off switch. I wanted to know if it is possible to make a session management script that will make this "switch" work for all the users that log into the web site.

      I need it to be in the on position no matter if there is another user who turned it off at the same time. Also, when a new user logs into the site, it is always "on"

      I am attaching the code for the app so far, as it is now, when one user turns it off.. it is off for everyone. This is what I am trying to bypass. I need to use the DB so all the pages in the site realize that it is off or on and you won't have to turn it off or on everytime you go to a new page in the web site. Look at it like this. When you use like a flash site, you can turn off the sound and the whole site remembers it. Well I am trying to do it in CF dynamic site.

      Is it possible to do this with session management? If so, how would I write this. I do have session management enabled in my application.cfm file. this is where I would more then likely have to put this type of script so the whole site is managed by it.

      Attached is my code.

      Thank you

        • 1. Re: Using session management on a DB function, please help
          aqlongnion Level 1
          You probably don't need to manage is this Sound on/off switch in the DB at all.

          If the site has a place where users are required to log in, use Session or Client variables to log them in, and then have a Session/Client.soundOn variable that you set to on/off based on what the user chooses in your form.

          If there's no login for this site, you can use cfcookie to set a cookie.soundOn variable.

          Session, Client, and Cookie variables will give you the user-specific variables capabilities you are looking for... it just depends on the requirements and nature of your particular app as to how you should handle the situation.
          • 2. Re: Using session management on a DB function, please help
            Irish-Phoenix Level 1
            If I make it a cookie, is this how it would be written?

            <cfcookie name="sound" value="Session/Client.soundOn " expires="NEVER" domain="www.myweb.com" path="myweb.com/index.cfm">

            There is no log in on this site. it is for general use. It is not a flash site so I need to give the user the option to turn off the BG sound, but the only plug ins to accomplish this would make them have to turn it off on every page the way the site is built.

            Can you help me with my code? How would I make it a client/session variable so when everyone logs in it is on no matter what other users do leaving it on or off?