Html::redirect PHP Méthode

redirect() static public méthode

Redirection hack
static public redirect ( $dest ) : nothing
$dest string: Redirection destination
Résultat nothing
    static function redirect($dest)
    {
        $toadd = '';
        $dest = addslashes($dest);
        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

 function checkRight($itemtype, $right)
 {
     global $CFG_GLPI;
     if (!Session::haveRight($itemtype, $right)) {
         // Check for session timeout
         if (!isset($_SESSION['glpiID'])) {
             Html::redirect($CFG_GLPI['root_doc'] . '/index.php');
             exit;
         }
         Html::displayRightError();
     }
 }
All Usage Examples Of Html::redirect
Html