| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/innoutstorage/webadmin/ |
Upload File : |
<?php
require_once("check_login.php");
if (!empty($_POST["payment_id"])) {
//update payment and deposit
foreach ($_POST["payment_id"] as $key => $payment_id) {
$payment_info = get_payment_by_id($payment_id);
if ($payment_info["status"] != $_POST["payment_status"][$key]) {
//status changed, need to trace it
$sql = "update payment set status = ?, lastupby = ?, lastupdate = ? where id = ?";
$parameters = array($_POST["payment_status"][$key], $_SESSION["cmsloginid"], $nowdate, (int)$payment_id);
bind_pdo($sql, $parameters);
$balance_sql = "";
if (($payment_info["status"] == "NEW" && $_POST["payment_status"][$key] == "PAID") || ($payment_info["status"] == "RETURNED" && $_POST["payment_status"][$key] == "NEW") || ($payment_info["status"] == "RETURNED" && $_POST["payment_status"][$key] == "PAID")) {
//balance -= amount, deduct balance
$balance_sql = "balance = balance - ?";
if(($payment_info["status"] == "RETURNED" && $_POST["payment_status"][$key] == "PAID")){
$balance_sql = "balance = balance - (?*2)";
}
}
if (($payment_info["status"] == "NEW" && $_POST["payment_status"][$key] == "RETURNED") || ($payment_info["status"] == "PAID" && $_POST["payment_status"][$key] == "NEW") || ($payment_info["status"] == "PAID" && $_POST["payment_status"][$key] == "RETURNED")) {
//balance += amount, add balance
$balance_sql = "balance = balance + ?";
if(($payment_info["status"] == "PAID" && $_POST["payment_status"][$key] == "RETURNED")){
$balance_sql = "balance = balance + (?*2)";
}
}
$sql = "update deposit set " . $balance_sql . " where id = ?";
$parameters = array($_POST["amount"][$key], (int)$_POST["deposit_id"]);
bind_pdo($sql, $parameters);
}
}
}
//update deposit
$sql = "update deposit set status = ?, lastupby = ?, lastupdate = ? where id = ?";
$parameters = array($_POST["deposit_status"], $_SESSION["cmsloginid"], $nowdate, (int)$_POST["deposit_id"]);
bind_pdo($sql, $parameters);
$dbh = null;
header("Location: deposit_modifyform.php?id=".(int)$_POST["deposit_id"]);