Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times

    Using php, how do I get my login to last longer?

    My sessions aren't lasting but about 5 minutes when I am not active on the site. How can I change this?

  2.  

  3. #2
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    all depends on if it's a php session set by some type of application, content management system or if its just a server setting...

    if you're running a pre-built app, probably a "config" setting that can be tweaked somewhere

    if not: PHP: Sessions - Manual

  4. #3
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    I have written all code. I just pass the saved session from one page to the next.

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    ini_set(’session.gc_maxlifetime’, 30*60); <-- that'll give you 30 minutes.

    There's also a spot in PHP.ini you can set that.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    Quote Originally Posted by TheGAME1264 View Post
    ini_set(’session.gc_maxlifetime’, 30*60); <-- that'll give you 30 minutes.
    I did this earlier and it didn't work.

  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    I'm guessing that you have a script somewhere without "session_start();" in it.

    If you have a session, and you move to other scripts or write to it, the session timer resets. That session active timeout is for sessions that sit untouched.

    Any script you have that uses your session should have, session_start(); somewhere before you use any session functions.


  8. #7
    Senior Member
    Join Date
    Aug 2011
    Posts
    227
    Member #
    29153
    Liked
    4 times
    Quote Originally Posted by mlseim View Post
    I'm guessing that you have a script somewhere without "session_start();" in it.

    If you have a session, and you move to other scripts or write to it, the session timer resets. That session active timeout is for sessions that sit untouched.

    Any script you have that uses your session should have, session_start(); somewhere before you use any session functions.
    I'm using the same template for every page so that is at the very beginning of every page.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:14 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com