<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// end login session
	// ========================================================================================

	//$PageTitle = 'Logout';
	//$BrowserTitle = 'Logout';
	//$LocationBar = '<a href="'.$IndexURL.'">Home</a> > Logout';
	
	
	//ReadFormArguments();
	//Global $FormArguments;
	
	
	if ($LoggedIn == 'y') {
	
		DBConnect();
		
		$query = "update `".$Settings['DBPrefix']."core-Users` set SessionLength='0', LastAction='".GetTimestamp()."' where Username='".$CookieUsername."' LIMIT 1";
		$result = mysql_query($query) or die (mysql_error());
		
		$query = "delete from `".$Settings['DBPrefix']."core-RecentActivity` where User='".$CookieUsername."' LIMIT 1";
		$result = mysql_query($query) or die (mysql_error());
	
	}
	
					
	ob_start();
			
		$CookieData = 'not_logged_in';
				
		setcookie ($CookieName, $CookieData, 0, '/');
						
		header('Location: '.$IndexURL);
						
	ob_end_flush();
				

	

	// ========================================================================================




?>
