note 20809 deleted from function.header by sniper

From: Date: Sun, 07 Sep 2003 21:27:22 +0000
Subject: note 20809 deleted from function.header by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55599@lists.php.net to get a copy of this message
Note Submitter: chamele0nDOT1ATemailDOTcom ---- just made this for http1.1 compliant use of location: header redirections function redirectTo($newUrl) { // TODO: protocol possibilities need to be extended to indclude any other // desried protocols - ftp:// mnp:// whatever... $newUrl = trim($newUrl); if (!(strpos($newUrl, "http://") === 0 || strpos($newUrl, "https://") === 0)) { $newUrl = "http" . ($_SERVER['HTTPS'] == "on" ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . (strpos($newUrl, "/") === 0? $newUrl : dirname($_SERVER['PHP_SELF']) . "/" . $newUrl); } header("Location: " . $newUrl); exit(); }

« previous php.notes (#55599) next »