done, maybe, need to test all
This commit is contained in:
parent
c661976eae
commit
7a94254df9
@ -17,9 +17,10 @@ switch ($action) {
|
|||||||
case 'isLogin':
|
case 'isLogin':
|
||||||
$bill = ORM::for_table('tbl_user_recharges')->where('id', $routes['2'])->where('username', $user['username'])->findOne();
|
$bill = ORM::for_table('tbl_user_recharges')->where('id', $routes['2'])->where('username', $user['username'])->findOne();
|
||||||
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
|
if ($bill['type'] == 'Hotspot' && $bill['status'] == 'on') {
|
||||||
$m = Mikrotik::info($bill['routers']);
|
$dvc = Package::getDevice($d);
|
||||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
if (file_exists($dvc)) {
|
||||||
if (Mikrotik::isUserLogin($client, $user['username'])) {
|
require_once $dvc;
|
||||||
|
if ((new $d['device'])->online_customer($user, $bill['routers'])) {
|
||||||
die('<a href="' . U . 'home&mikrotik=logout&id='.$bill['id'].'" onclick="return confirm(\''.Lang::T('Disconnect Internet?').'\')" class="btn btn-success btn-xs btn-block">'.Lang::T('You are Online, Logout?').'</a>');
|
die('<a href="' . U . 'home&mikrotik=logout&id='.$bill['id'].'" onclick="return confirm(\''.Lang::T('Disconnect Internet?').'\')" class="btn btn-success btn-xs btn-block">'.Lang::T('You are Online, Logout?').'</a>');
|
||||||
} else {
|
} else {
|
||||||
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
||||||
@ -28,6 +29,10 @@ switch ($action) {
|
|||||||
die(Lang::T('Your account not connected to internet'));
|
die(Lang::T('Your account not connected to internet'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
die('--');
|
die('--');
|
||||||
}
|
}
|
||||||
|
@ -95,9 +95,18 @@ switch ($do) {
|
|||||||
// add customer to mikrotik
|
// add customer to mikrotik
|
||||||
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
||||||
try {
|
try {
|
||||||
$m = Mikrotik::info($v1['routers']);
|
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
|
||||||
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
$dvc = Package::getDevice($p);
|
||||||
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
|
if (file_exists($dvc)) {
|
||||||
|
require_once $dvc;
|
||||||
|
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
|
||||||
|
} else {
|
||||||
|
if (!empty($config['voucher_redirect'])) {
|
||||||
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
|
} else {
|
||||||
|
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!empty($config['voucher_redirect'])) {
|
if (!empty($config['voucher_redirect'])) {
|
||||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||||
} else {
|
} else {
|
||||||
@ -130,9 +139,18 @@ switch ($do) {
|
|||||||
$user->save();
|
$user->save();
|
||||||
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
||||||
try {
|
try {
|
||||||
$m = Mikrotik::info($v1['routers']);
|
$p = ORM::for_table('tbl_plans')->where('id', $v1['id_plan'])->find_one();
|
||||||
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
$dvc = Package::getDevice($p);
|
||||||
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
|
if (file_exists($dvc)) {
|
||||||
|
require_once $dvc;
|
||||||
|
(new $p['device'])->connect_customer($user, $_SESSION['nux-ip'], $_SESSION['nux-mac'], $v1['routers']);
|
||||||
|
} else {
|
||||||
|
if (!empty($config['voucher_redirect'])) {
|
||||||
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
|
} else {
|
||||||
|
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!empty($config['voucher_redirect'])) {
|
if (!empty($config['voucher_redirect'])) {
|
||||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||||
} else {
|
} else {
|
||||||
|
@ -128,7 +128,7 @@ switch ($action) {
|
|||||||
r2(U . "order/package", 'e', Lang::T("Transaction Not found"));
|
r2(U . "order/package", 'e', Lang::T("Transaction Not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$router = Mikrotik::info($trx['routers']);
|
$router = ORM::for_table('tbl_routers')->where('name', $trx['routers'])->find_one();
|
||||||
$plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']);
|
$plan = ORM::for_table('tbl_plans')->find_one($trx['plan_id']);
|
||||||
$bandw = ORM::for_table('tbl_bandwidth')->find_one($plan['id_bw']);
|
$bandw = ORM::for_table('tbl_bandwidth')->find_one($plan['id_bw']);
|
||||||
$invoice = ORM::for_table('tbl_transactions')->where("invoice", $trx['trx_invoice'])->find_one();
|
$invoice = ORM::for_table('tbl_transactions')->where("invoice", $trx['trx_invoice'])->find_one();
|
||||||
|
@ -56,7 +56,8 @@ switch ($action) {
|
|||||||
$msg .= 'NAS IP Exists<br>';
|
$msg .= 'NAS IP Exists<br>';
|
||||||
}
|
}
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
$id = Radius::nasAdd($shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community);
|
require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "Radius.php";
|
||||||
|
(new Radius())->nasAdd($shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community);
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
r2(U . 'radius/nas-list/', 's', "NAS Added");
|
r2(U . 'radius/nas-list/', 's', "NAS Added");
|
||||||
} else {
|
} else {
|
||||||
@ -113,7 +114,8 @@ switch ($action) {
|
|||||||
$type = null;
|
$type = null;
|
||||||
}
|
}
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
if (Radius::nasUpdate($id, $shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community)) {
|
require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "Radius.php";
|
||||||
|
if ((new Radius())->nasUpdate($id, $shortname, $nasname, $ports, $secret, $routers, $description, $type, $server, $community)) {
|
||||||
r2(U . 'radius/list/', 's', "NAS Saved");
|
r2(U . 'radius/list/', 's', "NAS Saved");
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
|
r2(U . 'radius/nas-add', 'e', 'NAS NOT Exists');
|
||||||
|
@ -41,14 +41,6 @@ switch ($action) {
|
|||||||
$logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.default.png';
|
$logo = $UPLOAD_URL_PATH . DIRECTORY_SEPARATOR . 'logo.default.png';
|
||||||
}
|
}
|
||||||
$ui->assign('logo', $logo);
|
$ui->assign('logo', $logo);
|
||||||
if ($config['radius_enable'] && empty($config['radius_client'])) {
|
|
||||||
try {
|
|
||||||
$config['radius_client'] = Radius::getClient();
|
|
||||||
$ui->assign('_c', $_c);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
//ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$themes = [];
|
$themes = [];
|
||||||
$files = scandir('ui/themes/');
|
$files = scandir('ui/themes/');
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
@ -109,7 +101,8 @@ switch ($action) {
|
|||||||
} else {
|
} else {
|
||||||
if ($radius_enable) {
|
if ($radius_enable) {
|
||||||
try {
|
try {
|
||||||
Radius::getTableNas()->find_many();
|
require_once $DEVICE_PATH . DIRECTORY_SEPARATOR . "Radius.php";
|
||||||
|
(new Radius())->getTableNas()->find_many();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$ui->assign("error_title", "RADIUS Error");
|
$ui->assign("error_title", "RADIUS Error");
|
||||||
$ui->assign("error_message", "Radius table not found.<br><br>" .
|
$ui->assign("error_message", "Radius table not found.<br><br>" .
|
||||||
|
@ -93,7 +93,7 @@ class MikrotikHotspot
|
|||||||
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
$printRequest = new RouterOS\Request(
|
$printRequest = new RouterOS\Request(
|
||||||
'/ip hotspot active print',
|
'/ip hotspot active print',
|
||||||
RouterOS\Query::where('user', $customer['username'])
|
RouterOS\Query::where('name', $customer['username'])
|
||||||
);
|
);
|
||||||
return $client->sendSync($printRequest)->getProperty('.id');
|
return $client->sendSync($printRequest)->getProperty('.id');
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,23 @@ class MikrotikPppoe
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function online_customer($customer, $router_name)
|
||||||
|
{
|
||||||
|
global $_app_stage;
|
||||||
|
if ($_app_stage == 'demo') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$mikrotik = $this->info($router_name);
|
||||||
|
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
|
$printRequest = new RouterOS\Request(
|
||||||
|
'/ppp active print',
|
||||||
|
RouterOS\Query::where('user', $customer['username'])
|
||||||
|
);
|
||||||
|
return $client->sendSync($printRequest)->getProperty('.id');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function connect_customer($customer, $ip, $mac_address, $router_name)
|
function connect_customer($customer, $ip, $mac_address, $router_name)
|
||||||
{
|
{
|
||||||
global $_app_stage;
|
global $_app_stage;
|
||||||
|
@ -220,12 +220,6 @@
|
|||||||
href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius"
|
href="https://github.com/hotspotbilling/phpnuxbill/wiki/FreeRadius"
|
||||||
target="_blank">Radius Instructions</a></p>
|
target="_blank">Radius Instructions</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-2 control-label">Radius Client</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="text" class="form-control" name="radius_client" value="{$_c['radius_client']}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user