-
Notifications
You must be signed in to change notification settings - Fork 48
/
ajax_rem_selected.php
38 lines (35 loc) · 1.14 KB
/
ajax_rem_selected.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use PEAR2\Net\RouterOS;
require_once 'PEAR2/Autoload.php';
require_once 'config.php';
$util = new RouterOS\Util($client = new RouterOS\Client("$host", "$user", "$pass"));
if ( !isset($_SESSION) ) session_start();
$i = 0;
if ($_SESSION['user_level'] <= 3) {
$guest_list=$_GET['removal_list'];
if (count($guest_list) != 0) {
$printRequest = new RouterOS\Request('/ip/hotspot/user/print');
$printRequest->setArgument('.proplist', '.id,name');
$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
foreach ($guest_list as $guest) {
$i++;
//$printRequest->setArgument('.proplist', '.id,name');
$printRequest->setQuery(RouterOS\Query::where('name', $guest));
$id = $client->sendSync($printRequest)->getProperty('.id');
//$removeRequest = new RouterOS\Request('/ip/hotspot/user/remove');
$removeRequest->setArgument('numbers', $id);
$client->sendSync($removeRequest);
}
echo $i;
}
else
{
echo -1;
}
}
else
{
echo 0;
}
//$id = $client->sendSync(new Request('/ip/hotspot/user/profile/print .proplist=.id', null, Query::where('name', $profile_name)))->getArgument('.id');
?>