'/ppp/active/print'
This commit is contained in:
parent
d53d85bb9f
commit
5df998874a
@ -38,13 +38,13 @@ foreach ($d as $ds){
|
|||||||
$u = ORM::for_table('tbl_user_recharges')->where('id',$ds['id'])->find_one();
|
$u = ORM::for_table('tbl_user_recharges')->where('id',$ds['id'])->find_one();
|
||||||
$c = ORM::for_table('tbl_customers')->where('id',$ds['customer_id'])->find_one();
|
$c = ORM::for_table('tbl_customers')->where('id',$ds['customer_id'])->find_one();
|
||||||
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
|
$m = ORM::for_table('tbl_routers')->where('name',$ds['routers'])->find_one();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$client = new RouterOS\Client($m['ip_address'], $m['username'], $m['password']);
|
$client = new RouterOS\Client($m['ip_address'], $m['username'], $m['password']);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
die('Unable to connect to the router.');
|
die('Unable to connect to the router.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
|
||||||
$printRequest->setArgument('.proplist', '.id');
|
$printRequest->setArgument('.proplist', '.id');
|
||||||
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
|
$printRequest->setQuery(RouterOS\Query::where('name', $c['username']));
|
||||||
@ -64,7 +64,7 @@ foreach ($d as $ds){
|
|||||||
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
|
$removeRequest = new RouterOS\Request('/ip/hotspot/active/remove');
|
||||||
$removeRequest->setArgument('numbers', $id);
|
$removeRequest->setArgument('numbers', $id);
|
||||||
$client->sendSync($removeRequest);
|
$client->sendSync($removeRequest);
|
||||||
|
|
||||||
//update database user dengan status off
|
//update database user dengan status off
|
||||||
$u->status = 'off';
|
$u->status = 'off';
|
||||||
$u->save();
|
$u->save();
|
||||||
@ -95,7 +95,7 @@ foreach ($d as $ds){
|
|||||||
$client->sendSync($setRequest);
|
$client->sendSync($setRequest);
|
||||||
|
|
||||||
//remove hotspot active
|
//remove hotspot active
|
||||||
$onlineRequest = new RouterOS\Request('/ppp/secret/print');
|
$onlineRequest = new RouterOS\Request('/ppp/active/print');
|
||||||
$onlineRequest->setArgument('.proplist', '.id');
|
$onlineRequest->setArgument('.proplist', '.id');
|
||||||
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
|
$onlineRequest->setQuery(RouterOS\Query::where('name', $c['username']));
|
||||||
$id = $client->sendSync($onlineRequest)->getProperty('.id');
|
$id = $client->sendSync($onlineRequest)->getProperty('.id');
|
||||||
@ -103,12 +103,10 @@ foreach ($d as $ds){
|
|||||||
$removeRequest = new RouterOS\Request('/ppp/active/remove');
|
$removeRequest = new RouterOS\Request('/ppp/active/remove');
|
||||||
$removeRequest->setArgument('numbers', $id);
|
$removeRequest->setArgument('numbers', $id);
|
||||||
$client->sendSync($removeRequest);
|
$client->sendSync($removeRequest);
|
||||||
|
|
||||||
$u->status = 'off';
|
$u->status = 'off';
|
||||||
$u->save();
|
$u->save();
|
||||||
}else
|
}else
|
||||||
echo " : ACTIVE \r\n";
|
echo " : ACTIVE \r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user