";
// menu
//include "menuTop.php";
$strSesNama .= "$sesNama";
include "menuLeft.php";
//$strTopMenu.="88888";
//include "menuLeft.php";
if (($_SESSION['level'] == "3") || ($_SESSION['level'] == "2") || ($_SESSION['level'] == "1")) {
//$username=$_SESSION['username'];
$qq = "select * from radreply where username='$username'";
$xq = mysql_query($qq, $conn) or die(mysql_error());
$numq = mysql_num_rows($xq);
if ($numq == 1) {
//$mode="LIMITED";
$strSesNama .= " LIMITED CONNECTION";
if (($_SESSION['level'] != 3)) {
$strNote .= "PERINGATAN! dalam mode LIMITED ini kecepatan akses Anda terbatas ada kemungkinan halaman web yang tidak bisa dibuka. segera lakukan isi ulang di sini untuk kembali bisa menikmati akses koneksi PREMIUM";
}
}
else {
$strSesNama .= " PREMIUM CONNECTION";
}
include_once "../../Pages/Misc/arrUserSpecial.php";
switch ($_GET[Mode]) {
case "HisRefill":
$hisNama = $_GET[nama];
if (isset($hisNama)) {
if ($hisNama != $sesNama) {
$msg = "Illegal operation";
die (toAlert("$msg"));
// echo "$msg $sesNama";
}
}
$historyUser = $_POST['nama'];
if (!$historyUser) {
$historyUser = $logUser;
}
$strTitle .= "History Refill";
$strMainTitle = "
history refill
";
include "hisRefill.php";
break;
case "SlowOn":
//limit upload download voucher free
$up = 131072;
$dw = 131072;
//$strMain.=show_confirm()."";
//echo "";
$attribute0 = "Cleartext-Password";
$attribute1 = "lifetime-limit";
$attribute2 = "Mikrotik-Xmit-Limit";
$attribute3 = "Mikrotik-Recv-Limit";
$attribute6 = "Mikrotik-Total-Limit";
$attribute4 = "Max-Access-Period-Time";
$attribute5 = "Mikrotik-Rate-Limit";
$op = ":=";
$newMA = $masaAktif + $masaAktif2; //period-time
$newLT = $limitUptime + $limitUptime2; //limit-uptime
$newLU = $limitUpload + $uploadLimit2;
$newLD = $limitDownload + $downloadLimit2;
$newLBw = $limitTotal + $limitTotal2;
$limitKecepatan2 = "$up/$dw";
$newLK = $limitKecepatan2;
// $upload = $ll['acctinputoctets'];
// $download = $ll['acctoutputoctets'];
// cek masa aktif
$q = "SELECT * FROM radcheck where username='$username' and attribute='$attribute6' ";
$x = mysql_query($q, $conn) or die(mysql_error());
$l = mysql_fetch_array($x);
$limitQuotaBw = $l[value];
// cek kuota bandwith
$q = "SELECT * FROM radcheck where username='$username' and attribute='$attribute4' ";
$x = mysql_query($q, $conn) or die(mysql_error());
$l = mysql_fetch_array($x);
if ($j = mysql_num_rows($x) > 0) {
$attribute4_value = $l[value];
} else {
$attribute4_value = "unlimited";
$masaAktiveHr = "unlimited";
$attribute4_value = 2592000; // 30 hari
$q = "insert into radcheck (username,attribute,value) ";
$q .= "values ('$username','$attribute4','$attribute4_value')";
$x = mysql_query($q, $conn) or die(mysql_error());
}
$masaAktiveHr = $attribute4_value / 86400 . " hari";
// menghitung bandwit yang sudah dipakai
$q = "SELECT SUM(acctinputoctets) AS 'totalUpload', SUM(acctoutputoctets) AS 'totalDownload' FROM radacct ";
$q .= "where username='$username' AND acctstoptime IS NOT NULL";
$x = mysql_query($q, $conn) or die(mysql_error());
$l = mysql_fetch_array($x);
$totalUpload = $l['totalUpload'];
$totalDownload = $l['totalDownload'];
$masaAktive = $attribute4_value; // second
$kuota = $limitQuotaBw; // byte
$pemakaianBw = $totalUpload + $totalDownload; // byte
$sisaQbw = $limitQuotaBw - $pemakaianBw; // byte
// die();
// $q = "insert into radtemp (username,totalupload,totaldownload,totalbw,tanggal,quotabw,sisaquotabw) ";
// $q .= "values ('$username','$totalUpload','$totalDownload','$pemakaianBw',CURRENT_TIMESTAMP(),'$limitQuotaBw','$sisaQbw')";
// $x = mysql_query($q, $conn) or die(mysql_error());
// membuat kuota menjadi unlimid
$q = "update radcheck set username='$username-slow' ";
$q .= "where username='$username' AND attribute='$attribute6'";
$x = mysql_query($q, $conn) or die(mysql_error());
// membuat premium jadi limited
$query = "insert into radreply (username,attribute,op,value) values ('$username','$attribute5','$op','$newLK')";
$action = mysql_query($query, $conn) or die(mysql_error());
echo "";
//creatLog
$jenis = "slow";
$deskripsi = "Slow Mode On pada total pemakaian $pemakaianBw=$totalUpload(up) + $totalDownload(dl);";
creatLog($logUser, $level, $jenis, $deskripsi);
// notivikasi email
// $smtp = "gmail";
$smtp = "local";
$fromAddr = "";
$fromLabel = "free-radius";
$toAddr = "cahbagoesdewe@yahoo.com";
// $toAddr = "maya_teknis@yahoogroups.com";
$toLabel = "";
$subject = "slow mode";
$message = "$username mengaktifkan slow mode sisa masa aktive : $masaAktiveHr";
$attach = "";
sendSMTPMail($smtp, $fromAddr, $fromLabel, $toAddr, $toLabel, $subject, $message, $attach);
break;
case "Reload":
$u = $_GET['u'];
switch ($_GET['j']) {
case "1":
if (isset($_GET['u']) && in_array("$u", $arrUserSpecial) || in_array("$u", $arrUserSuperSpecial)) {
// echo "gondes";
$attribute0 = "Cleartext-Password";
$attribute1 = "lifetime-limit";
$attribute2 = "Mikrotik-Xmit-Limit";
$attribute3 = "Mikrotik-Recv-Limit";
$attribute6 = "Mikrotik-Total-Limit"; // kuota bandwith
$attribute4 = "Max-Access-Period-Time"; // masa aktive
$attribute5 = "Mikrotik-Rate-Limit"; // vouceher free
$op = ":=";
// $hari_ini = date()
$q = "SELECT DATEDIFF(now(),acctstarttime) AS 'umur' FROM radacct WHERE username='$username' ORDER BY radacctid ASC LIMIT 1";
$x = mysql_query($q, $conn) or die(mysql_error());
$l = mysql_fetch_array($x);
$hari = $l['umur'];
// value
$q = "SELECT * FROM radcheck where username='$username' and attribute='$attribute6' ";
$x = mysql_query($q, $conn) or die(mysql_error());
$l = mysql_fetch_array($x);
$limitQuotaBw = $l[value];
$q = "SELECT * FROM radcheck where username='$username' and attribute='$attribute4' ";
$x = mysql_query($q, $conn) or die(mysql_error());
$l = mysql_fetch_array($x);
$attribute4_value = $l[value];
// $attribute4_value = 2592000; // 30 hari
// 1073741824; // 1Gb
// 3221225472; // 3Gb
// $limitTotal2 = 2147483648; // 2Gb
$vrefillGb = $limitQuotaBw / 1073741824; // 2Gb
// membuat jejak refill
$q = "insert into radrefill (username,onlineLimit,totalBw,tglUsed,user)";
$q .= "values('self_inject','$attribute4_value','$limitQuotaBw',CURRENT_TIMESTAMP,'$u' )";
$x = mysql_query($q, $conn) or die(toAlert(mysql_error() . " on " . __FUNCTION__ . " line " . __LINE__ . " file " . __FILE__));
// MENGEMBALIKAN KE MODE PREMIUM
$q = "delete from radreply ";
$q .= "where username='$username'";
$x = mysql_query($q, $conn) or die(mysql_error());
$q = "update radcheck set username='$username' ";
$q .= "where username='$username-slow'";
$x = mysql_query($q, $conn) or die("");
// radpostauth
$q = "delete from radpostauth ";
$q .= "where username='$username'";
$x = mysql_query($q, $conn) or die(mysql_error());
// merername history
$q = "update radacct set username='$username-his' ";
$q .= "where username='$username'";
$x = mysql_query($q, $conn) or die("");
$q = "update radcheck set refill=refill+1 ";
$q .= "where username='$username'";
$x = mysql_query($q, $conn) or die(mysql_error());
// mencatat refill pada history
$comment = "refill $vrefillGb Gb ";
$q = "insert into radacct (username,acctstarttime,acctstoptime,type,comment)";
$q .= "values('$username',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'1','$comment' )";
$x = mysql_query($q, $conn) or die(toAlert(mysql_error() . " on " . __FUNCTION__ . " line " . __LINE__ . " file " . __FILE__));
$msg = "Refill Sukses";
echo "";
//creatLog
$jenis = "refill";
$deskripsi = "$username merefill dengan kode $kode, Q-Bandw $sisaQbw + $limitTotal2 = $newLBw, Maxperiode $masaAktif+$masaAktif2=$newMA";
creatLog($logUser, $level, $jenis, $deskripsi);
if (in_array("$u", $arrUserSpecial)) {
$karena = "masa aktif sudah habis (30 hari)";
} else {
$karena = "karena kuota $vrefillGb Gb habis selama $hari ";
}
// notivikasi email
// $smtp = "gmail";
$smtp = "local";
$fromAddr = "";
$fromLabel = "radius";
// $toAddr = "tandori_yk@yahoo.com";
// $toAddr = "cahbagoesdewe@yahoo.com";
$toAddr = "maya_teknis@yahoogroups.com";
$toLabel = "hot spot";
$subject = "reactivasi $username ";
$message = "$username melakukan reaktivasi sendiri $karena";
$attach = "";
sendSMTPMail($smtp, $fromAddr, $fromLabel, $toAddr, $toLabel, $subject, $message, $attach);
}
break;
}
break;
case "UserTraffic":
header("refresh:60");
$strTitle .= "Status Pemakaian";
$strMain .= "
berikut ini adalah status voucher anda
";
include "userTraffic.php";
$strTitle .= " $username";
// $strMain .= "";
if ($habis == 'EXPIRED') {
$strMain .= "
Voucher $username sudah EXPIRED
";
// region khusu untuk user special
if (in_array("$username", $arrUserSpecial)) {
$strMain .= "
Apakah masih ingin melanjutkan?
";
}
// endregion khusu untuk agus bigburger
}
elseif (($limitTotal > 0) and ($pemakaianBw >= $limitTotal)) {
if (in_array("$username", $arrUserSuperSpecial)) {
$slow = "$_SERVER[PHP_SELF]?Mode=Reload&u=$username&j=1";
} else {
$slow = "$_SERVER[PHP_SELF]?Mode=SlowOn";
}
$strMain .= "
";
$strMain .= "
Quota bandwith Anda sudah tercapai, lakukan refill sebelum expired.!
";
// $strMain .= "";
$strMain .= "
Anda masih bisa melanjutkan access dengan
kecepatan terbatas, dengan mengeklik tombol SLOW MODE";
$strMain .= " atau klik disini untuk melakukan refill";
$strMain .= "
";
include "history2.php";
$strNote .= "Untuk melakukan Shorting data, klik pada HEADER TABLE yang berwarna kuning";
//creatLog
$jenis = "view";
$deskripsi = "melihat history";
creatLog($logUser, $level, $jenis, $deskripsi);
break;
default:
$m = $_GET[Mode];
//echo "$m";
if ($m == "Refill") {
header("location:$_SERVER[PHP_SELF]?Mode=RefillV2");
}
$strTitle .= "Vito Spot";
//
$strMain .= "
";
$strMain .= "
";
/*
$id=$_GET[id]>0?$_GET[id]:7;
$q="select * from pages where id='$id' order by urut,id";
$x=mysql_query($q,$conn) or die(mysql_error());
while($l=mysql_fetch_assoc($x))
{
$id=$l[id];
$judul=$l[judul];
$isi=$l[isi];
$image=$l[image];
$strMainGambar="$image";
$strMainTitle.="