Show error, and fix IP Port custom
This commit is contained in:
parent
90a08cb731
commit
6eaede3c6e
@ -7,8 +7,6 @@
|
|||||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
|
||||||
**/
|
**/
|
||||||
//ini_set('display_errors', 1);
|
|
||||||
//ini_set('display_startup_errors', 1);
|
|
||||||
//error_reporting(E_ALL);
|
|
||||||
require ('system/boot.php');
|
require ('system/boot.php');
|
||||||
App::_run();
|
App::_run();
|
||||||
|
@ -46,9 +46,10 @@ switch ($action) {
|
|||||||
$mikrotik = Router::_info($c['routers']);
|
$mikrotik = Router::_info($c['routers']);
|
||||||
if($c['type'] == 'Hotspot'){
|
if($c['type'] == 'Hotspot'){
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
@ -80,9 +81,10 @@ switch ($action) {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
|
@ -64,9 +64,10 @@ switch ($action) {
|
|||||||
$mikrotik = Router::_info($c['routers']);
|
$mikrotik = Router::_info($c['routers']);
|
||||||
if($c['type'] == 'Hotspot'){
|
if($c['type'] == 'Hotspot'){
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
@ -90,9 +91,10 @@ switch ($action) {
|
|||||||
}else{
|
}else{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
@ -220,9 +222,10 @@ switch ($action) {
|
|||||||
$mikrotik = Router::_info($c['routers']);
|
$mikrotik = Router::_info($c['routers']);
|
||||||
if($c['type'] == 'Hotspot'){
|
if($c['type'] == 'Hotspot'){
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
@ -249,9 +252,10 @@ switch ($action) {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
|
@ -65,9 +65,10 @@ switch ($action) {
|
|||||||
$mikrotik = Router::_info($d['routers']);
|
$mikrotik = Router::_info($d['routers']);
|
||||||
if($d){
|
if($d){
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip pool print .proplist=name',
|
'/ip pool print .proplist=name',
|
||||||
@ -106,9 +107,10 @@ switch ($action) {
|
|||||||
$mikrotik = Router::_info($routers);
|
$mikrotik = Router::_info($routers);
|
||||||
if($msg == ''){
|
if($msg == ''){
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ip/pool/add');
|
$addRequest = new RouterOS\Request('/ip/pool/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync($addRequest
|
||||||
@ -153,9 +155,10 @@ switch ($action) {
|
|||||||
$mikrotik = Router::_info($routers);
|
$mikrotik = Router::_info($routers);
|
||||||
if($msg == ''){
|
if($msg == ''){
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":",$mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip pool print .proplist=name',
|
'/ip pool print .proplist=name',
|
||||||
|
@ -91,9 +91,10 @@ switch ($action) {
|
|||||||
if ($type == 'Hotspot') {
|
if ($type == 'Hotspot') {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
@ -191,9 +192,10 @@ switch ($action) {
|
|||||||
$t->save();
|
$t->save();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* iBNuX Added:
|
/* iBNuX Added:
|
||||||
@ -285,9 +287,10 @@ switch ($action) {
|
|||||||
|
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp secret print .proplist=name',
|
'/ppp secret print .proplist=name',
|
||||||
@ -338,9 +341,10 @@ switch ($action) {
|
|||||||
$t->save();
|
$t->save();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
@ -424,9 +428,10 @@ switch ($action) {
|
|||||||
if ($d) {
|
if ($d) {
|
||||||
if ($d['type'] == 'Hotspot') {
|
if ($d['type'] == 'Hotspot') {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot user print .proplist=name',
|
'/ip hotspot user print .proplist=name',
|
||||||
@ -442,9 +447,10 @@ switch ($action) {
|
|||||||
$d->delete();
|
$d->delete();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp secret print .proplist=name',
|
'/ppp secret print .proplist=name',
|
||||||
@ -682,9 +688,10 @@ switch ($action) {
|
|||||||
if ($v1['type'] == 'Hotspot') {
|
if ($v1['type'] == 'Hotspot') {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot user print .proplist=name',
|
'/ip hotspot user print .proplist=name',
|
||||||
@ -781,9 +788,10 @@ switch ($action) {
|
|||||||
$t->save();
|
$t->save();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
/* iBNuX Added:
|
/* iBNuX Added:
|
||||||
* Time limit to Mikrotik
|
* Time limit to Mikrotik
|
||||||
@ -877,9 +885,10 @@ switch ($action) {
|
|||||||
} else {
|
} else {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp secret print .proplist=name',
|
'/ppp secret print .proplist=name',
|
||||||
@ -930,9 +939,10 @@ switch ($action) {
|
|||||||
$t->save();
|
$t->save();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
||||||
$client->sendSync(
|
$client->sendSync(
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||||
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
|
* @copyright Copyright (C) 2014-2015 PHP Mikrotik Billing
|
||||||
@ -12,7 +13,9 @@ if (isset($routes['1'])) {
|
|||||||
} else {
|
} else {
|
||||||
$do = 'register-display';
|
$do = 'register-display';
|
||||||
}
|
}
|
||||||
|
|
||||||
use PEAR2\Net\RouterOS;
|
use PEAR2\Net\RouterOS;
|
||||||
|
|
||||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
require_once 'system/autoload/PEAR2/Autoload.php';
|
||||||
|
|
||||||
switch ($do) {
|
switch ($do) {
|
||||||
@ -36,7 +39,6 @@ switch($do){
|
|||||||
}
|
}
|
||||||
if (!Validator::Length($password, 35, 2)) {
|
if (!Validator::Length($password, 35, 2)) {
|
||||||
$msg .= 'Password should be between 3 to 35 characters' . '<br>';
|
$msg .= 'Password should be between 3 to 35 characters' . '<br>';
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($password != $cpassword) {
|
if ($password != $cpassword) {
|
||||||
$msg .= $_L['PasswordsNotMatch'] . '<br>';
|
$msg .= $_L['PasswordsNotMatch'] . '<br>';
|
||||||
@ -69,9 +71,10 @@ switch($do){
|
|||||||
|
|
||||||
if ($v1['type'] == 'Hotspot') {
|
if ($v1['type'] == 'Hotspot') {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
/* iBNuX Added:
|
/* iBNuX Added:
|
||||||
* Time limit to Mikrotik
|
* Time limit to Mikrotik
|
||||||
@ -84,7 +87,8 @@ switch($do){
|
|||||||
$timelimit = $p['time_limit'] . ":00:00";
|
$timelimit = $p['time_limit'] . ":00:00";
|
||||||
else
|
else
|
||||||
$timelimit = "00:" . $p['time_limit'] . ":00";
|
$timelimit = "00:" . $p['time_limit'] . ":00";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -95,7 +99,8 @@ switch($do){
|
|||||||
$datalimit = $p['data_limit'] . "000000000";
|
$datalimit = $p['data_limit'] . "000000000";
|
||||||
else
|
else
|
||||||
$datalimit = $p['data_limit'] . "000000";
|
$datalimit = $p['data_limit'] . "000000";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -110,7 +115,8 @@ switch($do){
|
|||||||
$datalimit = $p['data_limit'] . "000000000";
|
$datalimit = $p['data_limit'] . "000000000";
|
||||||
else
|
else
|
||||||
$datalimit = $p['data_limit'] . "000000";
|
$datalimit = $p['data_limit'] . "000000";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -119,7 +125,8 @@ switch($do){
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -157,15 +164,16 @@ switch($do){
|
|||||||
$v1->status = "1";
|
$v1->status = "1";
|
||||||
$v1->user = $c['username'];
|
$v1->user = $c['username'];
|
||||||
$v1->save();
|
$v1->save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('service', 'pppoe')
|
->setArgument('service', 'pppoe')
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
@ -278,4 +286,3 @@ switch($do){
|
|||||||
$ui->display('register.tpl');
|
$ui->display('register.tpl');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||||
|
|
||||||
@ -15,11 +16,12 @@ $action = $routes['1'];
|
|||||||
$admin = Admin::_info();
|
$admin = Admin::_info();
|
||||||
$ui->assign('_admin', $admin);
|
$ui->assign('_admin', $admin);
|
||||||
|
|
||||||
if($admin['user_type'] != 'Admin' AND $admin['user_type'] != 'Sales'){
|
if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') {
|
||||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||||
}
|
}
|
||||||
|
|
||||||
use PEAR2\Net\RouterOS;
|
use PEAR2\Net\RouterOS;
|
||||||
|
|
||||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
require_once 'system/autoload/PEAR2/Autoload.php';
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
@ -72,9 +74,10 @@ switch ($action) {
|
|||||||
if ($d) {
|
if ($d) {
|
||||||
$mikrotik = Router::_info($d['routers']);
|
$mikrotik = Router::_info($d['routers']);
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot user profile print .proplist=name',
|
'/ip hotspot user profile print .proplist=name',
|
||||||
@ -83,7 +86,8 @@ switch ($action) {
|
|||||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
|
|
||||||
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
|
$removeRequest = new RouterOS\Request('/ip/hotspot/user/profile/remove');
|
||||||
$client($removeRequest
|
$client(
|
||||||
|
$removeRequest
|
||||||
->setArgument('numbers', $profileName)
|
->setArgument('numbers', $profileName)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -115,7 +119,7 @@ switch ($action) {
|
|||||||
if (Validator::UnsignedNumber($price) == false) {
|
if (Validator::UnsignedNumber($price) == false) {
|
||||||
$msg .= 'The price must be a number' . '<br>';
|
$msg .= 'The price must be a number' . '<br>';
|
||||||
}
|
}
|
||||||
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == ''){
|
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '') {
|
||||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,18 +130,28 @@ switch ($action) {
|
|||||||
|
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||||
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
|
if ($b['rate_down_unit'] == 'Kbps') {
|
||||||
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
|
$unitdown = 'K';
|
||||||
|
} else {
|
||||||
|
$unitdown = 'M';
|
||||||
|
}
|
||||||
|
if ($b['rate_up_unit'] == 'Kbps') {
|
||||||
|
$unitup = 'K';
|
||||||
|
} else {
|
||||||
|
$unitup = 'M';
|
||||||
|
}
|
||||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||||
|
|
||||||
$mikrotik = Router::_info($routers);
|
$mikrotik = Router::_info($routers);
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
$addRequest = new RouterOS\Request('/ip/hotspot/user/profile/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $name)
|
->setArgument('name', $name)
|
||||||
->setArgument('shared-users', $sharedusers)
|
->setArgument('shared-users', $sharedusers)
|
||||||
->setArgument('rate-limit', $rate)
|
->setArgument('rate-limit', $rate)
|
||||||
@ -190,7 +204,7 @@ switch ($action) {
|
|||||||
if (Validator::UnsignedNumber($price) == false) {
|
if (Validator::UnsignedNumber($price) == false) {
|
||||||
$msg .= 'The price must be a number' . '<br>';
|
$msg .= 'The price must be a number' . '<br>';
|
||||||
}
|
}
|
||||||
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == ''){
|
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '') {
|
||||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,15 +216,24 @@ switch ($action) {
|
|||||||
|
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||||
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
|
if ($b['rate_down_unit'] == 'Kbps') {
|
||||||
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
|
$unitdown = 'K';
|
||||||
|
} else {
|
||||||
|
$unitdown = 'M';
|
||||||
|
}
|
||||||
|
if ($b['rate_up_unit'] == 'Kbps') {
|
||||||
|
$unitup = 'K';
|
||||||
|
} else {
|
||||||
|
$unitup = 'M';
|
||||||
|
}
|
||||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||||
|
|
||||||
$mikrotik = Router::_info($routers);
|
$mikrotik = Router::_info($routers);
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot user profile print .proplist=name',
|
'/ip hotspot user profile print .proplist=name',
|
||||||
@ -219,7 +242,8 @@ switch ($action) {
|
|||||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
|
|
||||||
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
|
$setRequest = new RouterOS\Request('/ip/hotspot/user/profile/set');
|
||||||
$client($setRequest
|
$client(
|
||||||
|
$setRequest
|
||||||
->setArgument('numbers', $profileName)
|
->setArgument('numbers', $profileName)
|
||||||
->setArgument('shared-users', $sharedusers)
|
->setArgument('shared-users', $sharedusers)
|
||||||
->setArgument('rate-limit', $rate)
|
->setArgument('rate-limit', $rate)
|
||||||
@ -299,9 +323,10 @@ switch ($action) {
|
|||||||
if ($d) {
|
if ($d) {
|
||||||
$mikrotik = Router::_info($d['routers']);
|
$mikrotik = Router::_info($d['routers']);
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp profile print .proplist=name',
|
'/ppp profile print .proplist=name',
|
||||||
@ -310,7 +335,8 @@ switch ($action) {
|
|||||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
|
|
||||||
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
|
$removeRequest = new RouterOS\Request('/ppp/profile/remove');
|
||||||
$client($removeRequest
|
$client(
|
||||||
|
$removeRequest
|
||||||
->setArgument('numbers', $profileName)
|
->setArgument('numbers', $profileName)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -336,7 +362,7 @@ switch ($action) {
|
|||||||
if (Validator::UnsignedNumber($price) == false) {
|
if (Validator::UnsignedNumber($price) == false) {
|
||||||
$msg .= 'The price must be a number' . '<br>';
|
$msg .= 'The price must be a number' . '<br>';
|
||||||
}
|
}
|
||||||
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == '' OR $pool == ''){
|
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '' or $pool == '') {
|
||||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,18 +373,28 @@ switch ($action) {
|
|||||||
|
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||||
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
|
if ($b['rate_down_unit'] == 'Kbps') {
|
||||||
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
|
$unitdown = 'K';
|
||||||
|
} else {
|
||||||
|
$unitdown = 'M';
|
||||||
|
}
|
||||||
|
if ($b['rate_up_unit'] == 'Kbps') {
|
||||||
|
$unitup = 'K';
|
||||||
|
} else {
|
||||||
|
$unitup = 'M';
|
||||||
|
}
|
||||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||||
|
|
||||||
$mikrotik = Router::_info($routers);
|
$mikrotik = Router::_info($routers);
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ppp/profile/add');
|
$addRequest = new RouterOS\Request('/ppp/profile/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $name)
|
->setArgument('name', $name)
|
||||||
->setArgument('local-address', $pool)
|
->setArgument('local-address', $pool)
|
||||||
->setArgument('remote-address', $pool)
|
->setArgument('remote-address', $pool)
|
||||||
@ -399,7 +435,7 @@ switch ($action) {
|
|||||||
if (Validator::UnsignedNumber($price) == false) {
|
if (Validator::UnsignedNumber($price) == false) {
|
||||||
$msg .= 'The price must be a number' . '<br>';
|
$msg .= 'The price must be a number' . '<br>';
|
||||||
}
|
}
|
||||||
if ($name == '' OR $id_bw == '' OR $price == '' OR $validity == '' OR $routers == '' OR $pool == ''){
|
if ($name == '' or $id_bw == '' or $price == '' or $validity == '' or $routers == '' or $pool == '') {
|
||||||
$msg .= $_L['All_field_is_required'] . '<br>';
|
$msg .= $_L['All_field_is_required'] . '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -411,15 +447,24 @@ switch ($action) {
|
|||||||
|
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
$b = ORM::for_table('tbl_bandwidth')->where('id', $id_bw)->find_one();
|
||||||
if($b['rate_down_unit'] == 'Kbps'){ $unitdown = 'K'; }else{ $unitdown = 'M'; }
|
if ($b['rate_down_unit'] == 'Kbps') {
|
||||||
if($b['rate_up_unit'] == 'Kbps'){ $unitup = 'K'; }else{ $unitup = 'M'; }
|
$unitdown = 'K';
|
||||||
|
} else {
|
||||||
|
$unitdown = 'M';
|
||||||
|
}
|
||||||
|
if ($b['rate_up_unit'] == 'Kbps') {
|
||||||
|
$unitup = 'K';
|
||||||
|
} else {
|
||||||
|
$unitup = 'M';
|
||||||
|
}
|
||||||
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
$rate = $b['rate_up'] . $unitup . "/" . $b['rate_down'] . $unitdown;
|
||||||
|
|
||||||
$mikrotik = Router::_info($routers);
|
$mikrotik = Router::_info($routers);
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ppp profile print .proplist=name',
|
'/ppp profile print .proplist=name',
|
||||||
@ -428,7 +473,8 @@ switch ($action) {
|
|||||||
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
$profileName = $client->sendSync($printRequest)->getProperty('name');
|
||||||
|
|
||||||
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
$setRequest = new RouterOS\Request('/ppp/profile/set');
|
||||||
$client($setRequest
|
$client(
|
||||||
|
$setRequest
|
||||||
->setArgument('numbers', $profileName)
|
->setArgument('numbers', $profileName)
|
||||||
->setArgument('local-address', $pool)
|
->setArgument('local-address', $pool)
|
||||||
->setArgument('remote-address', $pool)
|
->setArgument('remote-address', $pool)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
* PHP Mikrotik Billing (https://ibnux.github.io/phpmixbill/)
|
||||||
|
|
||||||
@ -16,6 +17,7 @@ $user = User::_info();
|
|||||||
$ui->assign('_user', $user);
|
$ui->assign('_user', $user);
|
||||||
|
|
||||||
use PEAR2\Net\RouterOS;
|
use PEAR2\Net\RouterOS;
|
||||||
|
|
||||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
require_once 'system/autoload/PEAR2/Autoload.php';
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
@ -44,9 +46,10 @@ switch ($action) {
|
|||||||
if ($v1['type'] == 'Hotspot') {
|
if ($v1['type'] == 'Hotspot') {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
@ -68,7 +71,8 @@ switch ($action) {
|
|||||||
$timelimit = $p['time_limit'] . ":00:00";
|
$timelimit = $p['time_limit'] . ":00:00";
|
||||||
else
|
else
|
||||||
$timelimit = "00:" . $p['time_limit'] . ":00";
|
$timelimit = "00:" . $p['time_limit'] . ":00";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -79,7 +83,8 @@ switch ($action) {
|
|||||||
$datalimit = $p['data_limit'] . "000000000";
|
$datalimit = $p['data_limit'] . "000000000";
|
||||||
else
|
else
|
||||||
$datalimit = $p['data_limit'] . "000000";
|
$datalimit = $p['data_limit'] . "000000";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -94,7 +99,8 @@ switch ($action) {
|
|||||||
$datalimit = $p['data_limit'] . "000000000";
|
$datalimit = $p['data_limit'] . "000000000";
|
||||||
else
|
else
|
||||||
$datalimit = $p['data_limit'] . "000000";
|
$datalimit = $p['data_limit'] . "000000";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -103,7 +109,8 @@ switch ($action) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -136,12 +143,12 @@ switch ($action) {
|
|||||||
$t->routers = $v1['routers'];
|
$t->routers = $v1['routers'];
|
||||||
$t->type = "Hotspot";
|
$t->type = "Hotspot";
|
||||||
$t->save();
|
$t->save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
/* iBNuX Added:
|
/* iBNuX Added:
|
||||||
* Time limit to Mikrotik
|
* Time limit to Mikrotik
|
||||||
@ -154,7 +161,8 @@ switch ($action) {
|
|||||||
$timelimit = $p['time_limit'] . ":00:00";
|
$timelimit = $p['time_limit'] . ":00:00";
|
||||||
else
|
else
|
||||||
$timelimit = "00:" . $p['time_limit'] . ":00";
|
$timelimit = "00:" . $p['time_limit'] . ":00";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -165,7 +173,8 @@ switch ($action) {
|
|||||||
$datalimit = $p['data_limit'] . "000000000";
|
$datalimit = $p['data_limit'] . "000000000";
|
||||||
else
|
else
|
||||||
$datalimit = $p['data_limit'] . "000000";
|
$datalimit = $p['data_limit'] . "000000";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -180,7 +189,8 @@ switch ($action) {
|
|||||||
$datalimit = $p['data_limit'] . "000000000";
|
$datalimit = $p['data_limit'] . "000000000";
|
||||||
else
|
else
|
||||||
$datalimit = $p['data_limit'] . "000000";
|
$datalimit = $p['data_limit'] . "000000";
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -189,7 +199,8 @@ switch ($action) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
->setArgument('password', $c['password'])
|
->setArgument('password', $c['password'])
|
||||||
@ -223,19 +234,18 @@ switch ($action) {
|
|||||||
$t->routers = $v1['routers'];
|
$t->routers = $v1['routers'];
|
||||||
$t->type = "Hotspot";
|
$t->type = "Hotspot";
|
||||||
$t->save();
|
$t->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$v1->status = "1";
|
$v1->status = "1";
|
||||||
$v1->user = $c['username'];
|
$v1->user = $c['username'];
|
||||||
$v1->save();
|
$v1->save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ($b) {
|
if ($b) {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
@ -247,7 +257,8 @@ switch ($action) {
|
|||||||
$client->sendSync($setRequest);
|
$client->sendSync($setRequest);
|
||||||
|
|
||||||
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('service', 'pppoe')
|
->setArgument('service', 'pppoe')
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
@ -280,15 +291,16 @@ switch ($action) {
|
|||||||
$t->routers = $v1['routers'];
|
$t->routers = $v1['routers'];
|
||||||
$t->type = "PPPOE";
|
$t->type = "PPPOE";
|
||||||
$t->save();
|
$t->save();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$iport = explode(":", $mikrotik['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $mikrotik['username'], $mikrotik['password'], ($iport[1]) ? $iport[1] : null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
$addRequest = new RouterOS\Request('/ppp/secret/add');
|
||||||
$client->sendSync($addRequest
|
$client->sendSync(
|
||||||
|
$addRequest
|
||||||
->setArgument('name', $c['username'])
|
->setArgument('name', $c['username'])
|
||||||
->setArgument('service', 'pppoe')
|
->setArgument('service', 'pppoe')
|
||||||
->setArgument('profile', $p['name_plan'])
|
->setArgument('profile', $p['name_plan'])
|
||||||
|
@ -40,9 +40,10 @@ foreach ($d as $ds){
|
|||||||
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
|
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($m['ip_address'], $m['username'], $m['password']);
|
$iport = explode(":",$m['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $m['username'], $m['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
@ -81,9 +82,10 @@ foreach ($d as $ds){
|
|||||||
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
|
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($m['ip_address'], $m['username'], $m['password']);
|
$iport = explode(":",$m['ip_address']);
|
||||||
|
$client = new RouterOS\Client($iport[0], $m['username'], $m['password'],($iport[1])?$iport[1]:null);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die("Unable to connect to the router.<br>".$e->getMessage());
|
||||||
}
|
}
|
||||||
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
$printRequest = new RouterOS\Request('/ppp/secret/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
|
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" class="form-control" id="ip_address" name="ip_address">
|
<input type="text" placeholder="192.168.88.1:8728" class="form-control" id="ip_address" name="ip_address">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
|
<label class="col-md-2 control-label">{$_L['IP_Address']}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" class="form-control" id="ip_address" name="ip_address" value="{$d['ip_address']}">
|
<input type="text" placeholder="192.168.88.1:8728" class="form-control" id="ip_address" name="ip_address" value="{$d['ip_address']}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user