<?PHP

/*
 *	W-AGORA 4.0
 *	-----------
 *	$Id: logout.php,v 1.3 2003/09/19 15:32:13 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($HTTP_GET_VARS['redirect'])) {
		$redirect_url = $HTTP_GET_VARS['redirect'];
	} elseif (empty($redirect_url)) {
		$redirect_url = "$bn_base_url/$main_page?site=$site";
	}

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