示例#1
0
    // complete selling process.
    // Enter any code here that you want to be executed after a successful
    // payment.
    $payment_id = intval($_REQUEST['payment_id']);
    $line = stripslashes_array(sql_row('select * from translines where id="' . $payment_id . '"'));
    if ($line['amount'] == $_REQUEST['lr_amnt']) {
        $query = 'update translines set stamp="' . Project::getInstance()->getNow() . '", status="1", batch="' . $_REQUEST["lr_transfer"] . '" where id="' . $payment_id . '"';
        sql_query($query);
        $user = stripslashes_array(sql_row('SELECT * FROM users WHERE id="' . $line['user_id'] . '"'));
        if ($user['deposit_notify']) {
            include_once LIB_ROOT . '/emails.class.php';
            $plan = stripslashes_array(sql_row('SELECT * FROM plans WHERE id="' . $line['plan_id'] . '"'));
            //%user_fullname%, %user_login%, %amount%, %batch%, %access_time%, %account%, %plan_name%, %project_name%, %project_email%
            $params = array('%user_fullname%' => htmlspecialchars($user['fullname']), '%user_login%' => $user['login'], '%account%' => $_REQUEST['lr_paidby'], '%amount%' => $_REQUEST['lr_amnt'], '%batch%' => $_REQUEST['lr_transfer'], '%plan_name%' => htmlspecialchars($plan['name']), '%project_name%' => get_setting('project_name'), '%project_email%' => get_setting('project_email'), '%access_time%' => date('M d, Y H:i', Project::getInstance()->getNow()));
            $email = new Emails($user['id'], 'deposit_notify', $params);
            $email->send();
        }
        if (!empty($user['referral'])) {
            $referral_id = sql_get('select id from users where login="******" limit 1');
            if ($referral_id) {
                $referral_bonus = $line['amount'] * get_setting('referral_bonus') / 100;
                sql_query('insert into translines values (0, 0, "' . $referral_id . '", "", "r", "' . $referral_bonus . '", "' . Project::getInstance()->getNow() . '", "1", "Bonus from: ' . $user['login'] . '")');
                $ref_msg = $user['login'] . '->' . $user['referral'] . ':' . $line['amount'] . "\n";
                if (REFERRAL_ONCE) {
                    sql_query('update users set referral="" where id="' . $user['id'] . '"');
                }
            }
        }
        $msgBody = "Payment was verified and is successful.\n\n";
    }
} else {