.
*/
// hide all error
error_reporting(0);
ob_start("ob_gzhandler");
$session = $_GET['session'];
require('../lib/routeros_api.class.php');
include('../lib/formatbytesbites.php');
include('../include/config.php');
// theme
include('../include/theme.php');
$iphost = explode('!', $data[$session][1])[1];
$userhost = explode('@|@', $data[$session][2])[1];
$passwdhost = explode('#|#', $data[$session][3])[1];
$hotspotname = explode('%', $data[$session][4])[1];
$dnsname = explode('^', $data[$session][5])[1];
$currency = explode('&', $data[$session][6])[1];
$cekindo['indo'] = array('RP', 'Rp', 'rp', 'IDR', 'idr', 'RP.', 'Rp.', 'rp.', 'IDR.', 'idr.', );
$API = new RouterosAPI();
$API->debug = false;
if ($currency == in_array($currency, $cekindo['indo'])) {
$title = array("Status Voucher", "User/Kode Voucher", "Paket", "Lama Terhubung", "Pemakaian Data", "Sisa Data", "Masa Aktif", "Dari", "Sampai", "tidak terdaftar.", "sudah kadaluarsa.", "Tanggal", "Cek Status", " Hari", " Jam", "Aktif", "Expired");
} else {
$title = array("Voucher Status", "User/Voucher Code", "Profile", "Uptime", "Data Usage", "Data Remaining", "Validity", "Start", "End", "not registered.", "expired.", "Date", "Check Status", " Day", " Hour", "Active", "Expired");
}
if ($currency == in_array($currency, $cekindo['indo'])) {
$s = "";
} else {
$s = "s";
}
?>
= $title[0] . " " . $hotspotname; ?>
Status Voucher
= $hotspotname; ?>
= $title[11] . " : " . date("d-m-Y") . "
"; ?>
connect($iphost, $userhost, decrypt($passwdhost))) {
$getuser = $API->comm("/ip/hotspot/user/print", array("?name" => "$name"));
$user = $getuser[0]['name'];
$profile = $getuser[0]['profile'];
$exp = $getuser[0]['comment'];
$uptime = formatDTM($getuser[0]['uptime']);
$getbytein = $getuser[0]['bytes-in'];
$getbyteo = $getuser[0]['bytes-out'];
$getbytetot = ($getbytein + $getbyteo);
$bytetot = formatBytes($getbytetot, 2);
$limitup = $getuser[0]['limit-uptime'];
$limitbyte = $getuser[0]['limit-bytes-total'];
if ($limitbyte == "") {
$dataleft = "Unlimited";
} elseif ($limitbyte < $getbytetot) {
$dataleft = "0 Byte";
} else {
$dataleft = formatBytes($limitbyte - $getbytetot, 2);
}
$getprofile = $API->comm("/ip/hotspot/user/profile/print", array("?name" => "$profile", ));
$ponlogin = $getprofile[0]['on-login'];
$getvalid = explode(",", $ponlogin)[3];
$unit = substr($getvalid, -1);
if ($unit == "d") {
$getvalid = substr($getvalid, 0, strlen($getvalid) - 1) . " " . $title[13];
} elseif ($unit == "h") {
$getvalid = substr($getvalid, 0, strlen($getvalid) - 1) . " " . $title[14];
}
}
if ($user == "" || (substr($exp,3,1) != "/" && substr($exp,6,1) != "/")) {
echo "
User $name $title[9]
";
} elseif ($limitup == "1s" || $uptime == $limitup || $getbyteo == $limitbyte) {
echo "
User $name $title[10]
";
}
if ($user == "" || (substr($exp,3,1) != "/" && substr($exp,6,1) != "/")) {
} else {
?>
";
echo "
";
echo " ";
echo " | $title[1] | ";
echo " $user | ";
echo "
";
echo " ";
echo " | $title[2] | ";
echo " $profile | ";
echo "
";
echo " ";
echo " | $title[3] | ";
echo " $uptime | ";
echo "
";
echo " ";
echo " | $title[4] | ";
echo " $bytetot | ";
echo "
";
if ($limitup == "1s" || $uptime == $limitup || $getbyteo == $limitbyte) {
echo " ";
echo " | Status | ";
echo " $title[16] | ";
echo "
";
echo "
";
echo "
";
} else {
echo "
";
echo " | $title[5] | ";
echo " $dataleft | ";
echo "
";
echo "
";
echo " | $title[6] | ";
echo " $getvalid | ";
echo "
";
echo "
";
echo " | $title[8] | ";
echo " $exp | ";
echo "
";
echo "
";
echo " | Status | ";
echo " $title[15] | ";
echo "
";
echo "";
echo "
";
}
}
$API->disconnect();
}
?>