P
P
pavelsokg2022-01-26 10:06:03
PHP
pavelsokg, 2022-01-26 10:06:03

The user's balance is not replenished, what's wrong?

I'm new to this so don't judge me too harshly. The user's balance is not replenished, they arrived at the account of the payment system, from the side of the payment everything is OK according to the TP. I understand the issue in the notification handler. Can you correct it or suggest what is wrong in the code?

<?php
include('files/functions.php');
include('procedure/balance.php');
include('procedure/referal.php');

@var $pdo
@var $UserBalance
@var $UserID

$merchant = $_REQUEST['FkShopId']; // id вашего магазина
$secret_word2 = '#############'; // секретный ключ 2

function getIP() {
    if(isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP'];
    return $_SERVER['REMOTE_ADDR'];
}


if (!in_array(getIP(), array('109.206.163.80', '136.243.38.147', '136.243.38.149', '136.243.38.150', '136.243.38.151', '136.243.38.189', '88.198.88.98'))) {
    die("hacking attempt!");
}
 
$sign = md5($merchant.':'.$_REQUEST['amount'].':'.$secret_word2.':'.$_REQUEST['payment_id'].':'.$_REQUEST['merchant_id'].':'.$_REQUEST['credited']);
 
if ($sign != $_REQUEST['sign_2']) {
    die('bad sign!');
}
 
echo "Good";
}

$fk_operation_id = $_REQUEST['intid'];
$user_id = $_REQUEST['us_id'];
$payment_sum = $_REQUEST['amount'];


if(empty($fk_operation_id) || empty($user_id) || empty($payment_sum)){
    die('Missing one of param');
}
if(isPaymentExist($fk_operation_id)) {
    echo('Transaction already exists in our database.');
} else {
    if(isUserExist($user_id)){
        updateUserBalance($user_id, $payment_sum);
        newDeposit($user_id, $payment_sum, $fk_operation_id);
        deductionPercent($user_id, $payment_sum);
        echo "YES";
    }else{
        echo "User Not Found";
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question