setPreference('lastTheme',$theme); $GLOBALS['current_user']->call_custom_logic('before_logout'); // submitted by Tim Scott from SugarCRM forums foreach($_SESSION as $key => $val) { $_SESSION[$key] = ''; // cannot just overwrite session data, causes segfaults in some versions of PHP } if(isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } //Update the tracker_sessions table // clear out the authenticating flag session_destroy(); LogicHook::initialize(); $GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout'); // go to the login screen. header("Location: index.php?action=Login&module=Users"); sugar_cleanup(true); ?>