note 17487 deleted from ref.http by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 23:26:57 +0000 |
| Subject: | note 17487 deleted from ref.http by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23561@lists.php.net to get a copy of this message | ||
Here's a small function that will make sure a page is redirected as instructed whether the http
headers have already been sent or not. This is especially neat with global "security
schemes", but remember that some client-side javascript is involved, so don't bet your
life on it.
<?php
function redirectMe($url="/") {
if (!header_sent()) {
header("Location:".$url);
} else {
echo ("<script
language='Javascript'>top.location.href='$url';</script>");
}
}
?>
Enjoy!