2024.5.22

This commit is contained in:
Ibnu Maksum 2024-05-22 13:27:07 +07:00
parent 13eedc814d
commit e5b28c2c15
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
2 changed files with 21 additions and 12 deletions

View File

@ -172,7 +172,7 @@ class Radius
if ($p) { if ($p) {
// if exists // if exists
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']); Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Data', 'username', $customer['username']); Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
$p->groupname = "plan_" . $plan['id']; $p->groupname = "plan_" . $plan['id'];
$p->save(); $p->save();
} else { } else {
@ -189,14 +189,16 @@ class Radius
else else
$timelimit = $plan['time_limit'] * 60; $timelimit = $plan['time_limit'] * 60;
Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit); Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
//Radius::upsertCustomer($customer['username'], 'Expire-After', $timelimit);
} else if ($plan['limit_type'] == "Data_Limit") { } else if ($plan['limit_type'] == "Data_Limit") {
if ($plan['data_unit'] == 'GB') if ($plan['data_unit'] == 'GB')
$datalimit = $plan['data_limit'] . "000000000"; $datalimit = $plan['data_limit'] . "000000000";
else else
$datalimit = $plan['data_limit'] . "000000"; $datalimit = $plan['data_limit'] . "000000";
//Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit); Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
// Mikrotik Spesific // Mikrotik Spesific
Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit); //Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
//Radius::upsertCustomer($customer['username'], 'Mikrotik-Total-Limit', $datalimit);
} else if ($plan['limit_type'] == "Both_Limit") { } else if ($plan['limit_type'] == "Both_Limit") {
if ($plan['time_unit'] == 'Hrs') if ($plan['time_unit'] == 'Hrs')
$timelimit = $plan['time_limit'] * 60 * 60; $timelimit = $plan['time_limit'] * 60 * 60;
@ -206,15 +208,20 @@ class Radius
$datalimit = $plan['data_limit'] . "000000000"; $datalimit = $plan['data_limit'] . "000000000";
else else
$datalimit = $plan['data_limit'] . "000000"; $datalimit = $plan['data_limit'] . "000000";
//Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit); Radius::upsertCustomer($customer['username'], 'Max-Volume', $datalimit);
Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit); Radius::upsertCustomer($customer['username'], 'Max-All-Session', $timelimit);
// Mikrotik Spesific // Mikrotik Spesific
Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit); //Radius::upsertCustomer($customer['username'], 'Max-Data', $datalimit);
//Radius::upsertCustomer($customer['username'], 'Mikrotik-Total-Limit', $datalimit);
} }
} else { } else {
//Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']); Radius::delAtribute(Radius::getTableCustomer(), 'Max-Volume', 'username', $customer['username']);
Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']); Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
Radius::delAtribute(Radius::getTableCustomer(), 'Max-Data', 'username', $customer['username']); //Radius::delAtribute(Radius::getTableCustomer(), 'Max-Data', 'username', $customer['username']);
} }
Radius::disconnectCustomer($customer['username']); Radius::disconnectCustomer($customer['username']);
@ -223,8 +230,9 @@ class Radius
// expired user // expired user
if ($expired != null) { if ($expired != null) {
//Radius::upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time()); //Radius::upsertCustomer($customer['username'], 'access-period', strtotime($expired) - time());
Radius::upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired))); Radius::upsertCustomer($customer['username'], 'Max-All-Session', strtotime($expired) - time());
//Radius::upsertCustomer($customer['username'], 'expiration', date('d M Y H:i:s', strtotime($expired)));
// Mikrotik Spesific // Mikrotik Spesific
Radius::upsertCustomer( Radius::upsertCustomer(
$customer['username'], $customer['username'],
@ -232,8 +240,9 @@ class Radius
date('Y-m-d', strtotime($expired)) . 'T' . date('H:i:s', strtotime($expired)) . Timezone::getTimeOffset($config['timezone']) date('Y-m-d', strtotime($expired)) . 'T' . date('H:i:s', strtotime($expired)) . Timezone::getTimeOffset($config['timezone'])
); );
} else { } else {
//Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']); Radius::delAtribute(Radius::getTableCustomer(), 'Max-All-Session', 'username', $customer['username']);
Radius::delAtribute(Radius::getTableCustomer(), 'expiration', 'username', $customer['username']); //Radius::delAtribute(Radius::getTableCustomer(), 'access-period', 'username', $customer['username']);
//Radius::delAtribute(Radius::getTableCustomer(), 'expiration', 'username', $customer['username']);
} }
if ($plan['type'] == 'PPPOE') { if ($plan['type'] == 'PPPOE') {

View File

@ -1,3 +1,3 @@
{ {
"version": "2024.5.21" "version": "2024.5.22"
} }