if (!isset($_SESSION)) {
$session = new \DB\SQL\Session(
$f3->get('DB'),
'sessions',
false /* DB should be created using the update scripts, so no TRUE here */,
function ($session) {
$f3 = \Base::instance();
$old_ip = $session->ip();
$old_agent = $session->agent();
$current_ip = strval($f3->get('IP') ?? '');
$current_agent = strval($f3->get('AGENT') ?? '');
if (($old_ip != $current_ip) || ($old_agent != $current_agent)) {
debuglog("ONSUSPECT: user changed from [$old_ip] $old_agent");
debuglog("ONSUSPECT: to [$current_ip] $current_agent");
} else {
debuglog("ONSUSPECT: called, but no observed difference: $current_ip $current_agent");
}
return true;
},
'CSRF'
);
} else {
// Only expecting this bit if the database has been updated in sanityCheck(),
// which is needed before we attempt to store the session there.
//
// php7.2 generates a 'Cannot change session name when session is active' error otherwise
}