SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stop admin pages timing out

    Hi all,

    I have recently created a small CMS using php and MySQL and my client is complaining that the page is timing out too quickly for him, as he basically starts typing an sometimes goes away to verify info and maybe take some pics.

    I def havent set the timeout of the page, so there nothing there controlling it, so wondered how would I go about handling this timeout length.

    Cheers

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,050
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Are you referring to the fact that his session expires and he is logged out while writing his page?

    One thing you could do, is convert from using $_SESSION to $_COOKIE and setcookie(). Another alternative is to extend the session lifetime.
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes

  3. #3
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes and no, as it doesnt time out as he is typing i dont think, I think its when its inactive, as he pops off to do something else having already started typing somethng into the admin a while back.

    But yes when he comes back and carries on typing, and clicks submit, rather than it uploading it goes straight to the log in page instead, having been logged out

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    The idea here isnt to stop his session from timing out - it's to hold his entered data while he logs back in, and then pass that data back in.

    If your system detects a timeout (No session value);
    Start a session (should be done anyway)
    Serialize $_POST as an item (i'm gonna call it 'formdata') in the session.
    Save the target page as another session variable. (if your login form is using PHP_SELF, you dont need to worry about this)
    Present login page.

    Now the login parser needs a bit more logic.
    If the login was successful;
    Unset the login post variables;
    Unserialize anything in $_SESSION['formdata'] back into $_POST (yes, this is naughty but it works)
    load the page as normal.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  5. #5
    SitePoint Guru
    Join Date
    Feb 2006
    Location
    Chepstow, South Wales
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK I see yes, i will give this a go and may return.

    Well, probably will return.

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •