<?

/*
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][113];
	$BrowserTitle = $MsgText[9][113];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/store-shipping.html">'.$MsgText[9][72].'</a> > '.$MsgText[9][113];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[903] == 'y') {
		
			ReadFormArguments();
			Global $FormArguments;
		
			if (count($FormArguments) > 0) {
						
				if ($FormArguments['Remove'] == 'y') {
				
					$query = "update `".$Settings['DBPrefix']."ec-Shipping` set Active=0, Deleted=1 where RecordNumber=".$FormArguments['ID']." limit 1";
					$result = mysql_query($query) or die (mysql_error());
				
				
					$PageContents = '<br><br>'.$MsgText[9][114].'<br><br><a href="'.$MainURL.'/admin/store-shipping.html">'.$MsgText[0][564].'</a>';
				
				}
				else {
				
					
					$query2 = "select * from `".$Settings['DBPrefix']."core-Countries` where AllowSales=1 order by Code asc";
					$result2 = mysql_query($query2) or die (mysql_error());
					while ($row2 = mysql_fetch_array($result2)) {
						if ($FormArguments['Countries-'.$row2['Code']] == 'y') {
							$CountriesList .= $row2['Code'].',';
						}
					}
				
						
					$query = "update `".$Settings['DBPrefix']."ec-Shipping` set Description='".$FormArguments['Description']."', Active='".$FormArguments['Active']."', Handling='".$FormArguments['Handling']."', Countries='".$CountriesList."', Calculations='".$FormArguments['Calculations']."', BasePrice='".$FormArguments['BasePrice_'.$FormArguments['Calculations']]."', BaseLimit='".$FormArguments['BaseLimit_'.$FormArguments['Calculations']]."', Price1='".$FormArguments['Price1_'.$FormArguments['Calculations']]."', Unit1='".$FormArguments['Unit1_'.$FormArguments['Calculations']]."', Limit1='".$FormArguments['Limit1_'.$FormArguments['Calculations']]."', Price2='".$FormArguments['Price2_'.$FormArguments['Calculations']]."', Unit2='".$FormArguments['Unit2_'.$FormArguments['Calculations']]."', Limit2='".$FormArguments['Limit2_'.$FormArguments['Calculations']]."', Price3='".$FormArguments['Price3_'.$FormArguments['Calculations']]."', Unit3='".$FormArguments['Unit3_'.$FormArguments['Calculations']]."', Limit3='".$FormArguments['Limit3_'.$FormArguments['Calculations']]."', Price4='".$FormArguments['Price4_'.$FormArguments['Calculations']]."', Unit4='".$FormArguments['Unit4_'.$FormArguments['Calculations']]."', Limit4='".$FormArguments['Limit4_'.$FormArguments['Calculations']]."', Price5='".$FormArguments['Price5_'.$FormArguments['Calculations']]."', Unit5='".$FormArguments['Unit5_'.$FormArguments['Calculations']]."', Limit5='".$FormArguments['Limit5_'.$FormArguments['Calculations']]."', Price6='".$FormArguments['Price6_'.$FormArguments['Calculations']]."', Unit6='".$FormArguments['Unit6_'.$FormArguments['Calculations']]."', Limit6='".$FormArguments['Limit6_'.$FormArguments['Calculations']]."', Price7='".$FormArguments['Price7_'.$FormArguments['Calculations']]."', Unit7='".$FormArguments['Unit7_'.$FormArguments['Calculations']]."', Limit7='".$FormArguments['Limit7_'.$FormArguments['Calculations']]."', Price8='".$FormArguments['Price8_'.$FormArguments['Calculations']]."', Unit8='".$FormArguments['Unit8_'.$FormArguments['Calculations']]."', Limit8='".$FormArguments['Limit8_'.$FormArguments['Calculations']]."' where RecordNumber='".$FormArguments['ID']."' limit 1";
					$result = mysql_query($query) or die (mysql_error());
				
				
					$PageContents = '<br><br>'.$MsgText[0][628].'<br><br><a href="'.$MainURL.'/admin/store-shipping.html">'.$MsgText[0][564].'</a>';
					
				}

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

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
