Hotspot Radius Voucher Only done

This commit is contained in:
Ibnu Maksum 2024-07-10 15:47:31 +07:00
parent 7a40fe6e11
commit 9d564f55ec
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
11 changed files with 60 additions and 40 deletions

View File

@ -67,8 +67,7 @@ try {
$v = ORM::for_table('tbl_voucher')->where('code', $username)->where('routers', 'radius')->find_one(); $v = ORM::for_table('tbl_voucher')->where('code', $username)->where('routers', 'radius')->find_one();
if ($v) { if ($v) {
if ($v['status'] == 0) { if ($v['status'] == 0) {
// voucher activation if (Package::rechargeUser(0, $v['routers'], $v['id_plan'], "Voucher", $username)) {
if (Package::rechargeUser(0, $v['routers'], $v1['id_plan'], "Voucher", $username)) {
$v->status = "1"; $v->status = "1";
$v->save(); $v->save();
$tur = ORM::for_table('tbl_user_recharges')->where('username', $username)->find_one(); $tur = ORM::for_table('tbl_user_recharges')->where('username', $username)->find_one();
@ -90,6 +89,7 @@ try {
show_radius_result(['Reply-Message' => 'Internet Plan Expired..'], 401); show_radius_result(['Reply-Message' => 'Internet Plan Expired..'], 401);
} }
} }
die("hehe");
break; break;
case 'accounting': case 'accounting':
$username = _req('username'); $username = _req('username');
@ -126,6 +126,7 @@ try {
$e->getTraceAsString(), $e->getTraceAsString(),
$config['telegram_topik_error'] $config['telegram_topik_error']
); );
show_radius_result(['Reply-Message' => 'Command Failed : '.$action], 401);
} catch (Exception $e) { } catch (Exception $e) {
Message::sendTelegram( Message::sendTelegram(
"Sistem Error.\n" . "Sistem Error.\n" .
@ -133,8 +134,9 @@ try {
$e->getTraceAsString(), $e->getTraceAsString(),
$config['telegram_topik_error'] $config['telegram_topik_error']
); );
show_radius_result(['Reply-Message' => 'Command Failed : '.$action], 401);
} }
show_radius_result(['Reply-Message' => 'Invalid Command'], 401); show_radius_result(['Reply-Message' => 'Invalid Command : '.$action], 401);
function process_radiust_rest($tur, $code) function process_radiust_rest($tur, $code)
{ {

View File

@ -27,11 +27,12 @@ class Package
$time = date("H:i:s"); $time = date("H:i:s");
$inv = ""; $inv = "";
$isVoucher = false; $isVoucher = false;
$c = [];
if ($id_customer == '' or $router_name == '' or $plan_id == '') { if ($id_customer == '' or $router_name == '' or $plan_id == '') {
return false; return false;
} }
if($channel == 'Voucher' && $id_customer = 0){ if(trim($gateway) == 'Voucher' && $id_customer == 0){
$isVoucher = true; $isVoucher = true;
} }

View File

@ -11,7 +11,7 @@ class Dummy {
'author' => 'ibnu maksum', 'author' => 'ibnu maksum',
'url' => [ 'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/', 'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux', 'Telegram' => 'https://t.me/phpnuxbill',
'Donate' => 'https://paypal.me/ibnux' 'Donate' => 'https://paypal.me/ibnux'
] ]
]; ];

View File

@ -22,7 +22,7 @@ class MikrotikHotspot
'author' => 'ibnux', 'author' => 'ibnux',
'url' => [ 'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/', 'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux', 'Telegram' => 'https://t.me/phpnuxbill',
'Donate' => 'https://paypal.me/ibnux' 'Donate' => 'https://paypal.me/ibnux'
] ]
]; ];

View File

@ -21,7 +21,7 @@ class MikrotikPppoe
'author' => 'ibnux', 'author' => 'ibnux',
'url' => [ 'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/', 'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux', 'Telegram' => 'https://t.me/phpnuxbill',
'Donate' => 'https://paypal.me/ibnux' 'Donate' => 'https://paypal.me/ibnux'
] ]
]; ];

View File

@ -20,7 +20,7 @@ class Radius
'author' => 'ibnux', 'author' => 'ibnux',
'url' => [ 'url' => [
'Github' => 'https://github.com/hotspotbilling/phpnuxbill/', 'Github' => 'https://github.com/hotspotbilling/phpnuxbill/',
'Telegram' => 'https://t.me/ibnux', 'Telegram' => 'https://t.me/phpnuxbill',
'Donate' => 'https://paypal.me/ibnux' 'Donate' => 'https://paypal.me/ibnux'
] ]
]; ];

View File

@ -11,7 +11,7 @@ class RadiusRest {
'author' => 'ibnu maksum', 'author' => 'ibnu maksum',
'url' => [ 'url' => [
'Wiki Tutorial' => 'https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius-Rest', 'Wiki Tutorial' => 'https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius-Rest',
'Telegram' => 'https://t.me/ibnux', 'Telegram' => 'https://t.me/phpnuxbill',
'Donate' => 'https://paypal.me/ibnux' 'Donate' => 'https://paypal.me/ibnux'
] ]
]; ];

View File

@ -562,5 +562,6 @@
"Phone_number_updated_successfully": "Nomor telepon berhasil diperbarui", "Phone_number_updated_successfully": "Nomor telepon berhasil diperbarui",
"You_cannot_use_your_current_phone_number": "Anda tidak dapat menggunakan nomor telepon Anda saat ini", "You_cannot_use_your_current_phone_number": "Anda tidak dapat menggunakan nomor telepon Anda saat ini",
"Devices": "Perangkat", "Devices": "Perangkat",
"Voucher_Prefix": "Awalan Voucher" "Voucher_Prefix": "Awalan Voucher",
"This_account_status": "Status akun ini"
} }

View File

@ -248,20 +248,24 @@
</div> </div>
</div> </div>
</div> </div>
{if !$d['is_radius']}
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-login / on-up</div> <div class="panel-heading">on-login / on-up</div>
<div class="panel-body"> <div class="panel-body">
<textarea class="form-control" id="code" name="on_login" style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_login']}</textarea> <textarea class="form-control" id="code" name="on_login"
style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_login']}</textarea>
</div> </div>
</div> </div>
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-logout / on-down</div> <div class="panel-heading">on-logout / on-down</div>
<div class="panel-body"> <div class="panel-body">
<textarea class="form-control" id="code2" name="on_logout" style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_logout']}</textarea> <textarea class="form-control" id="code2" name="on_logout"
style="font-family: 'Courier New', Courier, monospace;" rows="15">{$d['on_logout']}</textarea>
</div> </div>
</div> </div>
</div> </div>
{/if}
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-offset-2 col-md-9"> <div class="col-md-offset-2 col-md-9">
@ -306,11 +310,17 @@
{/literal} {/literal}
{/if} {/if}
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script> <script language="javascript" type="text/javascript"
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/perl/perl.min.js"></script> src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js"></script>
<script language="javascript" type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/mode/perl/perl.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css"></link> <link rel="stylesheet" type="text/css"
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/abbott.min.css"></link> href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css">
</link>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/theme/abbott.min.css">
</link>
<script> <script>
CodeMirror.fromTextArea(document.getElementById('code'), { CodeMirror.fromTextArea(document.getElementById('code'), {

View File

@ -184,6 +184,7 @@
</div> </div>
</div> </div>
</div> </div>
{if !$d['is_radius']}
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-primary panel-hovered panel-stacked mb30"> <div class="panel panel-primary panel-hovered panel-stacked mb30">
<div class="panel-heading">on-login / on-up</div> <div class="panel-heading">on-login / on-up</div>
@ -200,6 +201,7 @@
</div> </div>
</div> </div>
</div> </div>
{/if}
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-lg-offset-2 col-lg-10"> <div class="col-lg-offset-2 col-lg-10">

View File

@ -65,6 +65,10 @@
</table> </table>
</div> </div>
{include file="pagination.tpl"} {include file="pagination.tpl"}
<div class="bs-callout bs-callout-info" id="callout-navbar-role">
<h4>RADIUS REST</h4>
<p>For Radius REST, you don't need to add NAS, NAS need to add to client.conf manually</p>
</div>
</div> </div>
</div> </div>
</div> </div>