<?

/*
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
*/



	// ========================================================================================
	// Save New Board
	// ========================================================================================
	
	$PageTitle = $MsgText[2][4];
	$BrowserTitle = $MsgText[2][4];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[2][4];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		// if permissions are correct and arguments haven't been forged
		if ($Permissions[204] == 'y') {
	
		
			$query = "select max(BoardOrder) as MaxOrder from `".$Settings['DBPrefix']."mb-Boards` limit 1";
			$result = mysql_query($query) or die (mysql_error());
			$row = mysql_fetch_array($result);
				
			$NextOrder = ($row['MaxOrder'] + 1);
			
			
			ReadFormArguments();
			Global $FormArguments;
			
			if ($FormArguments['BoardOrder'] == '') {
				$FormArguments['BoardOrder'] = $NextOrder;
			}
			
			$query = "insert into `".$Settings['DBPrefix']."mb-Boards` (Title, Description, Category, BoardOrder, MinLevel) values('".$FormArguments['Title']."','".$FormArguments['Description']."','".$FormArguments['Category']."','".$FormArguments['BoardOrder']."','".$FormArguments['MinLevel']."')";
			$result = mysql_query($query) or die (mysql_error());
		
			
	
			header('Location: '.$MainURL.'/admin/messageboard_boardsandcats.html');
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

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




?>
