Файл: MoneyExchange v2.1/sources/ipn_deposit/advcash.php
Строк: 100
<?php
$c = protect($_GET['c']);
$ac_src_wallet = $_GET['ac_src_wallet'];
$ac_dest_wallet = $_GET['ac_dest_wallet'];
$ac_amount = $_GET['ac_amount'];
$ac_merchant_currency = $_GET['ac_merchant_currency'];
$ac_transfer = $_GET['ac_transfer'];
$ac_start_date = $_GET['ac_start_date'];
$ac_order_id = $_GET['ac_order_id'];
$accountQuery = $db->query("SELECT * FROM companies WHERE name='AdvCash'");
$acc = $accountQuery->fetch_assoc();
$time = time();
$check_trans = $db->query("SELECT * FROM transactions WHERE txn_id='$ac_transfer' and time='$ac_start_date' and uid='$uid'");
if($c == "success") {
if($ac_dest_wallet == $acc['a_field_1']) {
if($check_trans->num_rows>0) {
echo error($lang['error_15']);
} else {
$insert = $db->query("INSERT transactions (txn_id,payee,uid,company,amount,currency,time) VALUES ('$ac_transfer','$ac_src_wallet','$uid','AdvCash','$ac_amount','$ac_merchant_currency','$ac_start_date')");
$check_wallet = $db->query("SELECT * FROM wallets WHERE uid='$_SESSION[suid]' and currency='$ac_merchant_currency'");
if($check_wallet->num_rows>0) {
$update_wallet = $db->query("UPDATE wallets SET amount=amount+$ac_amount,updated='$time' WHERE uid='$_SESSION[suid]' and currency='$ac_merchant_currency'");
echo success("Your deposit was successfully. You added $ac_amount $ac_merchant_currency to your wallet.");
} else {
$insert = $db->query("INSERT wallets (uid,amount,currency,created) VALUES ('$_SESSION[suid]','$ac_amount','$ac_merchant_currency','$time')");
echo success("Your deposit was successfully. You added $ac_amount $ac_merchant_currency to your wallet.");
}
}
} else {
echo error($lang['error_17']);
}
} elseif($c == "status") {
if($ac_dest_wallet == $acc['a_field_1']) {
if($check_trans->num_rows>0) {
echo error($lang['error_15']);
} else {
$insert = $db->query("INSERT transactions (txn_id,payee,uid,company,amount,currency,time) VALUES ('$ac_transfer','$ac_src_wallet','$uid','AdvCash','$ac_amount','$ac_merchant_currency','$ac_start_date')");
$check_wallet = $db->query("SELECT * FROM wallets WHERE uid='$_SESSION[suid]' and currency='$ac_merchant_currency'");
if($check_wallet->num_rows>0) {
$update_wallet = $db->query("UPDATE wallets SET amount=amount+$ac_amount,updated='$time' WHERE uid='$_SESSION[suid]' and currency='$ac_merchant_currency'");
echo success("Your deposit was successfully. You added $ac_amount $ac_merchant_currency to your wallet.");
} else {
$insert = $db->query("INSERT wallets (uid,amount,currency,created) VALUES ('$_SESSION[suid]','$ac_amount','$ac_merchant_currency','$time')");
echo success("Your deposit was successfully. You added $ac_amount $ac_merchant_currency to your wallet.");
}
}
} else {
echo error($lang['error_17']);
}
} elseif($c == "fail") {
echo error($lang['error_18']);
} else {
echo error($lang['error_2']);
}
?>