diff --git a/resources/check_auth.php b/resources/check_auth.php index 098952c025..18bc46af7f 100644 --- a/resources/check_auth.php +++ b/resources/check_auth.php @@ -44,14 +44,24 @@ } //regenerate sessions to avoid session id attacks such as session fixation - if (array_key_exists('security',$_SESSION) && $_SESSION['security']['session_rotate']['boolean'] == "true") { + if (isset($_SESSION['authorized']) && $_SESSION['authorized']) { $_SESSION['session']['last_activity'] = time(); if (!isset($_SESSION['session']['created'])) { $_SESSION['session']['created'] = time(); - } else if (time() - $_SESSION['session']['created'] > 28800) { - // session started more than 8 hours ago + } elseif (time() - $_SESSION['session']['created'] > 28800) { + //session started more than 8 hours ago session_regenerate_id(true); // rotate the session id $_SESSION['session']['created'] = time(); // update creation time + + //build the user log array + $log_array['domain_uuid'] = $_SESSION['domain_uuid']; + $log_array['domain_name'] = $_SESSION['domain_name']; + $log_array['username'] = $_SESSION['username']; + $log_array['user_uuid'] = $_SESSION['user_uuid']; + $log_array['authorized'] = true; + + //add the result to the user logs + user_logs::add($log_array); } }