Jump to content

Recommended Posts

if you have access to the php.ini file then yes

session.gc_maxlifetime = 3600

 

you can try

 

<?php
ini_set ( string "session.gc_maxlifetime", 3600)

?>

 

 

EDIT:

 

as a note it maybe an idea to set the session everyt time its check thus resetting the timeout

thanks for the input guys... another question along the same lines:

 

<?php

session_start();

$_SESSION['size']='large';

session_destroy();

echo "Session Size: ".$_SESSION['size']; //this echoes out Session Size: large

?>

 

why does the above still echo out the value in $_SESSION['size'], after i have used session_destroy() ?

 

Cheers

 

 

try

 

<?php
session_start();
$_SESSION['size']='large';
unset($_SESSION);
session_destroy();
session_start();
echo "Session Size: ".$_SESSION['size']; //this echoes out Session Size: large
?>

 

If you are creating a new session, but want to make sure that  there are currently no sessions active by doing session_destroy(); make sure you start the session again using session_start(); or else your session data will not register properly.

thanks...the following seems to work fine

 

<?php

session_start();

$_SESSION['loggedin'] = "true";

echo "Session Size: ".$_SESSION['loggedin']; //this echoes out Session Size: large

session_unset();

session_destroy();

if(!isset($_SESSION['loggedin'])) echo "not set"; //this echoes out Session Size: large

?>

 

what is unset($_SESSION); meant for? it works correctly without it...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.