Html::redirectToLogin PHP 메소드

redirectToLogin() 정적인 공개 메소드

Redirection to Login page
static public redirectToLogin ( $params = '' ) : nothing
$params param to add to URL (default '')
리턴 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;
    }

Usage Example

예제 #1
0
 /**
  * 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;
 }
Html