diff --git a/system/controllers/customers.php b/system/controllers/customers.php index d454a3d7..b992b74e 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -75,6 +75,8 @@ switch ($action) { $b->expiration = date('Y-m-d'); $b->time = date('H:i:s'); $b->save(); + _log('Admin ' . $admin['username'] . ' Deactivate '.$b['namebp'].' for '.$b['username'], 'User', $b['customer_id']); + Message::sendTelegram('Admin ' . $admin['username'] . ' Deactivate '.$b['namebp'].' for u'.$b['username']); r2(U . 'customers/view/' . $id_customer, 's', 'Success deactivate customer to Mikrotik'); } r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan'); diff --git a/system/controllers/home.php b/system/controllers/home.php index c2eef6ce..bd1f3a77 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -90,6 +90,29 @@ if (_post('send') == 'balance') { $bill = User::_billing(); $ui->assign('_bill', $bill); +if(isset($_GET['deactivate']) && $_GET['deactivate'] == 1){ + if ($bill) { + $mikrotik = Mikrotik::info($bill['routers']); + $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); + if ($bill['type'] == 'Hotspot') { + Mikrotik::removeHotspotUser($client, $bill['username']); + Mikrotik::removeHotspotActiveUser($client, $bill['username']); + } else if ($bill['type'] == 'PPPOE') { + Mikrotik::removePpoeUser($client, $bill['username']); + Mikrotik::removePpoeActive($client, $bill['username']); + } + $bill->status = 'off'; + $bill->expiration = date('Y-m-d'); + $bill->time = date('H:i:s'); + $bill->save(); + _log('User ' . $bill['username'] . ' Deactivate '.$bill['namebp'], 'User', $bill['customer_id']); + Message::sendTelegram('User u' . $bill['username'] . ' Deactivate '.$bill['namebp']); + r2(U . 'home', 's', 'Success deactivate '.$bill['namebp']); + }else{ + r2(U . 'home', 'e', 'No Active Plan'); + } +} + if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) { $ui->assign('nux_mac', $_SESSION['nux-mac']); $ui->assign('nux_ip', $_SESSION['nux-ip']); diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php index 1c92e64a..64c5509c 100644 --- a/system/lan/english/common.lan.php +++ b/system/lan/english/common.lan.php @@ -402,3 +402,4 @@ $_L['Activate'] = 'Activate'; $_L['Deactivate'] = 'Deactivate'; $_L['Sync'] = 'Sync'; $_L['Failed_to_create_PaymeTrust_transaction'] = 'Failed to create PaymeTrust transaction.'; +$_L['Location'] = 'Location'; diff --git a/ui/ui/user-dashboard.tpl b/ui/ui/user-dashboard.tpl index c6a0e8db..5445f35b 100644 --- a/ui/ui/user-dashboard.tpl +++ b/ui/ui/user-dashboard.tpl @@ -70,9 +70,8 @@