-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.php
320 lines (266 loc) · 9.06 KB
/
index.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<?php
/*
* Copyright (C) 2018 Laksamadi Guko.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
// hide all error
error_reporting(0);
// load ip user pass MikroTik
include('./include/config.php');
if(!isset($_SESSION["$userhost"])){
header("Location:./admin.php?id=login");
}else{
// routeros api
include_once('./lib/routeros_api.class.php');
include_once('./lib/formatbytesbites.php');
$API = new RouterosAPI();
$API->debug = false;
$API->connect( $iphost, $userhost, decrypt($passwdhost));
$getidentity = $API->comm("/system/identity/print");
$identity = $getidentity[0]['name'];
if($identity == ""){
session_destroy();
echo "<script>window.location='./?hotspot=login'</script>";
}
// check url
$url = $_SERVER['REQUEST_URI'];
// get variable
$hotspot = $_GET['hotspot'];
$hotspotuser = $_GET['hotspot-user'];
$userbyname = $_GET['hotspot-user'];
$removeuseractive = $_GET['remove-user-active'];
$removehost = $_GET['remove-host'];
$removeipbinding = $_GET['remove-ip-binding'];
$removehotspotuser = $_GET['remove-hotspot-user'];
$removeuserprofile = $_GET['remove-user-profile'];
$resethotspotuser = $_GET['reset-hotspot-user'];
$removehotspotuserbycomment = $_GET['remove-hotspot-user-by-comment'];
$enablehotspotuser = $_GET['enable-hotspot-user'];
$disablehotspotuser = $_GET['disable-hotspot-user'];
$enableipbinding = $_GET['enable-ip-binding'];
$disableipbinding = $_GET['disable-ip-binding'];
$userprofile = $_GET['user-profile'];
$userprofilebyname = $_GET['user-profile'];
$macbinding = $_GET['mac'];
$ipbinding = $_GET['addr'];
$srv = $_GET['srv'];
$prof = $_GET['profile'];
$comm = $_GET['comment'];
}
?>
<?php
include_once('./include/headhtml.php');
if(!isset($_SESSION["$userhost"])){
header("Location:./admin.php?id=login");
}else{
include_once('./include/menu.php');
}
?>
<?php
// logout
if($hotspot == "logout"){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Logout...</b>";
session_destroy();
echo "<script>window.location='./admin.php?id=login'</script>";
}
// redirect to home
elseif(substr($url,-1) == "/" || substr($url,-9) == "index.php"){
?>
<?php
include_once('./include/home.php');
$_SESSION['ubn'] = "";
}
// hotspot log
elseif($hotspot == "log"){
include_once('./include/log.php');
}
// hotspot log
elseif($hotspot == "userlog"){
include_once('./include/userlog.php');
}
// about
elseif($hotspot == "about"){
include_once('./include/about.php');
}
// bad request
elseif(substr($url,-1) == "="){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Bad request! redirect to Home......</b>";
echo "<script>window.location='./'</script>";
}
// hotspot add users
elseif($hotspot == "add-user"){
$_SESSION['hua'] = "";
include_once('./include/adduser.php');
}
// hotspot users
elseif($hotspot == "users" && $prof == "all"){
$_SESSION['ubp'] = "";
$_SESSION['hua'] = "";
$_SESSION['ubc'] = "";
include_once('./include/users.php');
}
// hotspot users filter by profile
elseif($hotspot == "users" && $prof!= ""){
$_SESSION['ubp'] = $prof;
$_SESSION['hua'] = "";
$_SESSION['ubc'] = "";
include_once('./include/users.php');
}
// hotspot users filter by comment
elseif($hotspot == "users" && $comm!= ""){
$_SESSION['ubc'] = $comm;
$_SESSION['hua'] = "";
$_SESSION['ubp'] = "";
include_once('./include/users.php');
}
// add hotspot user
elseif($hotspotuser == "add"){
include_once('./include/adduser.php');
}
// add hotspot user
elseif($hotspotuser == "generate"){
include_once('./include/generateuser.php');
}
// hotspot users filter by name
elseif(substr($hotspotuser,0,1) == "*"){
$_SESSION['ubn'] = $hotspotuser;
$_SESSION['hua'] = "";
include_once('./include/userbyname.php');
}elseif($hotspotuser != ""){
$_SESSION['ubn'] = $hotspotuser;
include_once('./include/userbyname.php');
}
// remove hotspot user
elseif($removehotspotuser != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/removehotspotuser.php');
}
// remove hotspot user by comment
elseif($removehotspotuserbycomment != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/removehotspotuserbycomment.php');
}
// reset hotspot user
elseif($resethotspotuser != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/resethotspotuser.php');
}
// enable hotspot user
elseif($enablehotspotuser != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/enablehotspotuser.php');
}
// disable hotspot user
elseif($disablehotspotuser != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/disablehotspotuser.php');
}
// user profile
elseif($hotspot == "user-profiles"){
include_once('./include/userprofile.php');
}
// add user profile
elseif($userprofile == "add"){
include_once('./include/adduserprofile.php');
}
// User profile by name
elseif(substr($userprofile,0,1) == "*"){
include_once('./include/userprofilebyname.php');
}elseif($userprofile != ""){
include_once('./include/userprofilebyname.php');
}
// remove user profile
elseif($removeuserprofile != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/removeuserprofile.php');
}
// hotspot active
elseif($hotspot == "active"){
$_SESSION['ubp'] = "";
$_SESSION['hua'] = "hotspotactive";
$_SESSION['ubc'] = "";
include_once('./include/hotspotactive.php');
}
// hotspot hosts
elseif($hotspot == "hosts" || $hotspot == "hostp" || $hotspot == "hosta"){
include_once('./include/hosts.php');
}
// hotspot bindings
elseif($hotspot == "binding"){
include_once('./include/binding.php');
}
// hotspot Ip Bindings
elseif($hotspot == "ipbinding"){
include_once('./include/ipbinding.php');
}
// enable hotspot user
elseif($enableipbinding != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/enableipbinding.php');
}
// disable hotspot user
elseif($disableipbinding != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/disableipbinding.php');
}
// remove user active
elseif($removeuseractive != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/removeuseractive.php');
}
// remove host
elseif($removehost != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/removehost.php');
}
// remove ipbinding
elseif($removeipbinding != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/removeipbinding.php');
}
// makebinding
elseif($macbinding != ""){
echo "<b class='cl-w'><i class='fa fa-circle-o-notch fa-spin' style='font-size:24px'></i> Processing...</b>";
include_once('./process/makebinding.php');
}
// selling
elseif($hotspot == "selling"){
include_once('./include/selling.php');
}
?>
</div>
<!--
<footer class="main-footer">
<strong> <a href="https://laksa19.github.io" target="_blank">Mikhmon</a> • Template by <a href="https://adminlte.io/">AdminLTE</a></strong>
<div class="float-right d-none d-sm-inline-block">
<b>Version </b> 2.9
</div>
</footer>
-->
<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<script src="js/autoreload.js"></script>
<script src="js/mikhmon.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button)
</script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="js/adminlte.js"></script>
</body>
</html>