Файл: MoneyExchange v2.1/sources/ipn/advcash.php
Строк: 76
<?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'];
$query = $db->query("SELECT * FROM exchanges WHERE id='$ac_order_id'");
if($query->num_rows==0) { header("Location: $settings[url]"); }
$row = $query->fetch_assoc();
$accountQuery = $db->query("SELECT * FROM companies WHERE name='$row[cfrom]'");
$acc = $accountQuery->fetch_assoc();
if(checkSession()) { $uid = $_SESSION['suid']; } else { $uid = 0; }
$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($ac_amount == $row['amount_from'] or $ac_merchant_currency == $row['amount_currency']) {
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')");
$update = $db->query("UPDATE exchanges SET status='2' WHERE id='$row[id]'");
echo success($lang['success_4']);
}
} else {
echo error($lang['error_16']);
}
} else {
echo error($lang['error_17']);
}
} elseif($c == "status") {
if($ac_dest_wallet == $acc['a_field_1']) {
if($ac_amount == $row['amount_from'] or $ac_merchant_currency == $row['amount_currency']) {
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')");
$update = $db->query("UPDATE exchanges SET status='2' WHERE id='$row[id]'");
echo success($lang['success_4']);
}
} else {
echo error($lang['error_16']);
}
} else {
echo error($lang['error_17']);
}
} elseif($c == "fail") {
$update = $db->query("UPDATE exchanges SET status='3' WHERE id='$row[id]'");
echo error($lang['error_18']);
} else {
echo error($lang['error_2']);
}
?>