note 58224 added to function.header
| From: | daniel dot eherbert at gmail dot com | Date: | Fri, 28 Oct 2005 04:45:14 +0000 |
| Subject: | note 58224 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97719@lists.php.net to get a copy of this message | ||
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();
?>
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58224
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58224&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58224&report=yes
Search -- http://master.php.net/manage/user-notes.php