[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: php скрипт не обрабатывается
Страницы: 1, 2
hausedark3
Здравствуйте, столкнулся с проблемой есть сайт http://uchebniki-vlg.ru/ на старом сервере нормально функционировал, после переезда на более мощное железо, перестала работать форма заказа http://uchebniki-vlg.ru/personal/order/make/ выглядеть форма должна так http://uchebniki-vlg.ru/2015-02-08_18-17-15.png.

Есть код кнопки "Оформить заказ" который переходит на стр. со скриптом
<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Заказы");
?><?$APPLICATION->IncludeComponent("intervolga:sale.order.myshop", ".default", array(

),

false
);?><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>


Этот скрипт обращается к другому на котором уже и написана сама форма, можно скачать

Сам код:

<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?>
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?

CModule::IncludeModule("sale");
CModule::IncludeModule("iblock");
CModule::IncludeModule("currency");
$arSelFields = array("ID", "CALLBACK_FUNC", "MODULE", "PRODUCT_ID", "IBLOCK_ID", "QUANTITY", "DELAY", "CAN_BUY", "PRICE", "WEIGHT", "NAME", "CURRENCY", "CATALOG_XML_ID", "VAT_RATE", "NOTES", "DISCOUNT_PRICE");
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC", "ID" => "ASC"),
array(
"FUSER_ID" => CSaleBasket::GetBasketUserID(),
"LID" => SITE_ID,
"ORDER_ID" => "NULL"
),
false,
false,
$arSelFields
);
$arMSItems = '';
$MSItemsList = '';
$arResult["ALL_AVAIL"] = true;
while ($arBasketItems = $dbBasketItems->GetNext()){
if($arBasketItems["CAN_BUY"] == "Y" && $arBasketItems["DELAY"] == "N"){
$el = CIBlockElement::GetList(array(), array('=ID' => $arBasketItems['PRODUCT_ID']), false, array('nTopCount' => 1), array('IBLOCK_ID'))->Fetch();
if($el['IBLOCK_ID'] != 19)
$arResult["BASKET_ITEMS"][] = $arBasketItems;
elseif ($el['IBLOCK_ID'] == 19){
$msItemTmp = CIBlockElement::GetProperty(19, $arBasketItems['PRODUCT_ID'], array("sort" => "asc"), Array("CODE"=>"MS_ID"))->Fetch();
$rProductAvail = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rProductAvailPostFields = array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'product',
'id' => intval($msItemTmp['VALUE'])
);

$rProductAvail->addPostFields($rProductAvailPostFields);
try {
$xmlProductAvail = new SimpleXMLElement( $rProductAvail->send()->getBody() );

if(intval($xmlProductAvail->availability_code) == 0){
//echo $arBasketItems["PRODUCT_ID"]." NOT AVAIL".PHP_EOL;
$arBasketItems["MSNOTAVAIL"] = true;
$arResult["BASKET_ITEMS_MS"][] = $arBasketItems;
$arResult["ALL_AVAIL"] = false;
//CSaleBasket::Delete($arBasketItems['ID']);
} else {
$arBasketItems["MSPRE"] = true;
$MSItemsList .= intval($msItemTmp['VALUE']).': "'.intval($arBasketItems['QUANTITY']).'",'.PHP_EOL;
$arMSItems .= intval($msItemTmp['VALUE']).'-'.intval($arBasketItems['QUANTITY']).',';
$arResult['BASKET_ITEMS_MS'][] = $arBasketItems;
//echo $arBasketItems["NAME"]." [".$arBasketItems["QUANTITY"]."]"." | My-shop ID: ".$msItemTmp["VALUE"].PHP_EOL;
}
}
catch (HttpException $expa) {
echo $expa;
}
}
}
}


if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["confirmorder"]) && check_bitrix_sessid() && count($arResult["BASKET_ITEMS_MS"]) > 0){
$arMSItems = rtrim($arMSItems, ",");
$stringPhoneTime = intval($_POST['MSTIMEF']).'-'.intval($_POST['MSTIMET']);
//$msLogFile = fopen($_SERVER["DOCUMENT_ROOT"].'/msLogFile', 'a+');

$rPreOrder = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rPreOrderPostFields = array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'order_pre',
'cart' => $arMSItems,
'delivery' => intval($_POST['MSDELIVERY']),
'payment' => intval($_POST['MSPAYMENT']),
'region' => intval($_POST['MSREGION']),
);

//fwrite($msLogFile, print_r($rPreOrderPostFields,true));

$rPreOrderPostFields['zip_code'] = intval($_POST['MSZIP']);

//fwrite($msLogFile, print_r($rPreOrderPostFields,true));

$rPreOrder->addPostFields($rPreOrderPostFields);
try {
$xmlPreOrder = new SimpleXMLElement( $rPreOrder->send()->getBody() );
if(intval($xmlPreOrder->order_ok) == 1){
$rOrder = new HttpRequest('https://my-shop.ru/cgi-bin/p/order.pl', HttpRequest::METH_POST);
$rOrderPostFields = array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'order_new',
//'test' => '1',
'cart' => $arMSItems,
'sum_total' => (string)$xmlPreOrder->sum_total,
'time_date' => (string)$xmlPreOrder->time_date,
'name' => iconv('utf-8', 'cp1251', htmlspecialchars($_POST['MSFIO'])),
'phone_time' => $stringPhoneTime,
'delivery' => intval($_POST['MSDELIVERY']),
'payment' => intval($_POST['MSPAYMENT']),
'phone_sms' => htmlspecialchars($_POST['MSNUMBER']),
);


if(intval($_POST['DELIVERY']) != 1)
$rOrderPostFields['region'] = htmlspecialchars($_POST['MSREGION']);

if(intval($_POST['DELIVERY']) == 0)
$rOrderPostFields['metro'] = intval($_POST['MSMETRO']);

$rOrderPostFields['zip_code'] = intval($_POST['MSZIP']);

if(!empty($_POST['MSADDRESS']))
$rOrderPostFields['address'] = iconv('utf-8', 'cp1251', htmlspecialchars($_POST['MSADDRESS']));

if(!empty($_POST['MSPHONES']))
$rOrderPostFields['phone'] = htmlspecialchars($_POST['MSPHONES']);

//fwrite($msLogFile, '{'.print_r($rOrderPostFields,true).'}');

$rOrder->addPostFields($rOrderPostFields);
try {
$xmlOrder = new SimpleXMLElement( $rOrder->send()->getBody() );

if(intval($xmlOrder->error) == 0){
$arResult["MYSHOP-DATA"]["ORDER_ID"] = intval($xmlOrder->id);
$arResult["MYSHOP-DATA"]["INFO"] = str_replace("\n", "<br>", (string)$xmlOrder->info_1);
$arResult["MYSHOP-DATA"]["INFO2"] = str_replace("\n", "<br>", (string)$xmlOrder->info_2);
$arResult["MYSHOP-DATA"]["sum_cart"] = floatval($xmlOrder->sum_cart);
$arResult["MYSHOP-DATA"]["sum_delivery"] = floatval($xmlOrder->sum_delivery);
$arResult["MYSHOP-DATA"]["sum_total"] = floatval($xmlOrder->sum_total);
$arResult["MYSHOP-DATA"]["time_text_a"] = (string)$xmlOrder->time_text_a;
$arResult["MYSHOP-DATA"]["time_text_b"] = (string)$xmlOrder->time_text_b;
$arResult["ORDER"]["MS"] = true;
$arResult["USER_VALS"]["CONFIRM_ORDER"] = "Y";
foreach ($arResult['BASKET_ITEMS_MS'] as $k => $v) {
CSaleBasket::Delete($v['ID']);
}
//$this->IncludeComponentTemplate("confirm");
} else {
$arResult["ERROR"][] = (string)$xmlOrder->error_text;
}
//fwrite($msLogFile, "xmlOrder");
//fwrite($msLogFile, print_r($xmlOrder, TRUE));

} catch (HttpException $oex) {
//fwrite($msLogFile, "oex");
//fwrite($msLogFile, print_r($oex, TRUE));

echo $oex;
}
}
else {
$arResult["ERROR"][] = (string)$xmlPreOrder->error_text;
//fwrite($msLogFile, "xmlOrder else");
//fwrite($msLogFile, print_r($xmPrelOrder, TRUE));

}

}
catch (HttpException $expo) {
echo $expo;
}
}


if(count($arResult["BASKET_ITEMS_MS"]) > 0){
$allSumMS = 0;
$allVatSummMS = 0;
$allVatRateMS = 0;
foreach ($arResult['BASKET_ITEMS_MS'] as &$arOneItemMS)
{
$arOneItemMS["PRICE_FORMATED"] = SaleFormatCurrency($arOneItemMS["PRICE"], $arOneItemMS["CURRENCY"]);
$arOneItemMS["DISCOUNT_PRICE_PERCENT"] = $arOneItemMS["DISCOUNT_PRICE"]*100 / ($arOneItemMS["DISCOUNT_PRICE"] + $arOneItemMS["PRICE"]);
$arOneItemMS["DISCOUNT_PRICE_PERCENT_FORMATED"] = roundEx($arOneItemMS["DISCOUNT_PRICE_PERCENT"], SALE_VALUE_PRECISION)."%";
$allSumMS += ($arOneItemMS["PRICE"] * $arOneItemMS["QUANTITY"]);
$allVatSummMS += 0;
if (0 < $arOneItemMS["VAT_RATE"])
{
$arResult["bUsingVat"] = "Y";
if ($arOneItemMS["VAT_RATE"] > $allVatRateMS)
$allVatRateMS = $arOneItemMS["VAT_RATE"];
$arOneItemMS["VAT_VALUE"] = (($arOneItemMS["PRICE"] / ($arOneItemMS["VAT_RATE"] +1)) * $arOneItemMS["VAT_RATE"]);
$allVatSummMS += roundEx($arOneItemMS["VAT_VALUE"] * $arOneItemMS["QUANTITY"], SALE_VALUE_PRECISION);
}
}

if (isset($arOneItemMS))
unset($arOneItemMS);

$arResult["ORDER_PRICE_MS"] = $allSumMS;
$arResult["ORDER_PRICE_FORMATED_MS"] = SaleFormatCurrency($arResult["ORDER_PRICE_MS"], $arResult["BASE_LANG_CURRENCY"]);
$arResult["ORDER_TOTAL_PRICE_FORMATED_MS"] = SaleFormatCurrency($arResult['ORDER_PRICE_MS'], $arResult["BASE_LANG_CURRENCY"]);

$arMSItems = rtrim($arMSItems, ",");
$arResult["XML_MS_ITEMS"] = $arMSItems;
$arResult["XML_MS_ITEMS_LIST"] = $MSItemsList;

$arResult["TEMPLATE"] = array();


$rRegions = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rRegions->addPostFields(array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'list_regions',
)
);

try {
$xmlRegions = new SimpleXMLElement( $rRegions->send()->getBody() );

if(intval($xmlDelivery->error) == 0){
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] = "<table><tbody>";
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '<tr><td><h2>Месторасположение</h2></td></tr>';

$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '<tr><td><select name="MSREGION" onchange="msRegSelect(this.value)">';
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '<option value="">--- Выберите ваше месторасположение</option>';
foreach ($xmlRegions->item as $region) {
if(intval($region->country_id)==1)
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '<option value="'.(string)$region->id.'">'.(string)$region->name.'</option>';
}
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '</select></td></tr>';
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= "</tbody></table>";
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '<script>';
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= 'var jsReg = {';
foreach($xmlRegions->item as $v) {
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= (string)$v->id.':{'.PHP_EOL;
if(intval($v->country_id)==1){
foreach ($v as $k => $r) {
if((string)$k != 'id' && (string)$k != 'name' && (string)$k != 'country_id' && (string)$k != 'delivery_0_free')
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= (string)$k.':"'.(string)$r.'",'.PHP_EOL;
}
}

$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '},';
}
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '}';
$arResult["TEMPLATE"]["TABLE"]["REGIONS"] .= '</script>';
}
}
catch (HttpException $exd) {
echo $exd;
}


$rDelivery = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rDelivery->addPostFields(array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'list_delivery',
)
);

try {
$xmlDelivery = new SimpleXMLElement( $rDelivery->send()->getBody() );


if(intval($xmlDelivery->error) == 0){
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] = "<div><table><tbody>";
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= '<tr><td><h2>Способ доставки</h2></td></tr>';
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= '<tr class="delivery" style="display:none"> <td> <input type="radio" name="MSDELIVERY" id="MS_DELIVERY" value="null"> </td> <td> <label for="MS_DELIVERY"></label> </td> </tr>';
unset($str);
foreach ($xmlDelivery->item as $delivery) {
$str = (string)$delivery->name;
if(strlen($str)>48)
$str = substr($str,0,48).'...';
$noteDel = intval($delivery->info_importance) > 1 ? (string)$delivery->info : '' ;
?>
<?

$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= '
<tr id="delivery_'
.intval($delivery->id).'" class="delivery" style="display:none">
<td>
<input type="radio" name="MSDELIVERY" id="MS_DELIVERY" value="'
.intval($delivery->id).'" onclick="msDeliverySelect(this.value)">
</td>
<td>
<label for="MS_DELIVERY" value="'
.intval($delivery->id).'">'.$str.'</label>
<span style="font-size:11px;color:#f00">'
.$noteDel.'</span>
</td>
</tr>'
;
?>
<?

}
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= '</tbody></table></div>';
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= "<script>";
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= 'var jsDel = {';
foreach ($xmlDelivery->item as $vue) {
$pays = explode(',', (string)$vue->payment);
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= intval($vue->id).':{'.PHP_EOL;
foreach ($pays as $key => $value) {
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= $value.':"'.$value.'",'.PHP_EOL;
}
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= '},'.PHP_EOL;
}
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= '}';
$arResult["TEMPLATE"]["TABLE"]["DELIVERY"] .= "</script>";
}
}
catch (HttpException $exd) {
echo $exd;
}

$rMetroList = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rMetroList->addPostFields( array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'list_metro',
)
);

try {
$xmlMetroList = new SimpleXMLElement( $rMetroList->send()->getBody() );

$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] = '<table class="subway_list" style="display:none"><tbody>';
$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] .= '<tr><td><h2>Станция метро:</h2></td></tr>';

$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] .= '<tr><td><select name="MSMETRO">';
$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] .= '<option value="">--- Выберите станцию метро</option>';
foreach ($xmlMetroList->item as $station) {
$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] .= '<option value="'.(string)$station->id.'" style="background-color:#'.(string)$station->rgb.'">'.(string)$station->station.' ('.(string)$station->line.')</option>';
}
$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] .= '</select></td></tr>';
$arResult["TEMPLATE"]["TABLE"]["METRO_LIST"] .= '</tbody></table>';

} catch(HttpException $mex) {
echo $mex;
}

$rPaySystems = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rPaySystems->addPostFields(array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'list_payment',
)
);

try {
$xmlPaySys = new SimpleXMLElement( $rPaySystems->send()->getBody() );

if(intval($xmlPaySys->error) == 0){

$arResult["TEMPLATE"]["TABLE"]["PAY_SYSTEMS"] = '<div><table><tbody>';

$arResult["TEMPLATE"]["TABLE"]["PAY_SYSTEMS"] .= '<tr><td><h2>Платёжная система</h2></td></tr>';

unset($str);
foreach ($xmlPaySys->item as $paysys) {
$str = (string)$paysys->name;
if(strlen($str)>48)
$str = substr($str,0,48).'...';
?>
<?

$arResult["TEMPLATE"]["TABLE"]["PAY_SYSTEMS"] .= '
<tr id="'
.intval($paysys->id).'" class="payment" style="display:none">
<td>
<input type="radio" name="MSPAYMENT" id="MS_PAYMENT" value="'
.intval($paysys->id).'">
</td>
<td>
<label for="MS_PAYMENT">'
.$str.'</label>
</td>
</tr>'
;
?>
<?


}
$arResult["TEMPLATE"]["TABLE"]["PAY_SYSTEMS"] .= '</tbody></table></div>';
}

}
catch (HttpException $ex) {
echo $ex;
}

$rConst = new HttpRequest('https://my-shop.ru/cgi-bin/p/info.pl', HttpRequest::METH_POST);
$rConst->addPostFields(array(
'version' => '1.12',
'partner' => '6473',
'auth_method' => 'plain',
'auth_code' => 'siVxWfIN6lwzAB5XRrlMgby_KRjrIz',
'request' => 'const',
)
);

try {

$xmlConst = new SimpleXMLElement( $rConst->send()->getBody() );
$arResult["TEMPLATE"]["CONDITIONS"] = '<p>Нажимая кнопку "Оформить заказ", Вы подтверждаете свое согласие со следующими условиями:</p>';
$arResult["TEMPLATE"]["CONDITIONS"] .= '<textarea cols="96" rows="36" lang="ru" disabled="disabled" wrap="soft" class="ms-conditions">';
$arResult["TEMPLATE"]["CONDITIONS"] .= (string)$xmlConst->conditions;
$arResult["TEMPLATE"]["CONDITIONS"] .= '</textarea>';
} catch (HttpException $rex) {
echo $rex;
}
}

//print_r($arResult);
$this->IncludeComponentTemplate();
?>


Возможна проблема в конфигурации сервера, помоги решить что нужно сделать чтобы заработало?))

Версия сервера: 5.5.40-0+wheezy1
Версия PHP 5.4.4-14+deb7u14
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2025 Invision Power Services, Inc.