Размер файла: 2.46Kb
<?
/* E-Port orders verifier */
include("../inc/config.php");
include("../inc/funcs.php");
/* CHECK IP HERE */
if($_SERVER["REMOTE_ADDR"]!=$EPORT['server_ip']){
@mail($SUPPORT_EMAIL,"Ошибка в EPORT скрипте. IP неверен!", "IP ".$_SERVER["REMOTE_ADDR"],"From:".$SETTINGS['site_name']." System<$SUPPORT_EMAIL>");
exit;
}
if(!isset($_POST)){
exit;
}
reset ($_POST);
$test="";
while (list($key, $value) = each ($_POST)) {
$$key = trim($value);
$test .= "$key = $value\n";
}
@mail($SUPPORT_EMAIL,"EPORT", $test,"From:".$SETTINGS['site_name']." System<$SUPPORT_EMAIL>");
/* updating order */
if(!is_numeric($ShopOrderID)){
exit;
}
$query = "select eport_orders.*, orders.amount_from, orders.ex_currency_from_comission, ex_currencies.precision from eport_orders inner join (orders inner join ex_currencies on orders.ex_currency_from_id=ex_currencies.id) on orders.from_order_id = eport_orders.id where ex_currencies.code='EPD' and eport_orders.id=$ShopOrderID and eport_orders.status=1 and eport_orders.type=0";
$row = @mysql_fetch_object(@mysql_query($query));
if($row->id==""){
@mail($SUPPORT_EMAIL,"EPORT", $query,"From:".$SETTINGS['site_name']." System<$SUPPORT_EMAIL>");
exit;
}
/* double checking order */
if(!EPortCheckInv($row->id,round($row->amount_from-$row->ex_currency_from_comission+0,$row->precision))){
$msg = "Здравствуйте!\n\nОшибка при повторной проверке оплаты в EPORT скрипте.\nЗаказ # ".$ShopOrderID;
@mail($SUPPORT_EMAIL,"Ошибка в EPORT скрипте. Повторная проверка не прошла!", $msg,"From:".$SETTINGS['site_name']." System<$SUPPORT_EMAIL>");
exit;
}
@mysql_query("update eport_orders set status = 0, eport_order_id = '$ID', sum_eye = '$SumEYE', sum_rur = '$SumRUR' where id=$row->id");
/* tranfering money */
$row = @mysql_fetch_object(@mysql_query("select orders.* from orders left outer join ex_currencies on orders.ex_currency_from_id = ex_currencies.id where orders.from_order_id=$ShopOrderID and orders.status=1 and orders.to_status=1 and ex_currencies.code='EPD'"));
if($row->id==""){
exit;
}
@mysql_query("update orders set from_status = 0, batch_from ='$ID' where id = $row->id");
/*tranfering money*/
/* changing balance */
$comments = "Зачисление средств из EPort в систему. Операция обмена # $row->id.";
ChangeBalance($row->ex_currency_from_id,round($row->amount_from-$row->ex_currency_from_comission+0,$row->precision),$comments);
if($row->id!=""){
CompleteExchange($row->id);
}
exit;
?>