/**
* Logout
*
* @access public
* @return mixed HTML (returns HTML only if header() fails)
*/
function &logout() { // STATIC VOID OR HTML STRING METHOD
global $projectFolderName, $projectURLPath, $willAuthenticate, $projectAcronym, $phpVersionInt;
if ($willAuthenticate) setcookie("$projectFolderName", '', time() - 86400, '/'); // DELETE COOKIE
foreach ($_SESSION as $key => $val) {
if (preg_match("/^{$projectAcronym}_/i", $key)) {
$_SESSION[$key] = '';
unset($_SESSION[$key]); // DELETE ALL PROJECT SESSION VARIABLES
}
}
global $_SESSION;
@flush();
if ((int)$phpVersionInt > 420) @ob_flush(); // YOU CAN ONLY FLUSH OUTPUT BUFFER IN PHP VERSIONS 4.2+
clearstatcache();
if (headers_sent()) die('headers already sent!');
//header('Location: [url]http://[/url]' . $_SERVER['SERVER_NAME'] . "$projectURLPath/index.php"); // DEFAULT REDIRECT TO MAIN PAGE
header('Location: [url]http://www.adnet-sys.com[/url]');
exit;
/* $html .= "\n<script type=\"text/javascript\">\n<!--\n location.href = 'http://" . $_SERVER['SERVER_NAME'] . "$projectURLPath/index.php';\n//-->\n" .
"</script>\n<noscript>\n <meta http-equiv=\"Refresh\" contents=\"0;URL=http://" . $_SERVER['SERVER_NAME'] .
"$projectURLPath/index.php\">\n</noscript>\n";
return $html;
*/
}
My logout class method fails now due to lack of redirection. I realize that header() fails if there is HTML before it (which I checked using headers_sent() which came back false) but it actually should stop immeidately after the header(), yet it does not.
Can someone tell me how to ensure that all processing stops immediately after a header() to ensure server-side redirection?
Thanx
Phil