<?

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



	// ========================================================================================
	
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_ecom.gif" width="20" height="21" align="middle"> '.$MsgText[9][13];
	$BrowserTitle = $MsgText[9][13];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/store-categories.html">'.$MsgText[9][2].'</a> > '.$MsgText[9][13];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[901] == 'y') {
		
		
			ReadFormArguments();
			Global $FormArguments;
			
			
			if (count($FormArguments) > 0) {
			
				if ($FormArguments['DeleteCategory'] == 'yes') {
					$query = "delete from `".$Settings['DBPrefix']."ec-Categories` where RecordNumber='".$FormArguments['CategoryIDToEdit']."' limit 1";
					$result = mysql_query($query) or die (mysql_error());				
				}
				else {
					if ($FormArguments['CategoryID'] == '') {
						$FormArguments['CategoryID'] = $FormArguments['CategoryIDToEdit'];
					}
				
					$query = "update `".$Settings['DBPrefix']."ec-Categories` set CategoryID='".$FormArguments['CategoryID']."', Name='".$FormArguments['CategoryName']."', Description='".$FormArguments['CategoryDescription']."', Parent='".$FormArguments['CategoryParent']."' where RecordNumber='".$FormArguments['CategoryIDToEdit']."' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				}
				
				
				header('Location: '.$MainURL.'/admin/store-categories.html');
				
			}
			else {
			
				$PageContents = $MsgText[0][98];
			
			}
		
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
