class LoginSessionGenerator {
/**
* Logout
*
* @access public
*/
function &logout() { // STATIC VOID METHOD
global $projectFolderName, $projectURLPath, $willUseSSL, $willAuthenticate, $willBasicAuthenticate, $projectAcronym;
if ($willAuthenticate || $willBasicAuthenticate) setcookie("$projectFolderName", '', time() - 86400, '/'); // DELETE COOKIE
foreach ($_SESSION as $key => $val) {
if (preg_match("/^{$projectAcronym}_/i", $key)) {
unset($_SESSION[$key]); // DELETE ALL PROJECT SESSION VARIABLES
session_unregister("$key"); // DELETE FROM THE SESSION FILE REFERENCED BY $PHPSESSID
}
}
if ($willBasicAuthenticate) {
unset($_SERVER['PHP_AUTH_USER']);
unset($_SERVER['PHP_AUTH_PW']);
if (preg_match('/IIS/i', $_SERVER['SERVER_SOFTWARE'])) unset($_SERVER['HTTP_AUTHENTICATION']);
}
header('Pragma: no-cache'); // ENSURE CLIENT-SIDE CACHE FLUSHING
if ($willAuthenticate && $willUseSSL) {
$dest = 'https://' . $_SERVER['SERVER_NAME'] . "$projectURLPath/index.php";
} elseif ($willBasicAuthenticate && $willUseSSL) {
$dest = 'https://EnterYourUserName:EnterPassword@' . $_SERVER['SERVER_NAME'] . "$projectURLPath/index.php";
} elseif ($willAuthenticate) {
$dest = 'http://' . $_SERVER['SERVER_NAME'] . "$projectURLPath/index.php";
} elseif ($willBasicAuthenticate) {
$dest = 'http://EnterYourUserName:EnterPassword@' . $_SERVER['SERVER_NAME'] . "$projectURLPath/index.php";
}
header("Location: $dest"); // DEFAULT REDIRECT TO MAIN PAGE
exit();
}
}
This class method works perfectly using Mozilla Firefox 0.6, however, if the user is using MSIE, their cookies are never deleted, their sessions are never deleted and they're not even redirected!!
Please help, I'm stuck!
Thanx
Phil