Почему сервер отдает данные, которые js-скрипт не рассчитывает получить?

На этой странице сайта есть калькулятор окон ПВХ - https://www.plastok.ru/windows/calculator.html
Калькулятор не работает после смены хостинга сайта.
Как я понимаю сервер отдает данные, которые js-скрипт не рассчитывает получить.
Файл - ajax_calculator.php:
<?

if(empty($inmodule)){

mysql_connect("localhost","plastok","ibY14lJs");
mysql_select_db("plastok");
mysql_query("SET NAMES CP1251");

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Дата в прошлом

}else{
	
}

error_reporting(0);
if(!isset($_GET['exact'])){
	$x=(int)$_GET['x']-1; 
	$y=(int)$_GET['y']-1;

	$x=($x-$x%5)*10;
	$y=($y-$y%5)*10;
}
else{
	$x=(int)$_GET['x']; 
	$y=(int)$_GET['y'];
}	
$type=($_GET['type']);
$type2=($_GET['type']);
// "Зеркальные" типы окон
if($type=='f2120')$type2='f2210';
if($type=='f2130')$type2='f2310';
if($type=='f2230')$type2='f2320';

if($type=='f3121')$type2='f3211';
if($type=='f3122')$type2='f3212';
if($type=='f3321')$type2='f3231';
if($type=='f3322')$type2='f3232';
if($type=='f3131')$type2='f3311';
if($type=='f3132')$type2='f3312';
if($type=='f3231')$type2='f3321';

if($type=='f4112')$type2='f4211';
if($type=='f4113')$type2='f4311';
if($type=='f4312')$type2='f4213';
if($type=='f4122')$type2='f4221';
if($type=='f4123')$type2='f4321';
if($type=='f4322')$type2='f4223';
if($type=='f4132')$type2='f4231';
if($type=='f4133')$type2='f4331';
if($type=='f4233')$type2='f4332';

if($type=='f6120')$type2='f6210';
if($type=='f6320')$type2='f6230';
if($type=='f6130')$type2='f6310';

//$profile=$_GET['profile'];
//$x=1500;
//$y=2200;
//$type='п-о+гл';

//echo "SELECT * from `window_calc_new` where `x`='$x' and `y`='$y' and (`type`='$type' or `type`='$type2')";die;
if(!empty($x)){
	if(isset($_GET['local_id'])){
		$result_q_x=mysql_query("SELECT * from `window_calc_new` where (`type`='$type' or `type`='$type2') ORDER BY ABS(`x` - '$x') LIMIT 1,1") or die(mysql_error());
		$first_result_x = mysql_fetch_array($result_q_x);
		$result_q_y=mysql_query("SELECT * from `window_calc_new` where `x`='$first_result_x[x]' and (`type`='$type' or `type`='$type2') ORDER BY ABS(`y` - '$y') LIMIT 1,1") or die(mysql_error());
		$first_result_y = mysql_fetch_array($result_q_y);
		$result_q=mysql_query("SELECT * from `window_calc_new` where `x`='$first_result_x[x]'  and `y`='$first_result_y[y]' and (`type`='$type' or `type`='$type2')") or die(mysql_error());

	}
	else
		$result_q=mysql_query("SELECT * from `window_calc_new` where `x`='$x' and `y`='$y' and (`type`='$type' or `type`='$type2')") or die(mysql_error());
	$pricelist=array();
	while($oneprice=mysql_fetch_array($result_q)){
																		// vvvvv < СКИДКА ТУТ
	if(!preg_match('/fb/',$type))$oneprice['price']=$oneprice['price']*(1-0.286)*0.97*0.94;   
																		    //   ^^^^ -3% скидка
	switch($oneprice['profile']){
		case "Bl":$oneprice['price']=$oneprice['price']*1.03*1.0953*0.95*1.066*1.109;break;//*1.45
		case "Dl":$oneprice['price']=$oneprice['price']*1.05*1.0908*0.95*1.15*1.048;break;//*1.42
		case "Br":$oneprice['price']=$oneprice['price']*1.25*1.4531*0.76*1.07*0.86;break;
		case "Gn":$oneprice['price']=$oneprice['price']*1.25*1.23*1.12*0.9357;break;//*1.14
		
		case "En":$oneprice['price']=$oneprice['price']*1.03*1.1147;break;
		case "Ek":$oneprice['price']=$oneprice['price']*1.05*1.1227;break;
		case "Sl":$oneprice['price']=$oneprice['price']*1.15*1.1103*1.03;break;
	}
	
	if(isset($_GET['local_id']))
		$oneprice['local_id'] = $_GET['local_id'];
		
	$pricelist[]=$oneprice;
	
	if($oneprice['profile']=='Bl'){
		$oneprice['price']=$oneprice['price']*1.11;
		$oneprice['profile']='Gr';
		$pricelist[]=$oneprice;
	}
	
		
	};

	if(empty($inmodule)){
		echo json_encode($pricelist); 
	}
}else{
$bounds=array();
list($bounds['xmax'])=mysql_fetch_array(mysql_query("SELECT max(x) from `window_calc_new` where (`type`='$type' or `type`='$type2')"));
list($bounds['ymax'])=mysql_fetch_array(mysql_query("SELECT max(y) from `window_calc_new` where (`type`='$type' or `type`='$type2')"));
list($bounds['xmin'])=mysql_fetch_array(mysql_query("SELECT min(x) from `window_calc_new` where (`type`='$type' or `type`='$type2')"));
list($bounds['ymin'])=mysql_fetch_array(mysql_query("SELECT min(y) from `window_calc_new` where (`type`='$type' or `type`='$type2')"));
echo json_encode($bounds); 
}

?>

Подскажите пожалуйста как это исправить?
  • Вопрос задан
  • 70 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Karpion
Нормально написанный скрипт - игнорирует лишние данные.

По хорошему - надо сверять то, что отдавал старый хостинг, с тем, что отдаёт новый хостинг.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы