<?PHP

/*
 *	W-AGORA 4.0
 *	-----------
 *	$Id: logout.php,v 1.4 2005/06/04 10:14:43 mdruilhe Exp $
 *	Usage:		logout the user
 *	Author:		Marc Druilhe <mdruilhe@w-agora.com>
 *
 */

	$bn_action="logout";
	define("no_auth_required", 1);		// Don't authenticate the user, he want to logout !!
	require ("init.inc");

# Execute before_access program
# -----------------------------
	if (!empty($before_access)) include $before_access;

# log out the user from w-agora
# -----------------------------
	if ($is_authenticated) {
		$auth->logout($site);
	}

# set the url where to redirect after log out 
# can be set either throw the 'redirect' parameter in the URL or by setting
# $redirect_url' in the before_access file
# ---------------------------------------------------------------------
	if (!empty($_GET['redirect'])) {
		$redirect_url = $_GET['redirect'];
	} elseif (empty($redirect_url)) {
		$redirect_url = "$bn_base_url/$main_page?site=$site";
	}

	header ("Location: $redirect_url");
?>
