note 58224 deleted from function.header by bjori
| From: | bjori@php.net | Date: | Mon, 27 Mar 2006 09:44:51 +0000 |
| Subject: | note 58224 deleted from function.header by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106707@lists.php.net to get a copy of this message | ||
Note Submitter: daniel dot eherbert at gmail dot com
----
Thanks to my work mate "the 'ton" we've worked out a way to prevent redirects in
included files (in the event that you aren't able to alter the included files).
Because the ob callback is called before the php process is terminated, we still have a chance to
override the header, or alter them as needed
<?php
function overrideHeader($buffer)
{
header('Location: _your_Location_');
exit;
return $buffer;
}
ob_start('overrideHeader');
include('login.php'); //a script that you may not be able (or allowed ;) ) to change, such
as phpBB's login file which redirects and exits straight after the redirect
$code = ob_get_contents();
ob_end_clean();
?>