note 38593 deleted from function.headers-sent by didou
| From: | didou@php.net | Date: | Mon, 29 Dec 2003 12:23:41 +0000 |
| Subject: | note 38593 deleted from function.headers-sent by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62628@lists.php.net to get a copy of this message | ||
Note Submitter: jonny.keogh@btinternet.com
----
You could also try this, as the full code:
<?php
// If no headers are sent, send one
if (!headers_sent()) {
header ('Location: http://www.example.com/');
exit;
}
// An example using the optional file and line parameters, as of PHP 4.3.0
// Note that $filename and $linenum are passed in for later use.
// Do not assign them values beforehand.
if (!headers_sent($filename, $linenum)) {
header ('Location: http://www.example.com/');
exit;
// You would most likely trigger an error here.
} else {
// The following will only work if they have JavaScript enabled!
print "<script language=Jscript>
window.location='http://www.example.com/';
</script>\n";
// In case the user has not got JavaScipt enabled, try VBScript.
print "<script language=VBScript>
window.location='http://www.example.com/'
</script>\n";
//And then, if all doesn't succeed, just ask the user to click the link:
print "<p>If you see this message for more than 5 seconds, <a href='http://www.example.com/'>click
here</a>.</p>";
exit;
}
?>