function init() { global $MOD_TITLE, $MOD_GROUP, $MOD_VISIBLE, $MOD_SUBMENU; parent::init($MOD_TITLE, $MOD_GROUP, $MOD_VISIBLE); // получаем список лицевых счетов абонента $this->accounts = array(); $this->urfa->call(-16469); $this->urfa->send(); // получаем количество записей $count = $this->urfa->get_int(); for ($i = 0; $i < $count; $i++) { $aid = $this->urfa->get_int(); // номер лицевого счета // пропускаем два неинтересных нам параметра $this->urfa->get_double(); // денег на счету $this->urfa->get_double(); // ?? // добавлем в списков лицевых счетов $this->accounts[$aid] = $aid; } $this->urfa->finish(); if (isset($_REQUEST['Status'])) { $status = $_REQUEST['Status']; } else { $status = ''; } if ($status == 'pay') { // получаем информацию о текущем пользователе $this->user = array(); $this->urfa->call(-0x4052); $this->urfa->send(); $this->user['id'] = $this->urfa->get_int(); $this->user['login'] = $this->urfa->get_string(); $this->user['basic_account'] = $this->urfa->get_int(); $this->user['balance'] = roundDouble($this->urfa->get_double()); $this->user['credit'] = roundDouble($this->urfa->get_double()); $this->user['is_blocked'] = resolveBlockState($this->urfa->get_int()); $this->user['create_date'] = getDateFromTimestamp($this->urfa->get_int()); $this->user['last_change_date'] = getDateFromTimestamp($this->urfa->get_int()); $this->user['who_create'] = resolveUserName($this->urfa->get_int()); $this->user['who_change'] = resolveUserName($this->urfa->get_int()); $this->user['is_juridical'] = $this->urfa->get_int(); $this->user['full_name'] = $this->urfa->get_string(); $accountId = intval($_REQUEST["AccountId"]); // проверка введенного значения суммы оплаты $subtotal_P = $_REQUEST['OutSum']; $subtotal_P = trim($subtotal_P); //убиарем лишние пробелы $subtotal_P = str_replace(',', '.', $subtotal_P); // заменяем запятые на точку $subtotal_P = floatval($subtotal_P); // пробуем преобразовать к числу $subtotal_P = round($subtotal_P, 2); // округляем до 2 знаков после запятой if ($subtotal_P != 0 && $subtotal_P >= 10 && $subtotal_P < 10000) { $client_ip = $_SERVER["REMOTE_ADDR"]; echo $client_ip . '<br \\>' . "\n"; $order_IDP = Uniteller::NewOrder($accountId, $subtotal_P, $client_ip); echo $order_IDP . '<br \\>' . "\n"; //// Для отладки разрешаем переход на страницу оплаты только с определённого IP //if ((strpos($client_ip, '10.79.124.') == 0) // or (strpos($client_ip, '10.78.252.') == 0)) { Uniteller::GoToPaymentPage($accountId, $order_IDP, $subtotal_P); //} } else { // при некорректно введенной сумме платежа возвращаемся на эту же страницу $url_return = $_SERVER['HTTP_REFERER']; header('Location: ' . $url_return); } exit; } }