-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmanage-mt.php
executable file
·43 lines (35 loc) · 1.23 KB
/
manage-mt.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
39
40
41
42
43
<?php
header("Content-type: application/json");
require('config.ini');
require('class/Routeros_api.php');
$username = ((isset($_POST['username']))?$_POST['username']:'');
$password = ((isset($_POST['password']))?$_POST['password']:'');
$email = ((isset($_POST['email']))?$_POST['email']:'');
$ifb = ((isset($_POST['ifb']))?$_POST['ifb']:'');
$API = new routeros_api();
$API->debug = false;
$response = array();
//login mt
if ($API->connect($ip_mt, $username_mt, $password_mt)) {
$ARRAY = $API->comm("/ip/hotspot/user/add", array(
'server' => $server_user,
'name' => $username,
'password' => $password,
'profile' => $profile_user,
'email' => $email,
'comment' => $room_user
));
if( isset($ARRAY['!trap']) ){
if( $ifb != 'ifb' ){
$response['msg']='nouser';
return print json_encode($response);
}
}
$API->disconnect();
$response['msg']='ok';
return print json_encode($response);
}else{
$response['msg']='no';
return print json_encode($response);
}
?>