<?

/*
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 = $MsgText[0][618];
	$BrowserTitle = $MsgText[0][618];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/countries.html">'.$MsgText[0][581].'</a> > '.$MsgText[0][618];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[21] == 'y') {
		
			if ($Arguments3 != '') {
				
				$query = "select * from `".$Settings['DBPrefix']."core-Countries` where RecordNumber='".intval($Arguments3)."' limit 1";
				$result = mysql_query($query) or die (mysql_error());
				$row = mysql_fetch_array($result);
				
								
				$PageContents = '<br><form action="'.$MainURL.'/admin/countries-edit-save" method="post"><input type="hidden" name="ID" value="'.$Arguments3.'"><b>'.$MsgText[0][619].':</b><br><input type="text" name="Name" size="30" maxlength="100" style="'.$FormStyle.'" value="'.str_replace('"','&#34;',$row['Name']).'"><br><br><b>'.$MsgText[0][620].':</b><br><input type="text" name="Code" size="2" maxlength="2" style="'.$FormStyle.'" value="'.str_replace('"','&#34;',$row['Code']).'"><br><br><b>'.$MsgText[0][621].':</b><br><input type="text" name="StateProvTitle" size="30" maxlength="100" style="'.$FormStyle.'" value="'.str_replace('"','&#34;',$row['StateProvTitle']).'"><br>('.$MsgText[0][622].')<br><br><br><input type="checkbox" name="Remove" value="y"> '.$MsgText[0][156].'<br><br><br><input type="submit" value="'.$MsgText[0][123].'" style="'.$FormStyle.'"></form>';

				
				if ($row['StateProvTitle'] == '') {
					$row['StateProvTitle'] = $MsgText[0][623];
				}

				$PageContents .= '<br><hr><br><b>'.$row['StateProvTitle'].' '.$MsgText[0][624].':<br>('.$MsgText[0][625].')</b><br><br>';
				
				$query2 = "select * from `".$Settings['DBPrefix']."core-StatesProvinces` where Country='".$row['Code']."' order by Name asc";
				$result2 = mysql_query($query2) or die (mysql_error());
				while ($row2 = mysql_fetch_array($result2)) {
					$PageContents .= '<a href="'.$MainURL.'/admin/countries-sp-edit/'.$row['RecordNumber'].'/'.$row2['RecordNumber'].'.html">'.$row2['Name'].' ('.$row2['Code'].')</a><br>';
				}
				
				$PageContents .= '<br><br><b>'.$MsgText[0][626].' '.$row['StateProvTitle'].':</b><br><form action="'.$MainURL.'/admin/countries-sp-new/'.$row['RecordNumber'].'" method="post"><input type="hidden" name="Country" value="'.$row['Code'].'"><b>'.$MsgText[0][619].':</b><br><input type="text" name="Name" size="30" maxlength="100" style="'.$FormStyle.'" ><br><br><b>'.$MsgText[0][620].':</b><br><input type="text" name="Code" size="10" maxlength="10" style="'.$FormStyle.'"><br><br><input type="submit" value="'.$MsgText[0][626].' '.$row['StateProvTitle'].'" style="'.$FormStyle.'"></form>';
				
			}
			
			else {
				$PageContents = $MsgText[0][98];
			}
					
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

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




?>
