show error stacktrace
This commit is contained in:
parent
7e00feb02f
commit
95097e4512
@ -130,8 +130,9 @@ class Radius
|
|||||||
// we just change the password
|
// we just change the password
|
||||||
$r->value = md5(time() . $username . $radius_pass);
|
$r->value = md5(time() . $username . $radius_pass);
|
||||||
$r->save();
|
$r->save();
|
||||||
Radius::disconnectCustomer($username);
|
return Radius::disconnectCustomer($username);
|
||||||
}
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function customerDelete($username)
|
public static function customerDelete($username)
|
||||||
@ -158,7 +159,7 @@ class Radius
|
|||||||
$p->priority = 1;
|
$p->priority = 1;
|
||||||
$p->save();
|
$p->save();
|
||||||
}
|
}
|
||||||
if ($plan['type'] == 'HOTSPOT' && $plan['typebp'] == "Limited") {
|
if ($plan['type'] == 'Hotspot' && $plan['typebp'] == "Limited") {
|
||||||
if ($plan['limit_type'] == "Time_Limit") {
|
if ($plan['limit_type'] == "Time_Limit") {
|
||||||
if ($plan['time_unit'] == 'Hrs')
|
if ($plan['time_unit'] == 'Hrs')
|
||||||
$timelimit = $plan['time_limit'] * 60 * 60;
|
$timelimit = $plan['time_limit'] * 60 * 60;
|
||||||
@ -184,14 +185,17 @@ class Radius
|
|||||||
Radius::upsertCustomer($customer['username'], 'Expire-After', $timelimit);
|
Radius::upsertCustomer($customer['username'], 'Expire-After', $timelimit);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Radius::getTableCustomer()->where_equal('username', $customer['username'])->whereEqual('attribute', 'Max-Volume')->delete();
|
$r = Radius::getTableCustomer()->where_equal('username', $customer['username'])->whereEqual('attribute', 'Max-Volume')->findOne();
|
||||||
Radius::getTableCustomer()->where_equal('username', $customer['username'])->whereEqual('attribute', 'Expire-After')->delete();
|
if($r) $r->delete();
|
||||||
|
$r = Radius::getTableCustomer()->where_equal('username', $customer['username'])->whereEqual('attribute', 'Expire-After')->findOne();
|
||||||
|
if($r) $r->delete();
|
||||||
}
|
}
|
||||||
// expired user
|
// expired user
|
||||||
if ($expired != null) {
|
if ($expired != null) {
|
||||||
Radius::upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired)));
|
Radius::upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired)));
|
||||||
} else {
|
} else {
|
||||||
Radius::getTableCustomer()->where_equal('username', $customer['username'])->whereEqual('attribute', 'expiration')->delete();
|
$r = Radius::getTableCustomer()->where_equal('username', $customer['username'])->whereEqual('attribute', 'expiration')->findOne();
|
||||||
|
if($r) $r->delete();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -206,7 +210,7 @@ class Radius
|
|||||||
Radius::upsertCustomer($customer['username'], 'Cleartext-Password', $customer['password']);
|
Radius::upsertCustomer($customer['username'], 'Cleartext-Password', $customer['password']);
|
||||||
}
|
}
|
||||||
Radius::upsertCustomer($customer['username'], 'Simultaneous-Use', ($plan['type'] == 'PPPOE') ? 1 : $plan['shared_users']);
|
Radius::upsertCustomer($customer['username'], 'Simultaneous-Use', ($plan['type'] == 'PPPOE') ? 1 : $plan['shared_users']);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -246,12 +250,14 @@ class Radius
|
|||||||
$nas = Radius::getTableNas()->findMany();
|
$nas = Radius::getTableNas()->findMany();
|
||||||
$count = count($nas)*15;
|
$count = count($nas)*15;
|
||||||
set_time_limit($count);
|
set_time_limit($count);
|
||||||
|
$result = [];
|
||||||
foreach ($nas as $n){
|
foreach ($nas as $n){
|
||||||
$port = 3799;
|
$port = 3799;
|
||||||
if(!empty($n['ports'])){
|
if(!empty($n['ports'])){
|
||||||
$port = $n['ports'];
|
$port = $n['ports'];
|
||||||
}
|
}
|
||||||
shell_exec("echo 'User-Name = $username' | ".Radius::getClient()." ".trim($n['nasname']).":$port disconnect '".$n['secret']."'");
|
$result[] = $n['nasname'].': '.shell_exec("echo 'User-Name = $username' | ".Radius::getClient()." ".trim($n['nasname']).":$port disconnect '".$n['secret']."'");
|
||||||
}
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ try {
|
|||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$ui->assign("error_title", "PHPNuxBill Crash");
|
$ui->assign("error_title", "PHPNuxBill Crash");
|
||||||
$ui->assign("error_message", $e->getMessage());
|
$ui->assign("error_message", $e->getMessage().'<br><pre>'.$e->getTraceAsString().'</pre>');
|
||||||
$ui->display('router-error.tpl');
|
$ui->display('router-error.tpl');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
* PHP Mikrotik Billing (https://github.com/hotspotbilling/phpnuxbill/)
|
||||||
|
* by @ibnux
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
_auth();
|
_auth();
|
||||||
$ui->assign('_title', $_L['My_Account']);
|
$ui->assign('_title', $_L['My_Account']);
|
||||||
$ui->assign('_system_menu', 'accounts');
|
$ui->assign('_system_menu', 'accounts');
|
||||||
@ -11,10 +14,6 @@ $action = $routes['1'];
|
|||||||
$user = User::_info();
|
$user = User::_info();
|
||||||
$ui->assign('_user', $user);
|
$ui->assign('_user', $user);
|
||||||
|
|
||||||
use PEAR2\Net\RouterOS;
|
|
||||||
|
|
||||||
require_once 'system/autoload/PEAR2/Autoload.php';
|
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
|
||||||
case 'change-password':
|
case 'change-password':
|
||||||
|
@ -41,21 +41,24 @@ switch ($action) {
|
|||||||
case 'sync':
|
case 'sync':
|
||||||
set_time_limit(-1);
|
set_time_limit(-1);
|
||||||
$plans = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many();
|
$plans = ORM::for_table('tbl_user_recharges')->where('status', 'on')->find_many();
|
||||||
echo count($plans);
|
|
||||||
$log = '';
|
$log = '';
|
||||||
$router = '';
|
$router = '';
|
||||||
foreach ($plans as $plan) {
|
foreach ($plans as $plan) {
|
||||||
if ($router != $plan['routers']) {
|
if ($router != $plan['routers'] && $plan['routers'] != 'radius') {
|
||||||
$mikrotik = Mikrotik::info($plan['routers']);
|
$mikrotik = Mikrotik::info($plan['routers']);
|
||||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||||
$router = $plan['routers'];
|
$router = $plan['routers'];
|
||||||
}
|
}
|
||||||
$p = ORM::for_table('tbl_plans')->findOne($plan['plan_id']);
|
$p = ORM::for_table('tbl_plans')->findOne($plan['plan_id']);
|
||||||
$c = ORM::for_table('tbl_customers')->findOne($plan['customer_id']);
|
$c = ORM::for_table('tbl_customers')->findOne($plan['customer_id']);
|
||||||
if ($plan['type'] == 'Hotspot') {
|
if($plan['routers'] == 'radius'){
|
||||||
Mikrotik::addHotspotUser($client, $p, $c);
|
Radius::customerAddPlan($c, $p, $plans['expiration'].' '.$plans['time']);
|
||||||
} else if ($plan['type'] == 'PPPOE') {
|
}else{
|
||||||
Mikrotik::addPpoeUser($client, $p, $c);
|
if ($plan['type'] == 'Hotspot') {
|
||||||
|
Mikrotik::addHotspotUser($client, $p, $c);
|
||||||
|
} else if ($plan['type'] == 'PPPOE') {
|
||||||
|
Mikrotik::addPpoeUser($client, $p, $c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$log .= "DONE : $plan[username], $plan[namebp], $plan[type], $plan[routers]<br>";
|
$log .= "DONE : $plan[username], $plan[namebp], $plan[type], $plan[routers]<br>";
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ foreach ($d as $ds) {
|
|||||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||||
|
|
||||||
if ($p['is_radius']) {
|
if ($p['is_radius']) {
|
||||||
Radius::customerDeactivate($c['username']);
|
echo Radius::customerDeactivate($c['username']);
|
||||||
}else{
|
}else{
|
||||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||||
if (!empty($p['pool_expired'])) {
|
if (!empty($p['pool_expired'])) {
|
||||||
@ -150,7 +150,7 @@ foreach ($d as $ds) {
|
|||||||
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $u['plan_id'])->find_one();
|
||||||
|
|
||||||
if ($p['is_radius']) {
|
if ($p['is_radius']) {
|
||||||
Radius::customerDeactivate($c['username']);
|
echo Radius::customerDeactivate($c['username']);
|
||||||
}else{
|
}else{
|
||||||
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
$client = Mikrotik::getClient($m['ip_address'], $m['username'], $m['password']);
|
||||||
if (!empty($p['pool_expired'])) {
|
if (!empty($p['pool_expired'])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user