diff --git a/system/controllers/autoload.php b/system/controllers/autoload.php index e24af345..c6e9b03c 100644 --- a/system/controllers/autoload.php +++ b/system/controllers/autoload.php @@ -1,4 +1,5 @@ assign('_admin', $admin); switch ($action) { case 'pool': $routers = _get('routers'); - if(empty($routers)){ + if (empty($routers)) { $d = ORM::for_table('tbl_pool')->find_many(); - }else{ + } else { $d = ORM::for_table('tbl_pool')->where('routers', $routers)->find_many(); } $ui->assign('routers', $routers); @@ -34,20 +35,45 @@ switch ($action) { $ui->display('autoload-server.tpl'); break; - + case 'pppoe_ip_used': + if (!empty(_get('ip'))) { + $cs = ORM::for_table('tbl_customers') + ->select("username") + ->where_not_equal('id', _get('id')) + ->where("pppoe_ip", _get('ip')) + ->findArray(); + if (count($cs) > 0) { + $c = array_column($cs, 'username'); + die(Lang::T("IP has been used by") . ' : ' . implode(", ", $c)); + } + } + die(); + case 'pppoe_username_used': + if (!empty(_get('u'))) { + $cs = ORM::for_table('tbl_customers') + ->select("username") + ->where_not_equal('id', _get('id')) + ->where("pppoe_username", _get('u')) + ->findArray(); + if (count($cs) > 0) { + $c = array_column($cs, 'username'); + die(Lang::T("Username has been used by") . ' : ' . implode(", ", $c)); + } + } + die(); case 'plan': $server = _post('server'); $jenis = _post('jenis'); - if(in_array($admin['user_type'], array('SuperAdmin', 'Admin'))){ - if($server=='radius'){ + if (in_array($admin['user_type'], array('SuperAdmin', 'Admin'))) { + if ($server == 'radius') { $d = ORM::for_table('tbl_plans')->where('is_radius', 1)->where('type', $jenis)->find_many(); - }else{ + } else { $d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->find_many(); } - }else{ - if($server=='radius'){ + } else { + if ($server == 'radius') { $d = ORM::for_table('tbl_plans')->where('is_radius', 1)->where('type', $jenis)->where('enabled', '1')->find_many(); - }else{ + } else { $d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->where('enabled', '1')->find_many(); } } @@ -59,9 +85,9 @@ switch ($action) { $d = ORM::for_table('tbl_user_recharges')->where('customer_id', $routes['2'])->findOne(); if ($d) { if ($d['status'] == 'on') { - die(''.$d['namebp'].''); + die('' . $d['namebp'] . ''); } else { - die(''.$d['namebp'].''); + die('' . $d['namebp'] . ''); } } else { die(''); diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl index 1b0a97b6..1839bcea 100644 --- a/ui/ui/customers-add.tpl +++ b/ui/ui/customers-add.tpl @@ -96,9 +96,9 @@
PPPOE
- +
- + {Lang::T('Not Working for freeradius')}
@@ -110,9 +110,9 @@
- +
- + {Lang::T('Not Working for freeradius')}
diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index 2941898e..e1ce53f8 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -119,11 +119,11 @@
PPPOE
- +
- {Lang::T('Not Working for freeradius')} + onkeyup="checkUsername(this, {$d['id']})" value="{$d['pppoe_username']}"> + {Lang::T('Not Working with Freeradius Mysql')}
@@ -135,11 +135,11 @@
- +
- {Lang::T('Not Working for freeradius')} + onkeyup="checkIP(this, {$d['id']})" value="{$d['pppoe_ip']}"> + {Lang::T('Not Working with Freeradius Mysql')}
diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index 9eacbce3..f4434ccb 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -101,6 +101,7 @@ {Lang::T('Contact')} {Lang::T('Package')} {Lang::T('Service Type')} + PPPOE {Lang::T('Status')} {Lang::T('Created On')} {Lang::T('Manage')} @@ -135,6 +136,11 @@ {$ds['service_type']} + + {$ds['pppoe_username']} + {if !empty($ds['pppoe_username']) && !empty($ds['pppoe_ip'])}:{/if} + {$ds['pppoe_ip']} + {Lang::T($ds['status'])} {Lang::dateTimeFormat($ds['created_at'])} diff --git a/ui/ui/scripts/custom.js b/ui/ui/scripts/custom.js index 7b33f116..844f5ffc 100644 --- a/ui/ui/scripts/custom.js +++ b/ui/ui/scripts/custom.js @@ -37,6 +37,22 @@ $(document).ready(function () { $("#Hotspot").prop("checked", true).change(); +function checkIP(f, id) { + if (f.value.length > 6) { + $.get('./?_route=autoload/pppoe_ip_used&ip=' + f.value + '&id=' + id, function(data) { + $("#warning_ip").html(data) + }); + } +} + +function checkUsername(f, id) { + if (f.value.length > 1) { + $.get('./?_route=autoload/pppoe_username_used&u=' + f.value + '&id=' + id, function(data) { + $("#warning_username").html(data) + }); + } +} + //auto load pool - pppoe plan var htmlobjek; $(document).ready(function(){