.
*/
session_start();
// hide all error
error_reporting(0);
// check url
ob_start("ob_gzhandler");
$url = $_SERVER['REQUEST_URI'];
// load session MikroTik
$session = $_GET['session'];
if (!isset($_SESSION["mikhmon"])) {
header("Location:./admin.php?id=login");
} elseif (empty($session)) {
echo "";
} else {
$_SESSION["$session"] = $session;
$setsession = $_SESSION["$session"];
$_SESSION["connect"] = "";
// time zone
date_default_timezone_set($_SESSION['timezone']);
// lang
include('./include/lang.php');
include('./lang/'.$langid.'.php');
// quick bt
include('./include/quickbt.php');
// load config
include('./include/config.php');
include('./include/readcfg.php');
// theme
include('./include/theme.php');
include('./settings/settheme.php');
if ($_SESSION['theme'] == "") {
$theme = $theme;
$themecolor = $themecolor;
} else {
$theme = $_SESSION['theme'];
$themecolor = $_SESSION['themecolor'];
}
// 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'];
// get variable
$hotspot = $_GET['hotspot'];
$hotspotuser = $_GET['hotspot-user'];
$userbyname = $_GET['hotspot-user'];
$removeuseractive = $_GET['remove-user-active'];
$removehost = $_GET['remove-host'];
$removecookie = $_GET['remove-cookie'];
$removeipbinding = $_GET['remove-ip-binding'];
$removehotspotuser = $_GET['remove-hotspot-user'];
$removehotspotusers = $_GET['remove-hotspot-users'];
$removeuserprofile = $_GET['remove-user-profile'];
$resethotspotuser = $_GET['reset-hotspot-user'];
$removehotspotuserbycomment = $_GET['remove-hotspot-user-by-comment'];
$removeexpiredhotspotuser = $_GET['remove-hotspot-user-expired'];
$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'];
$sys = $_GET['system'];
$enablesch = $_GET['enable-scheduler'];
$disablesch = $_GET['disable-scheduler'];
$removesch = $_GET['remove-scheduler'];
$macbinding = $_GET['mac'];
$ipbinding = $_GET['addr'];
$ppp = $_GET['ppp'];
$secretbyname = $_GET['secret'];
$enablesecr = $_GET['enable-pppsecret'];
$disablesecr = $_GET['disable-pppsecret'];
$removesecr = $_GET['remove-pppsecret'];
$removepprofile = $_GET['remove-pprofile'];
$removepactive = $_GET['remove-pactive'];
$srv = $_GET['srv'];
$prof = $_GET['profile'];
$comm = $_GET['comment'];
$serveractive = $_GET['server'];
$report = $_GET['report'];
$removereport = $_GET['remove-report'];
$minterface = $_GET['interface'];
$pagehotspot = array('users','hosts','ipbinding','cookies','log','dhcp-leases');
$pageppp = array('secrets','profiles','active',);
$pagereport = array('userlog','selling');
include_once('./include/headhtml.php');
include_once('./include/menu.php');
$disable_sci = '';
// logout
if ($hotspot == "logout") {
echo " Logout...";
session_destroy();
echo "";
echo "";
}
// redirect to home
elseif (substr(explode("=", $url)[0],-9) == "/?session") {
include_once('./dashboard/home.php');
$_SESSION['ubn'] = "";
}
// redirect to home
elseif ($hotspot == "dashboard") {
include_once('./dashboard/home.php');
$_SESSION['ubn'] = "";
}
// hotspot log
elseif ($hotspot == "log") {
include_once('./hotspot/log.php');
}
// hotspot log
elseif ($report == "userlog") {
include_once('./report/userlog.php');
}
// about
elseif ($hotspot == "about") {
include_once('./include/about.php');
}
// bad request
elseif (substr($url, -1) == "=") {
echo " Bad request! redirect to Home......";
echo "";
}
// hotspot add users
elseif ($hotspot == "add-user") {
$_SESSION['hua'] = "";
include_once('./hotspot/adduser.php');
}
// hotspot users
elseif ($hotspot == "users" && $prof == "all") {
$_SESSION['ubp'] = "";
$_SESSION['hua'] = "";
$_SESSION['ubc'] = "";
$_SESSION['vcr'] = "";
include_once('./hotspot/users.php');
}
// hotspot users filter by profile
elseif ($hotspot == "users" && $prof != "") {
$_SESSION['ubp'] = $prof;
$_SESSION['hua'] = "";
$_SESSION['ubc'] = "";
$_SESSION['vcr'] = "";
include_once('./hotspot/users.php');
}
// hotspot users filter by comment
elseif ($hotspot == "users" && $comm != "") {
$_SESSION['ubc'] = $comm;
$_SESSION['hua'] = "";
$_SESSION['ubp'] = "";
$_SESSION['vcr'] = "";
include_once('./hotspot/users.php');
}
// hotspot by profile
elseif ($hotspot == "users-by-profile") {
$_SESSION['ubp'] = "";
$_SESSION['hua'] = "";
$_SESSION['ubc'] = "";
$_SESSION['vcr'] = "active";
include_once('./hotspot/userbyprofile.php');
}
// export hotspot users
elseif ($hotspot == "export-users") {
include_once('./hotspot/exportusers.php');
}
// quick print
elseif ($hotspot == "quick-print") {
include_once('./hotspot/quickprint.php');
}
// quick print
elseif ($hotspot == "list-quick-print") {
include_once('./hotspot/listquickprint.php');
}
// add hotspot user
elseif ($hotspotuser == "add") {
include_once('./hotspot/adduser.php');
echo $disable_sci;
}
// add hotspot user
elseif ($hotspotuser == "generate") {
include_once('./hotspot/generateuser.php');
echo $disable_sci;
}
// hotspot users filter by name
elseif (substr($hotspotuser, 0, 1) == "*") {
$_SESSION['ubn'] = $hotspotuser;
$_SESSION['hua'] = "";
include_once('./hotspot/userbyname.php');
} elseif ($hotspotuser != "") {
$_SESSION['ubn'] = $hotspotuser;
include_once('./hotspot/userbyname.php');
}
// remove hotspot user
elseif ($removehotspotuser != "" || $removehotspotusers != "") {
echo " Processing...";
include_once('./process/removehotspotuser.php');
}
// remove hotspot user by comment
elseif ($removehotspotuserbycomment != "") {
echo " Processing...";
include_once('./process/removehotspotuserbycomment.php');
}
// remove expired hotspot user
elseif ($removeexpiredhotspotuser != "") {
echo " Processing...";
include_once('./process/removeexpiredhotspotuser.php');
}
// reset hotspot user
elseif ($resethotspotuser != "") {
echo " Processing...";
include_once('./process/resethotspotuser.php');
}
// enable hotspot user
elseif ($enablehotspotuser != "") {
echo " Processing...";
include_once('./process/enablehotspotuser.php');
}
// disable hotspot user
elseif ($disablehotspotuser != "") {
echo " Processing...";
include_once('./process/disablehotspotuser.php');
}
// user profile
elseif ($hotspot == "user-profiles") {
include_once('./hotspot/userprofile.php');
}
// add user profile
elseif ($userprofile == "add") {
include_once('./hotspot/adduserprofile.php');
}
// User profile by name
elseif (substr($userprofile, 0, 1) == "*") {
include_once('./hotspot/userprofilebyname.php');
} elseif ($userprofile != "") {
include_once('./hotspot/userprofilebyname.php');
}
// remove user profile
elseif ($removeuserprofile != "") {
echo " Processing...";
include_once('./process/removeuserprofile.php');
}
// hotspot active
elseif ($hotspot == "active") {
$_SESSION['ubp'] = "";
$_SESSION['hua'] = "hotspotactive";
$_SESSION['ubc'] = "";
include_once('./hotspot/hotspotactive.php');
}
// dhcp leases
elseif ($hotspot == "dhcp-leases") {
include_once('./dhcp/dhcpleases.php');
}
// traffic monitor
elseif ($minterface == "traffic-monitor") {
include_once('./traffic/trafficmonitor.php');
}
// hotspot hosts
elseif ($hotspot == "hosts" || $hotspot == "hostp" || $hotspot == "hosta") {
include_once('./hotspot/hosts.php');
}
// hotspot bindings
elseif ($hotspot == "binding") {
include_once('./hotspot/binding.php');
}
// template editor
elseif ($hotspot == "template-editor") {
include_once('./settings/vouchereditor.php');
}
// upload logo
elseif ($hotspot == "uplogo") {
include_once('./settings/uplogo.php');
}
// hotspot Cookies
elseif ($hotspot == "cookies") {
include_once('./hotspot/cookies.php');
}
// remove hotspot Cookies
elseif ($removecookie != "") {
echo " Processing...";
include_once('./process/removecookie.php');
}
// hotspot Ip Bindings
elseif ($hotspot == "ipbinding") {
include_once('./hotspot/ipbinding.php');
}
// remove enable disable ipbinding
elseif ($removeipbinding != "" || $enableipbinding != "" || $disableipbinding != "") {
echo " Processing...";
include_once('./process/pipbinding.php');
}
// remove user active
elseif ($removeuseractive != "") {
echo " Processing...";
include_once('./process/removeuseractive.php');
}
// remove host
elseif ($removehost != "") {
echo " Processing...";
include_once('./process/removehost.php');
}
// makebinding
elseif ($macbinding != "") {
echo " Processing...";
include_once('./process/makebinding.php');
}
// selling
elseif ($report == "selling") {
include_once('./report/selling.php');
}
// selling
elseif ($report == "resume-report") {
include_once('./report/resumereport.php');
}
// selling
elseif ($report == "export") {
include_once('./report/export.php');
}
// selling
elseif ($removereport != "") {
echo " Processing...";
include_once('./process/removereport.php');
}
// ppp secret
elseif ($ppp == "secrets") {
include_once('./ppp/pppsecrets.php');
}
// ppp addsecret
elseif ($ppp == "addsecret") {
include_once('./ppp/addsecret.php');
}
// ppp secretbyname
elseif ($secretbyname != "") {
include_once('./ppp/secretbyname.php');
}
// remove enable disable secret
elseif ($removesecr != "" || $enablesecr != "" || $disablesecr != "") {
echo " Processing...";
include_once('./process/psecret.php');
}
// ppp profile
elseif ($ppp == "profiles") {
include_once('./ppp/pppprofile.php');
}
// add ppp profile
elseif ($ppp == "add-profile") {
include_once('./ppp/addpppprofile.php');
}
// add ppp profile
elseif ($ppp == "edit-profile") {
include_once('./ppp/profilebyname.php');
}
// remove enable disable profile
elseif ($removepprofile != "") {
echo " Processing...";
include_once('./process/removepprofile.php');
}
// ppp active connection
elseif ($ppp == "active") {
include_once('./ppp/pppactive.php');
}
// remove ppp active connection
elseif ($removepactive != "") {
echo " Processing...";
include_once('./process/removepactive.php');
}
// sys scheduler
elseif ($sys == "scheduler") {
include_once('./system/scheduler.php');
}
// remove enable disable scheduler
elseif ($removesch != "" || $enablesch != "" || $disablesch != "") {
echo " Processing...";
include_once('./process/pscheduler.php');
}
?>
$("#r_3").load("./dashboard/aload.php?session=' . $session . '&load=logs #r_3");
var interval1 = "' . ($areload * 1000) . '";
var dashboard = setInterval(function() {
$("#r_1").load("./dashboard/aload.php?session=' . $session . '&load=sysresource #r_1");
$("#r_2").load("./dashboard/aload.php?session=' . $session . '&load=hotspot #r_2");
$("#r_3").load("./dashboard/aload.php?session=' . $session . '&load=logs #r_3");
}, interval1);
';
if ($livereport == "enable" || $livereport == "") {
if($_SESSION[$session.'sdate'] != $_SESSION[$session.'idhr']){
$_SESSION[$session.'totalHr'] = "0";
echo '$("#r_4").load("./report/livereport.php?session=' . $session . ' #r_4");';
}else if ($_SESSION[$session.'sdate'] == $_SESSION[$session.'idhr']){
}else{
echo '$("#r_4").load("./report/livereport.php?session=' . $session . ' #r_4");';
}
echo '
var interval2 = "65432";
var livereport = setInterval(function() {
$("#r_4").load("./report/livereport.php?session=' . $session . ' #r_4");
}, interval2);
';}
echo '
function cancelPage(){
window.stop();
clearInterval(dashboard);';
if ($livereport == "enable" || $livereport == "") {
echo '
clearInterval(livereport);';
}
echo '
}
';
} elseif ($hotspot == "active" && $serveractive != "") {
echo '
';
} elseif ($hotspot == "active" && $serveractive == "") {
echo '
';
} elseif ($userprofile == "add" || substr($userprofile, 0, 1) == "*" || $userprofile != "") {
echo "";
} elseif (in_array($hotspot, $pagehotspot) || in_array($ppp, $pageppp) || in_array($report, $pagereport) || $sys == "scheduler") {
echo '
';
}
}
?>