add anti double submit when refill balance

This commit is contained in:
Ibnu Maksum 2024-04-29 14:01:05 +07:00
parent 61bd042b15
commit be43a5b385
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 12 additions and 0 deletions

View File

@ -714,6 +714,14 @@ switch ($action) {
}
$user = _post('id_customer');
$plan = _post('id_plan');
$stoken = _req('stoken');
if (App::getTokenValue($stoken)) {
$c = ORM::for_table('tbl_customers')->where('id', $user)->find_one();
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
Package::createInvoice($in);
$ui->display('invoice.tpl');
die();
}
run_hook('deposit_customer'); #HOOK
if (!empty($user) && !empty($plan)) {
@ -721,6 +729,9 @@ switch ($action) {
$c = ORM::for_table('tbl_customers')->where('id', $user)->find_one();
$in = ORM::for_table('tbl_transactions')->where('username', $c['username'])->order_by_desc('id')->find_one();
Package::createInvoice($in);
if(!empty($stoken)){
App::setToken($stoken, $in['id']);
}
$ui->display('invoice.tpl');
} else {
r2(U . 'plan/refill', 'e', "Failed to refill account");

View File

@ -6,6 +6,7 @@
<div class="panel-heading">{Lang::T('Refill Balance')}</div>
<div class="panel-body">
<form class="form-horizontal" method="post" role="form" action="{$_url}plan/deposit-post">
<input type="hidden" name="stoken" value="{App::getToken()}">
<div class="form-group">
<label class="col-md-2 control-label">{Lang::T('Select Account')}</label>
<div class="col-md-6">