Update home.php

fix user self recharge in user dashboard for radius plan base
This commit is contained in:
AGSTR 2024-04-14 06:45:45 +07:00 committed by GitHub
parent aa756fceb1
commit 519bef21e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,25 +92,26 @@ if (_post('send') == 'balance') {
$ui->assign('_bills', User::_billing());
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
if(!empty(App::getTokenValue($_GET['stoken']))){
r2(U . "voucher/invoice/");
die();
}
$bill = ORM::for_table('tbl_user_recharges')->where('id', $_GET['recharge'])->where('username', $user['username'])->findOne();
if ($bill) {
$router = ORM::for_table('tbl_routers')->where('name', $bill['routers'])->find_one();
if ($bill['routers'] == 'radius') {
$router = 'radius';
} else {
$routers = ORM::for_table('tbl_routers')->where('name', $bill['routers'])->find_one();
$router = $router['id'];
}
if ($config['enable_balance'] == 'yes') {
$plan = ORM::for_table('tbl_plans')->find_one($bill['plan_id']);
if(!$plan['enabled']){
r2(U . "home", 'e', 'Plan is not exists');
}
if ($user['balance'] > $plan['price']) {
r2(U . "order/pay/$router[id]/$bill[plan_id]&stoken=".$_GET['stoken']);
r2(U . "order/pay/$router/$bill[plan_id]", 'e', 'Order Plan');
} else {
r2(U . "order/buy/$router[id]/$bill[plan_id]");
r2(U . "order/buy/$router/$bill[plan_id]", 'e', 'Order Plan');
}
} else {
r2(U . "order/buy/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
r2(U . "order/buy/$router/$bill[plan_id]", 'e', 'Order Plan');
}
}
} else if (isset($_GET['deactivate']) && !empty($_GET['deactivate'])) {