Esempio n. 1
0
        if (isset($_POST['newcash'])) {
            //collect needed data
            $cash = mysql_real_escape_string($_POST['newcash']);
            $balance = zb_VserviceCashGet($login);
            $date = curdatetime();
            $cashtype = $_POST['cashtype'];
            $vserviceid = $_POST['vserviceid'];
            $note = 'Service:' . $vserviceid;
            $admin = whoami();
            if ($cash) {
                //if it only adding
                if ($_POST['operation'] == 'add') {
                    zb_VserviceCashAdd($login, $cash, $vserviceid);
                    $paymentlog = "INSERT INTO `payments` (\n                `id` ,\n                `login` ,\n                `date` ,\n                `admin` ,\n                `balance` ,\n                `summ` ,\n                `cashtypeid` ,\n                `note`\n                )\n                VALUES (\n                NULL , '" . $login . "', '" . $date . "','" . $admin . "' ,'" . $balance . "', '" . $cash . "', '" . $cashtype . "', '" . $note . "'\n                );";
                    nr_query($paymentlog);
                    rcms_redirect("?module=pl_vcash&username="******"?module=pl_vcash&username=" . $login);
                }
            }
        }
        show_window(__('Virtual cash account'), web_VserviceCashForm($login));
        show_window('', web_UserControls($login));
    }
} else {
    show_error(__('You cant control this module'));
}
Esempio n. 2
0
/**
 * Adds cash to virtual cash balance
 * 
 * @param string $login
 * @param float $cash
 * @param int $vserviceid
 * 
 * @return void
 */
function zb_VserviceCashAdd($login, $cash, $vserviceid)
{
    $login = vf($login);
    $cash = mysql_real_escape_string($cash);
    $balance = zb_VserviceCashGet($login);
    $newcash = $balance + $cash;
    zb_VserviceCashSet($login, $newcash);
    zb_VserviceCashLog($login, $balance, $newcash, $vserviceid);
}