on my web app when log off is selected i destroy all sessions then print this into the html
print "<META HTTP-EQUIV='Refresh' CONTENT='0'>";
rather than use the php header redirect since its all being done in the body and i have many includes going around. i thought that meta tag wouldnt work anywhere else other than header and thought i should give it a try and it worked! but now what im thinking is , is this method ok to use as an alternative to the php header redirect? i really hate how the php redirect was created, the fact that it need to not have any spaces or content before it for it to actually work.
let me know what you think. thanks
fyi this is how the log of is written.
the url will has a param like this: the-page?action=logoff
then this is written in the header.php page that is included in every page
if(isset($_GET['action']) && $_GET['action'] == "logoff")
{
session_destroy();
print "<META HTTP-EQUIV='Refresh' CONTENT='0'>";
}
It’s probably easy to solve your problem using output buffering.
Just
ob_start()at the top of your script (or in some config.php file, or something), and you’ll have no problems using header() regardless of what output functions you use before the need to redirect.