There are several scripts
1.php
<?php ini_set('session.gc_maxlifetime', 10); ini_set('session.cookie_lifetime', 10); session_set_cookie_params(10)); session_start(); $_SESSION['studentid']=$_POST['studentid']; ?> //html <form> на 2.php
2.php
<?php session_start(); if (!isset($_SESSION['studentid'])) { echo 'no id'; } var_dump($_SESSION); ?>
If I go to 1.php and wait for> 10 seconds and confirm the form referring to 2.php, the condition with $ _SESSION ['studentid'] does not work there, but in var_dump ($ _ SESSION); it will be seen that $ _SESSION ['studentid'] is still alive and the session is still in memory. Although I obviously entered 10 seconds before the start of the session using all the familiar methods. Why it happens? I need that if the user is sitting for more than 10 seconds on 1. php, then in 2. php there was no longer his $ _SESSION ['studentid'] there.