Your IP : 3.15.186.178


Current Path : /home/bitrix/ext_www/flame.ballu.in.ua/php/
Upload File :
Current File : /home/bitrix/ext_www/flame.ballu.in.ua/php/getaddress.php

<?
error_reporting(E_ALL);
header('Content-type: text/html; charset=windows-1251');
header('Access-Control-Allow-Origin: *');
// setlocale(LC_ALL, 'ru_RU.UTF-8');
setlocale(LC_ALL, 'ru_RU.cp1251');
if( isset($_POST["city"]) && $_POST["city"] != '' ){

	$city = iconv('UTF-8', 'CP1251', $_POST["city"]);

	$file_name = 'flame_agents.csv';

	$handle = fopen('php://memory', 'w+');
	fwrite($handle, iconv('UTF-8', 'CP1251', file_get_contents($file_name)));
	rewind($handle);
	while (($row = fgetcsv($handle, 1000, ';')) !== false){
		$parsed[] = $row;
	}
	fclose($handle);
	unset( $parsed[0] );

	$arDiller = array();
	$i = 1;
	
	?>

		
		<?foreach( $parsed as $client )
		{
			// if( strcasecmp($client[1], $city) == 0 )
			if( $client[1] == $city )
			{
				if( !in_array($client[1],$arDiller) )
				{
					$arDiller[] = $client[0];
					if($i != 1){
						?></div><?
					}?>
					<?$i++;?>
					<div class="address">
						<div class="company-title"><?=$client[0]?></div>
					<?}?>
						<?if( $client[2] != '' )
						{?>
							<div><a href='<?=$client[3]?>' target="_blank"><?=$client[2]?></a></div>
						<?}?>

						<?if( $client[4] != '' )
						{?>
							<div><?=$client[4]?></div>
						<?}?>

						<?if( $client[5] != '' )
						{?>
							<div><?=$client[5]?></div>
						<?}?>

						<?if( $client[6] != '' )
						{?>
							<div class="certified"><?=$client[6]?></div>
						<?}?>

			<?}?>
		<?}?>
	<?}
?>