Aris
Aris

Reputation: 55

How do I stop the timeout of sessions and make session time infinite? (PHP)

I'm using OpenID (LightOpenID) with PHP and I can't help but notice that the session times out after a very short period of time, and it is a problem. How can I increase the session time to infinite? I've googled many methods but I don't believe I am adding the code in the correct places. If it's necessary for me to paste my code, just say so, but I didn't think it was needed. All help is greatly appreciated! :)

Upvotes: 0

Views: 121

Answers (1)

Tauseef
Tauseef

Reputation: 369

`

<?php 
       if(!isset($_SESSION["timeout"])){
         $_SESSION['timeout'] = time();
       };
       $st = $_SESSION['timeout'] + 120; //session time is 2 minutes, Changing this value can help you.

      if(time() < $st){
        echo 'Session will last 2 minutes';
      }
  ?>`

Upvotes: 1

Related Questions