<?

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



	// ========================================================================================
	// admin permissions page
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_usersandpermissions.gif" width="19" height="20"> '.$MsgText[0][55];
	$BrowserTitle = $MsgText[0][55];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[0][55];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[4] == 'y') {
							
			ReadFormArguments();
			Global $FormArguments;
			
			if (count($FormArguments) > 0) {
			
			
			for ($i = 1; $i <= $FormArguments['RowsCount']; $i++) {
				
				// if the level has changed, and there hasn't been any foul play
				if ($FormArguments['NewLevel'.$i] != $FormArguments['PreviousLevel'.$i] && $FormArguments['NewLevel'.$i] <= $UserLevel) {
				
					// update the user's permissions level
					$query = "update `".$Settings['DBPrefix']."core-Users` set Level='".$FormArguments['NewLevel'.$i]."' where Username='".$FormArguments['Username'.$i]."' LIMIT 1";
					$result = mysql_query($query) or die (mysql_error());
				
				}
				
			}
			
			
			if (intval($FormArguments['PageNumber']) > 1) {
				$PageNumber = '/'.intval($FormArguments['PageNumber']);
			}
			else {
				$PageNumber = '';
			}
			
			//header('Location: ' . $MainURL.'/options.html');
			header('Location: ' . $MainURL.'/admin/permissions'.$PageNumber.'.html');
			
			
			}
			else {
				$PageContents = $MsgText[0][98];
			}
			

		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
