4 Replies Latest reply on Mar 10, 2008 8:25 PM by (Laurence_Lewis)

    Sessions

    (Laurence_Lewis) Level 1
      Hi,

      I am using TinceMCE as a CMS with ADDT. However I find that if I am making updates to a page and it takes a while the session times out and I lose the changes.

      Is there a way to set a warning box on the timeout so the session can be continued by clicking on a continue session button?

      Thanks

      Cheers
      laurence
        • 1. Re: Sessions
          Günter Schenk Level 4
          Hi Laurence,

          have been thinking about the same recently -- while I´m not sure how to extend the currently running session "on demand" (maybe from a popup window), I found out how to at least *display* the php.ini´s "session.gc_maxlifetime" value and convert the seconds into a "human" format like "24:0", so that users are aware of that:

          1. put the following PHP code in the doc´s header:

          $seconds = ini_get('session.gc_maxlifetime');
          $minutes_display = intval($seconds/60);
          $seconds_display = ($seconds%60);
          $total = $minutes_display.":".$seconds_display;

          2. echo the value like this:

          your session will time out in

          In theory you could also use the "session.gc_maxlifetime" value within javascript based "timers" which start with a predefined value (session.gc_maxlifetime) and count down to 0.

          However, you can also try extending the session.gc_maxlifetime value for the respective form by adding the following "ini_set" command on line 1:



          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Sessions
            (Laurence_Lewis) Level 1
            Hi Günter

            Thanks, I will try your solution.

            Cheers
            Laurence
            • 3. Re: Sessions
              (Laurence_Lewis) Level 1
              Hi Gunter

              I found an old post of yours

              http://www.interaktonline.com/Products/Web-Applications/MXNewsletter/Product-Forum/Details /89962/Idea+::+howto+keep+an+eye+on+your+server%B4s+session+timeout.html

              I cant work out how to

              var min = 24;
              // but do set the minutes according to the "session.gc_maxlifetime" - value (and divide this one by 60) mentioned in the remote server´s "php.ini" - file

              How do I set this?? to work in the count down. If I leave it as 24 it works great.

              Cheers
              laurence
              • 4. Re: Sessions
                (Laurence_Lewis) Level 1
                I should think first before posting

                $seconds = ini_get('session.gc_maxlifetime');
                $minutes_display = intval($seconds/60);
                $total = $minutes_display;

                var min = <?php echo $total; ?>;

                That works