0) { $tokenTime = strtotime($time); $diff = abs($tokenTime - time()) / 60; if ($diff > $settingsInfo['expiration_time']) { Display::addFlash(Display::return_message('Token expired', 'error')); header('Location: '.api_get_path(WEB_PATH)); exit; } } // Get the user info $userInfo = api_get_user_info_from_email($email); // Log-in user if exists or a show error message if (!empty($userInfo)) { Session::write('_user', $userInfo); Session::write('is_platformAdmin', false); Session::write('is_allowedCreateCourse', false); Event::eventLogin($userInfo['user_id']); Session::write('flash_messages', ''); } else { Display::addFlash(Display::return_message(get_lang('UserNotFound'), 'error')); header('Location: '.api_get_path(WEB_PATH)); exit; } header('Location: '.api_get_path(WEB_PATH).'user_portal.php'); exit; } else { Display::addFlash(Display::return_message('Invalid request', 'error')); header('Location: '.api_get_path(WEB_PATH)); exit; }