PHP Example
Screen shot
Matain session for 2 min

<?php
session_start();

if(isset($_REQUEST[\'session_expire\']) && $_REQUEST[\'session_expire\']==\'yes\'){
echo \"You session is now expire and your session timing is 2 min\";
}

$_SESSION[\'username\']=\'shishir012010\';
$_SESSION[\'time\']=time();
?>

Display session value and expire session value

<?php
session_start();
$exact_time=time()-$_SESSION[\'time\'];
if($exact_time>120)
{
unset($_SESSION[\'username\']);
unset($_SESSION[\'time\']);
header(\"Location:test2.php?session_expire=yes\");
}
else
{
echo $_SESSION[\'username\'];
}
?>

You can download source code here