static public redirectToLogin ( $params = '' ) : nothing | ||
$params | param to add to URL (default '') | |
return | nothing |
static function redirectToLogin($params = '')
{
global $CFG_GLPI;
$dest = $CFG_GLPI["root_doc"] . "/index.php";
$url_dest = str_replace($CFG_GLPI["root_doc"], '', $_SERVER['REQUEST_URI']);
$dest .= "?redirect=" . rawurlencode($url_dest);
if (!empty($params)) {
$dest .= '&' . $params;
}
$toadd = '';
if (!strpos($dest, "?")) {
$toadd = '&tokonq=' . Toolbox::getRandomString(5);
}
echo "<script language=javascript>\n NomNav = navigator.appName;\n if (NomNav=='Konqueror') {\n window.location='" . $dest . $toadd . "';\n } else {\n window.location='" . $dest . "';\n }\n </script>";
exit;
}
/** * Global check of session to prevent PHP vulnerability * * @since version 0.85 * * @see https://wiki.php.net/rfc/strict_sessions **/ static function checkValidSessionId() { if (!isset($_SESSION['valid_id']) || $_SESSION['valid_id'] !== session_id()) { Html::redirectToLogin('error=3'); } return true; }