detect if radius
This commit is contained in:
parent
e2c0fa5690
commit
5e76c3e214
@ -78,6 +78,7 @@ switch ($do) {
|
|||||||
$v1->save();
|
$v1->save();
|
||||||
// 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{
|
||||||
$m = Mikrotik::info($v1['routers']);
|
$m = Mikrotik::info($v1['routers']);
|
||||||
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||||
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
|
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
|
||||||
@ -86,6 +87,13 @@ switch ($do) {
|
|||||||
}else{
|
}else{
|
||||||
r2(U . "login", 's', Lang::T("Voucher activation success, you are connected to internet"));
|
r2(U . "login", 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
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, now you can login"));
|
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
@ -103,6 +111,7 @@ switch ($do) {
|
|||||||
// check if voucher used by this username
|
// check if voucher used by this username
|
||||||
if ($v1['user'] == $user['username']) {
|
if ($v1['user'] == $user['username']) {
|
||||||
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
|
||||||
|
try{
|
||||||
$m = Mikrotik::info($v1['routers']);
|
$m = Mikrotik::info($v1['routers']);
|
||||||
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
$c = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||||
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
|
Mikrotik::logMeIn($c, $user['username'], $user['password'], $_SESSION['nux-ip'], $_SESSION['nux-mac']);
|
||||||
@ -111,6 +120,13 @@ switch ($do) {
|
|||||||
}else{
|
}else{
|
||||||
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
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"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user