I'm looking for a solution me and my freelancer scripter cannot fix haha!
After 25 minutes of inactivity my reservation script log-out automatically and gives me a header already send error on line 722. I need to login again to proceed. I cannot refresh the page but must go manually to index.php to log-in.
I searched the stack overflow forum for solutions and I found an answer to change the settings in the php.ini. I did this but stil it doesn't work (php info shows now the correct value of 31536000s on local and master). I also changed the PHP session time in the reervation script without any results..
Other thing I tried I found on the forum is a .htaccess file but also doesn't work.
What can I try more?
PHP.ini
session.gc_maxlifetime = 31536000
session.cookie_lifetime = 31536000
Variables.php
if (session_id() === '') {
session_set_cookie_params(172800, APP_BASE_PATH, $_SERVER['SERVER_NAME'], false, true);
session_start();
}
if (!headers_sent()) {
$params = session_get_cookie_params();
setcookie(session_name(), session_id(), time() + 172800, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
}
Line 722 of my script
function verify_logged_in() {
if( ! isset( $_SESSION['logged_in'] ) || $_SESSION['logged_in'] !== true ) {
unset( $_SESSION['logged_in'] );
unset( $_SESSION['last_used'] );
unset( $_SESSION['user_id'] );
unset( $_SESSION['user_type'] );
unset( $_SESSION['user_name'] );
unset( $_SESSION['full_name'] );
unset( $_SESSION['email'] );
unset( $_SESSION['token'] );
session_write_close();
$_SESSION[ 'message' ] = 'U dient opnieuw in te loggen.';
header( 'Location: index.php' );
exit();
}
else {
$_SESSION['last_used'] = date( DATE_TIME_FORMAT );
}
<?php
require_once 'functions.php';
$lang = "en";
if (isset($_SESSION['language'])) {
$lang = $_SESSION['language'];
}
require_once "lang.".$lang.".php";
verify_logged_in();
verify_user_level(['Editor', 'Moderator']);