Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php destroy session after some time

<?php
session_start();

// 2 hours in seconds
$inactive = 7200; 

$session_life = time() - $_session['testing'];

if($session_life > $inactive)
{  
 session_destroy(); 
}

$_session['testing']=time();
    
    echo $_SESSION['testing']; //prints NOTHING?
    ?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #destroy #session #time
ADD COMMENT
Topic
Name
1+5 =