forked from kevinowino869/mitrobill
Enable disable router and plan
This commit is contained in:
@ -69,6 +69,7 @@ switch ($action) {
|
||||
$username = _post('username');
|
||||
$password = _post('password');
|
||||
$description = _post('description');
|
||||
$enabled = _post('enabled')*1;
|
||||
|
||||
$msg = '';
|
||||
if(Validator::Length($name,30,4) == false){
|
||||
@ -99,6 +100,7 @@ switch ($action) {
|
||||
$d->username = $username;
|
||||
$d->password = $password;
|
||||
$d->description = $description;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
r2(U . 'routers/list', 's', $_L['Created_Successfully']);
|
||||
@ -114,7 +116,7 @@ switch ($action) {
|
||||
$username = _post('username');
|
||||
$password = _post('password');
|
||||
$description = _post('description');
|
||||
|
||||
$enabled = $_POST['enabled']*1;
|
||||
$msg = '';
|
||||
if(Validator::Length($name,30,4) == false){
|
||||
$msg .= 'Name should be between 5 to 30 characters'. '<br>';
|
||||
@ -163,25 +165,28 @@ switch ($action) {
|
||||
$d->username = $username;
|
||||
$d->password = $password;
|
||||
$d->description = $description;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
$p = ORM::for_table('tbl_plans')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_payment_gateway')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_pool')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_transactions')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_user_recharges')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_voucher')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
if($name!=$oldname){
|
||||
$p = ORM::for_table('tbl_plans')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_payment_gateway')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_pool')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_transactions')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_user_recharges')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
$p = ORM::for_table('tbl_voucher')->where('routers',$oldname)->find_result_set();
|
||||
$p->set('routers',$name);
|
||||
$p->save();
|
||||
}
|
||||
r2(U . 'routers/list', 's', $_L['Updated_Successfully']);
|
||||
}else{
|
||||
r2(U . 'routers/edit/'.$id, 'e', $msg);
|
||||
|
@ -109,6 +109,7 @@ switch ($action) {
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$enabled = _post('enabled')*1;
|
||||
|
||||
$msg = '';
|
||||
if (Validator::UnsignedNumber($validity) == false) {
|
||||
@ -172,6 +173,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
$d->routers = $routers;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
r2(U . 'services/hotspot', 's', $_L['Created_Successfully']);
|
||||
@ -196,6 +198,7 @@ switch ($action) {
|
||||
$validity = _post('validity');
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$enabled = _post('enabled')*1;
|
||||
|
||||
$msg = '';
|
||||
if (Validator::UnsignedNumber($validity) == false) {
|
||||
@ -264,6 +267,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->shared_users = $sharedusers;
|
||||
$d->routers = $routers;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
r2(U . 'services/hotspot', 's', $_L['Updated_Successfully']);
|
||||
@ -357,6 +361,7 @@ switch ($action) {
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool = _post('pool_name');
|
||||
$enabled = _post('enabled')*1;
|
||||
|
||||
$msg = '';
|
||||
if (Validator::UnsignedNumber($validity) == false) {
|
||||
@ -415,6 +420,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->routers = $routers;
|
||||
$d->pool = $pool;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
r2(U . 'services/pppoe', 's', $_L['Created_Successfully']);
|
||||
@ -432,6 +438,7 @@ switch ($action) {
|
||||
$validity_unit = _post('validity_unit');
|
||||
$routers = _post('routers');
|
||||
$pool = _post('pool_name');
|
||||
$enabled = _post('enabled')*1;
|
||||
|
||||
$msg = '';
|
||||
if (Validator::UnsignedNumber($validity) == false) {
|
||||
@ -495,6 +502,7 @@ switch ($action) {
|
||||
$d->validity_unit = $validity_unit;
|
||||
$d->routers = $routers;
|
||||
$d->pool = $pool;
|
||||
$d->enabled = $enabled;
|
||||
$d->save();
|
||||
|
||||
r2(U . 'services/pppoe', 's', $_L['Updated_Successfully']);
|
||||
|
@ -254,3 +254,5 @@ $_L['Explain_Coverage_of_router'] = 'Jelaskan Cakupan wilayah hotspot';
|
||||
$_L['Name_of_Area_that_router_operated'] = 'Nama Lokasi/Wilayah Router beroperasi';
|
||||
$_L['Payment_Notification_URL_Recurring_Notification_URL_Pay_Account_Notification_URL'] = 'Payment Notification URL, Recurring Notification URL, Pay Account Notification URL';
|
||||
$_L['Finish_Redirect_URL_Unfinish_Redirect_URL_Error_Redirect_URL'] = 'Finish Redirect URL, Unfinish Redirect URL, Error Redirect URL';
|
||||
$_L['Status'] = 'Status';
|
||||
$_L['Status'] = 'Status';
|
||||
|
26
system/radius.php
Normal file
26
system/radius.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||
**/
|
||||
|
||||
if(php_sapi_name() !== 'cli'){
|
||||
die("RUN ON COMMAND LINE ONLY BY RADIUS ENGINE");
|
||||
}
|
||||
|
||||
require('config.php');
|
||||
require('orm.php');
|
||||
|
||||
use PEAR2\Net\RouterOS;
|
||||
require_once 'autoload/PEAR2/Autoload.php';
|
||||
|
||||
ORM::configure("mysql:host=$db_host;dbname=$db_name");
|
||||
ORM::configure('username', $db_user);
|
||||
ORM::configure('password', $db_password);
|
||||
ORM::configure('return_result_sets', true);
|
||||
ORM::configure('logging', true);
|
||||
|
||||
$result = ORM::for_table('tbl_appconfig')->find_many();
|
||||
foreach($result as $value){
|
||||
$config[$value['setting']]=$value['value'];
|
||||
}
|
||||
date_default_timezone_set($config['timezone']);
|
Reference in New Issue
Block a user