Add remaining project files (exclude ignored folders)

This commit is contained in:
WD - Dev
2025-07-05 15:11:40 +07:00
parent a96eb2b958
commit b440b80882
4697 changed files with 1365702 additions and 0 deletions
+219
View File
@@ -0,0 +1,219 @@
<nav class="navbar fixed-top" id="navbar">
<div class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 20px;">
<div class="row">
<div class="col-6">
<h4 class="mb-0" style="color: #fff;">Hai,</h4>
<h5 style="color: #fff;"><small><?php echo $pcmem['nama'];?></small></h5>
</div>
<div class="col-6 text-right">
<img src="profile/<?php echo $pcmem['profile']; ?>" class="rounded-circle" width="60px">
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
<?php if($jenisAgen == 'Prabayar') { ?>
<div style="text-align: center; color: #fff;">
<p>Saldo Anda</p>
<div style="display: inline-flex; align-items: center; justify-content: center;">
<h1 style="font-size: 36px; color: #fff; margin: 0;">
<small>Rp. </small>
<b id="saldoValue">••••••••••••</b>
</h1>
<a onclick="toggleSaldo()" style="background: none; border: none; margin-left: 10px; cursor: pointer;">
<i id="iconEye" class="fa fa-eye-slash text-light" style="font-size: 24px;"></i>
</a>
</div>
</div>
<?php } else { ?>
<center>
<p style="color: #fff;">Total Transaksi Belum Di Bayar</p>
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo substr(number_format($pcmem['saldo']),1); ?></b></h1>
</center>
<?php } ?>
</div>
</div>
<div class="card" id="1" style="border-radius: 0px; background: none; border: none; z-index: 4;">
<div class="card" style="border-radius: 20px; margin: 35px;">
<div class="card-body p-2">
<?php
$stmt = $pdo->prepare("SELECT * FROM v_jumlah_transaksi_agen_perhari WHERE id_agen_voucher = :id AND DATE(input_time) = :waktu");
$stmt->execute([
':id' => $_SESSION['agen'],
':waktu' => date('Y-m-d')
]);
$jumtran = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt = $pdo->prepare("SELECT SUM(jumlah_uang) AS jumlah_uang_bulan, SUM(jumlah_voucher) AS jumlah_voucher_bulan FROM v_jumlah_transaksi_agen_perhari WHERE id_agen_voucher = :id AND SUBSTR(DATE(input_time), 1, 7) = :waktu");
$stmt->execute([
':id' => $_SESSION['agen'],
':waktu' => date('Y-m')
]);
$jumtranbulan = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<center>
<p>Riwayat Transaksi</p><hr>
<div class="row">
<div class="col-6">
<p class="mb-1">Hari ini</p>
<p class="mb-1"><?php echo $jumtran['jumlah_voucher'];?> Voucher</p>
<h6><?php echo number_format($jumtran['jumlah_uang']); ?></h6>
</div>
<div class="col-6">
<p class="mb-1">Bulan ini</p>
<p class="mb-1"><?php echo $jumtranbulan['jumlah_voucher_bulan'];?> Voucher</p>
<h6><?php echo number_format($jumtranbulan['jumlah_uang_bulan']); ?></h6>
</div>
</div>
</center>
</div>
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; margin-top: -100px;border: none; z-index: 1;">
<div class="card-body" style="margin-top: 60px;">
<?php
$bulan = date('Y-m');
$stmt2 = $pdo->prepare("SELECT COALESCE(SUM(kredit), 0) - COALESCE(SUM(debet), 0) AS cek_data FROM v_detail_agen_pascabayar WHERE id_agen_voucher = :id_agen AND generate_time != :gettime");
$stmt2->bindParam(':id_agen', $_SESSION['agen'], PDO::PARAM_INT);
$stmt2->bindParam(':gettime', $bulan);
$stmt2->execute();
$rows2 = $stmt2->fetch(PDO::FETCH_ASSOC);
if ($jenisAgen === 'Pascabayar' && isset($rows2['cek_data']) && $rows2['cek_data'] > 0) { ?>
<a href="?<?php echo base64_encode('riwayat_transaksi_pascabayar'); ?>">
<div class="card mb-2 mr-3 ml-3" style="border-radius: 20px; background-color: rgba(255, 0, 0, 0.2);">
<div class="card-body text-center p-2">
<p class="mb-1 text-dark">Anda belum melunasi penjualan bulan sebelumnya sebesar</p>
<h4 class="text-dark">Rp. <b><?php echo number_format($rows2['cek_data']); ?></b></h4>
</div>
</div>
</a>
<?php } ?>
<div class="row">
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('voucher_buat'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/order.png" width="50px" class="mt-3 mb-2">
<p><small>Jual Voucher</small></p>
</center>
</div>
</a>
</div>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('paket_voucher'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/list.png" width="50px" class="mt-3 mb-2">
<p><small>Paket Voucher</small></p>
</center>
</div>
</a>
</div>
<?php if($jenisAgen == 'Prabayar') { ?>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('isi_saldo'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/wallet.png" width="50px" class="mt-3 mb-2">
<p><small>Isi Saldo</small></p>
</center>
</div>
</a>
</div>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('transfer_saldo'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/payment.png" width="50px" class="mt-3 mb-2">
<p><small>Transfer Saldo</small></p>
</center>
</div>
</a>
</div>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('riwayat_transaksi'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/report.png" width="50px" class="mt-3 mb-2">
<p><small>Riwayat Transaksi</small></p>
</center>
</div>
</a>
</div>
<?php } else { ?>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('riwayat_transaksi_pascabayar'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/report.png" width="50px" class="mt-3 mb-2">
<p><small>Riwayat Transaksi</small></p>
</center>
</div>
</a>
</div>
<?php } ?>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('voucher_belum_terjual'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/belum.png" width="50px" class="mt-3 mb-2">
<p><small>Voucher List</small></p>
</center>
</div>
</a>
</div>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('voucher_sudah_terjual'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/terjual.png" width="50px" class="mt-3 mb-2">
<p><small>Sudah Terjual</small></p>
</center>
</div>
</a>
</div>
<?php if($jenisAgen == 'Prabayar') { ?>
<div class="col-4 p-2">
<a href="?<?php echo base64_encode('voucher_diskon'); ?>">
<div class="card text-dark animated-link" style="border-radius: 15px;">
<center>
<img src="images/discounts.png" width="50px" class="mt-3 mb-2">
<p><small>Voucher Diskon</small></p>
</center>
</div>
</a>
</div>
<?php } ?>
</div>
</div>
</div>
<script>
let isVisible = false; // Default: tersembunyi
const originalSaldo = "<?php echo number_format($pcmem['saldo']); ?>";
function toggleSaldo() {
const saldoValue = document.getElementById('saldoValue');
const iconEye = document.getElementById('iconEye');
if (isVisible) {
// Sembunyikan
saldoValue.textContent = "••••••••••••";
iconEye.classList.remove("fa-eye");
iconEye.classList.add("fa-eye-slash");
} else {
// Tampilkan
saldoValue.textContent = originalSaldo;
iconEye.classList.remove("fa-eye-slash");
iconEye.classList.add("fa-eye");
}
isVisible = !isVisible;
}
</script>
+14
View File
@@ -0,0 +1,14 @@
<?php
class Pages {
// Properties
public $page;
// Methods
function set_page($page) {
$this->page = $page;
}
function get_page() {
return $this->page;
}
}
?>
+60
View File
@@ -0,0 +1,60 @@
<style type="text/css">
/* Kode CSS Untuk PAGE ini dibuat oleh http://jsfiddle.net/2wk6Q/1/ */
.page {
width: 210mm;
min-height: 297mm;
padding: 8mm;
margin: 20mm auto;
border: 1px #D3D3D3 solid;
border-radius: 5px;
background: white;
zoom : 50%;
}
.subpage {
padding: 1cm;
height: 257mm;
outline: 1cm #ededed solid;
}
@page {
size: A4;
margin: 0;
}
@media print {
html, body {
width: 210mm;
height: 297mm;
}
.page {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
}
</style>
<div id="pdf">
<div class="page">
<div class="row">
<?php
$ambil=$koneksi->query("SELECT * FROM genvoucher WHERE IdMember='$_SESSION[IdMember]' AND StaVoucher='1' ORDER BY IdGenVoucher DESC LIMIT 32 ");
while ($pecah =$ambil->fetch_assoc())
{
$data = $pecah['Voucher'];
?>
<img src="imgqrcode/imagevoucher/<?php echo $data; ?>.png" style="width: 5cm;">
<?php
}
?>
</div>
</div>
</div>
<div class="card-body">
<a class="btn btn-block btn-warning" href="intent://mekarmanah.my.id/hs-mekar/html2pdf/downloadvoucher.php?id=<?php echo $_SESSION['IdMember']; ?>#Intent;scheme=http;package=com.android.chrome;end
" target="_blank">Download File PDF</a>
</div>
+224
View File
@@ -0,0 +1,224 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Setting Akun</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
<!--<button onclick="tampilkanNama()">Tampilkan Nama</button>-->
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; border: none; z-index: 1;">
<div class="card-body m-4">
<center>
<img id="profileImage" src="profile/<?php echo $pcmem['profile']; ?>" class="rounded-circle" width="130px" onclick="document.getElementById('fileInput').click();">
<form action="" method="post" enctype="multipart/form-data" style="display:none;">
<input type="file" name="profile" id="fileInput" accept="image/*" onchange="this.form.submit();">
</form><br>
<i><small>Klik untuk ubah</small></i><br><hr>
</center>
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label><small>Email Pengguna</small></label>
<input type="email" name="email" class="form-control" style="border-top: none;border-left: none;border-right: none;" required="required" value="<?php echo $pcmem['email']; ?>" disabled>
</div>
<div class="form-group">
<label><small>Nama Pengguna</small></label>
<input type="text" name="nama" class="form-control" style="border-top: none;border-left: none;border-right: none;" required="required" value="<?php echo $pcmem['nama']; ?>" disabled>
</div>
<div class="form-group">
<label><small>Alamat Pengguna</small></label>
<input type="text" name="alamat" class="form-control" style="border-top: none;border-left: none;border-right: none;" required="required" value="<?php echo $pcmem['alamat']; ?>" disabled>
</div>
<div class="form-group">
<label><small>Nomor Telepon</small></label>
<input type="text" name="nohp" class="form-control" style="border-top: none;border-left: none;border-right: none;" required="required" value="<?php echo $pcmem['nomor_whatsapp']; ?>" disabled>
</div><br>
<center><p><u>Ubah Password</u></p></center>
<div class="form-group">
<label><small>Password Baru</small></label>
<div class="input-group mb-4">
<input type="password" class="form-control" name="new_password" style="border-top: none;border-left: none;border-right: none;">
<div class="input-group-append">
<div class="input-group-text" style="background: none; border-top: none;border-left: none;border-right: none;">
<span class="fas fa-eye toggle-password" style="cursor: pointer;"></span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label><small>Ulangi Password Baru</small></label>
<div class="input-group mb-4">
<input type="password" class="form-control" name="confirm_password" style="border-top: none;border-left: none;border-right: none;">
<div class="input-group-append">
<div class="input-group-text" style="background: none; border-top: none;border-left: none;border-right: none;">
<span class="fas fa-eye toggle-password" style="cursor: pointer;"></span>
</div>
</div>
</div>
</div>
<input type="submit" name="update" style="border-radius: 20px; margin-top: 50px; margin-bottom: 50px;" class="btn btn-warning btn-rouded btn-block" value="Simpan Perubahan" />
<!--<p id="deviceInfo">Loading device info...</p>-->
<!--<p id="token"></p>-->
<!--<p id="handphone"></p>-->
</form>
</div>
</div>
<?php
// Proses upload gambar
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(isset($_POST['update'])) {
if (!empty($_POST['new_password']) || !empty($_POST['confirm_password'])) {
if ($_POST['new_password'] === $_POST['confirm_password']) {
$password = $_POST['new_password'];
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
$isNewPassword = true; // Menandakan bahwa password baru digunakan
} else {
sweetAlert("Password tidak sama, silahkan periksa kembali", "error");
exit; // Menghentikan eksekusi lebih lanjut jika password tidak cocok
}
} else {
$hashedPassword = $pcmem['password']; // Menggunakan password lama jika tidak ada yang diinput
$isNewPassword = false; // Tidak ada password baru
}
if (substr($_POST['nohp'], 0, 2) == '62') {
$handphone = $_POST['nohp'];
} else {
$handphone = '62' . substr($_POST['nohp'], 1);
}
try {
// $stmt = $pdo->prepare("UPDATE agen_voucher SET email = :email, nama = :nama, alamat = :alamat, nomor_whatsapp = :nomor_whatsapp, password = :password WHERE id = :id");
// $stmt->bindParam(':email', $_POST['email']);
// $stmt->bindParam(':nama', $_POST['nama']);
// $stmt->bindParam(':alamat', $_POST['alamat']);
// $stmt->bindParam(':nomor_whatsapp', $handphone);
// $stmt->bindParam(':password', $hashedPassword);
// $stmt->bindParam(':id', $_SESSION['agen'], PDO::PARAM_INT);
$stmt = $pdo->prepare("UPDATE agen_voucher SET password = :password WHERE id = :id");
$stmt->bindParam(':password', $hashedPassword);
$stmt->bindParam(':id', $_SESSION['agen'], PDO::PARAM_INT);
if ($stmt->execute()) {
if ($isNewPassword) {
session_destroy(); // Hancurkan sesi jika password baru diubah
sweetAlert("Data Berhasil diubah, silahkan Login Kembali", "success");
} else {
sweetAlert("Data Berhasil diubah", "success");
}
} else {
sweetAlert("Gagal memperbarui data, silahkan coba lagi", "error");
}
} catch (PDOException $e) {
sweetAlert("Terjadi kesalahan: " . $e->getMessage(), "error");
}
} else {
$target_dir = "profile/";
$imageFileType = strtolower(pathinfo($_FILES["profile"]["name"], PATHINFO_EXTENSION));
// Membuat nama file baru
$new_file_name = "profile_" . date('YmdHis') . "." . $imageFileType;
$target_file = $target_dir . $new_file_name;
$uploadOk = 1;
// Cek apakah file gambar adalah gambar yang sebenarnya
$check = getimagesize($_FILES["profile"]["tmp_name"]);
if ($check === false) {
sweetAlert("File bukan gambar.","error");
$uploadOk = 0;
}
// Cek ukuran file
if ($_FILES["profile"]["size"] > 10000000) {
sweetAlert("Maaf, ukuran file terlalu besar.","error");
$uploadOk = 0;
}
// Cek format file
if (!in_array($imageFileType, ["jpg", "png", "jpeg", "gif"])) {
sweetAlert("Maaf, hanya file JPG, JPEG, PNG & GIF yang diperbolehkan.","error");
$uploadOk = 0;
}
// Jika semua baik-baik saja, maka upload file
if ($uploadOk == 1) {
if (move_uploaded_file($_FILES["profile"]["tmp_name"], $target_file)) {
// Simpan nama file baru ke database
$id = $_SESSION['agen'];
$sql = "UPDATE agen_voucher SET profile = '$new_file_name' WHERE id = $id";
if ($con->query($sql) === TRUE) {
sweetAlert("Profile telah di ubah","success");
} else {
sweetAlert("Error: " . $sql . "<br>" . $conn->error,"error");
}
} else {
sweetAlert("Maaf, terjadi kesalahan saat mengunggah file.","error");
}
}
}
}
?>
<script>
// Optional: Menampilkan preview gambar setelah pemilihan file
document.getElementById('fileInput').addEventListener('change', function(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('profileImage').src = e.target.result;
}
reader.readAsDataURL(file);
}
});
</script>
<script>
document.querySelectorAll('.toggle-password').forEach(function(toggle) {
toggle.addEventListener('click', function() {
// Mengambil elemen input yang bersangkutan
const input = this.closest('.input-group').querySelector('input');
// Mengubah tipe input
if (input.type === 'password') {
input.type = 'text';
this.classList.remove('fa-eye');
this.classList.add('fa-eye-slash');
} else {
input.type = 'password';
this.classList.remove('fa-eye-slash');
this.classList.add('fa-eye');
}
});
});
</script>
<script>
// Retrieving data from localStorage
var token = localStorage.getItem('token');
var handphone = localStorage.getItem('handphone');
// Displaying data in HTML elements
document.getElementById('token').innerText = "Token: " + token;
document.getElementById('handphone').innerText = "Handphone: " + handphone;
</script>
+242
View File
@@ -0,0 +1,242 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Isi Saldo</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 50px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 850px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h6>Isi Saldo Agen Voucher</h6><br>
</center>
<?php
// Cari Payment Gateway
$stmt = $pdo->prepare("SELECT payment_gateway,apikey_payment_gateway,url_payment_gateway,status_payment_gateway FROM data_server WHERE id = :id_data ");
$stmt->bindParam(':id_data', $pcmem['id_data_server'], PDO::PARAM_INT);
$stmt->execute();
$paygw = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (!empty($paygw[0]['apikey_payment_gateway']) && isset($paygw[0]['status_payment_gateway']) && $paygw[0]['status_payment_gateway'] === 'ACTIVE') {
$stmt = $pdo->prepare("SELECT * FROM agen_tambah_saldo WHERE id_agen_voucher = :id_agen_voucher AND status_payment = 'ACTIVE'");
$stmt->bindParam(':id_agen_voucher', $_SESSION['agen'], PDO::PARAM_INT);
$stmt->execute();
$ada = $stmt->fetch(PDO::FETCH_ASSOC);
if($ada) { ?>
<center>
<p class="text-danger">Silahkan klik "Bayar Saldo" untuk melanjutkan pembayaran, dan klik "Ubah Nominal" untuk merubah nominal isi saldo anda</p>
<h2><small>Rp.</small> <b><?php echo number_format($ada['nominal']); ?></b></h2>
<br>
<h5>Untuk Pembayaran Silahkan salin Link di bawah ini dan buka di Google Chrome</h5>
<br>
<a href="javascript:void(0);" onclick="copyText()"><?php echo $ada['url_payment']; ?></a>
<br><br>
<!--<a href="https://detik.com/">TESTTT</a>-->
<!--<a href="https://<?php echo $ada['url_payment']; ?>" class="btn btn-warning btn-block btn-md mb-4" target="_blank" style="border-radius: 30px;">Bayar Saldo</a>-->
<!--<a href="?<?php echo base64_encode('isi_saldo_bayar|https://'.$ada['url_payment']); ?>">Bayar</a>-->
<button type="button" class="btn btn-secondary btn-block btn-md" style="border-radius: 30px;" data-toggle="modal" data-target="#myModal">Ubah Nominal</button>
</center>
<?php } else { ?>
<form method="post">
<div class="form-group">
<label><small>Masukan Nominal</small></label>
<input type="text" class="form-control rupiah" id="rupiah0" name="nominal" required="required">
<i class="text-danger">Untuk isi saldo minimal Rp. 25,000</i>
</div><br>
<input type="submit" name="tambah_saldo" value="Tambah Saldo" class="btn btn-warning btn-md btn-block" style="border-radius: 30px;" >
</form>
<?php } ?>
<!-- Detail riwayat isi saldo dengan payment gateway -->
<div class="mt-4">
<hr>
<center>
<p>Riwayat isi saldo otomatis</p>
</center>
<table class="table">
<?php
$stmt = $pdo->prepare("SELECT * FROM agen_tambah_saldo WHERE id_agen_voucher = :id_agen_voucher AND status_payment != 'ACTIVE' ORDER BY waktu DESC, id DESC");
$stmt->bindParam(':id_agen_voucher', $_SESSION['agen'], PDO::PARAM_INT);
$stmt->execute();
while($saldo = $stmt->fetch(PDO::FETCH_ASSOC)) { ?>
<tbody>
<tr>
<td>
<?php echo $saldo['waktu']; ?>
<p><b>Rp. <?php echo number_format($saldo['nominal']); ?></b></p>
</td>
<td class="text-right">
<?php echo $saldo['status_payment']; ?>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
<!-- END Detail riwayat isi saldo dengan payment gateway -->
<?php } else { ?>
<center>
<h6>PERHATIAN !</h6><br><hr>
<p>Untuk pengisian saldo aplikasi ini silahkan hubungi admin yang bersangkutan</p>
<p>Terimakasih !!</p>
</center>
<?php } ?>
</div>
</div>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['tambah_saldo'])) {
try {
$nominal = preg_replace("/[^0-9]/", "", $_POST['nominal']);
if($nominal >= 25000) {
$waktu = date('Y-m-d H:i:s');
$keterangan = "Tambah saldo agen voucher";
$urlback = 'https://agen.bilspro.com/?'.base64_encode('isi_saldo');
$apiKey = $paygw[0]['apikey_payment_gateway'];
$apiUrl = $paygw[0]['url_payment_gateway'];
require '../payment/flip/Flip/Transaction.php';
$flip = new FlipPaymentGateway($apiKey,$apiUrl);
$response = $flip->createBill($keterangan, $nominal, $pcmem['email'], $pcmem['nama'], $pcmem['nomor_whatsapp'], $pcmem['alamat'], $urlback);
$id_payment = $response['link_id'];
$url_payment = $response['link_url'];
$status_payment = $response['status'];
// print_r($response);
$stmt = $pdo->prepare("INSERT INTO agen_tambah_saldo (id_data_server, id_agen_voucher, nominal, waktu, id_payment, url_payment, status_payment, keterangan) VALUES (:id_data_server, :id_agen_voucher, :nominal, :waktu, :id_payment, :url_payment, :status_payment, :keterangan)");
$stmt->bindParam(':id_data_server', $pcmem['id_data_server'], PDO::PARAM_INT);
$stmt->bindParam(':id_agen_voucher', $_SESSION['agen'], PDO::PARAM_INT);
$stmt->bindParam(':nominal', $nominal, PDO::PARAM_INT); // Pastikan nominal di-bind sebagai integer
$stmt->bindParam(':waktu', $waktu);
$stmt->bindParam(':id_payment', $id_payment);
$stmt->bindParam(':url_payment', $url_payment);
$stmt->bindParam(':status_payment', $status_payment);
$stmt->bindParam(':keterangan', $keterangan);
// Eksekusi statement
$stmt->execute();
sweetAlert("Permintaan Tambah Saldo Berhasil", "success");
} else {
sweetAlert("Nominal yang anda masukan kurang dari Rp. 25,000", "error");
}
} catch (PDOException $e) {
// Menangani kesalahan saat eksekusi
sweetAlert("Terjadi kesalahan: " . htmlspecialchars($e->getMessage()), "error");
}
}
if (isset($_POST['ubah_moninal'])) {
try {
$nominal = preg_replace("/[^0-9]/", "", $_POST['nominal']);
if($nominal >= 25000) {
$keterangan = "Tambah saldo agen voucher";
$transactionId = $ada['id_payment'];
$status = $ada['status_payment'];
$apiKey = $paygw[0]['apikey_payment_gateway'];
$apiUrl = $paygw[0]['url_payment_gateway'];
require '../payment/flip/Flip/Transaction.php';
$flip = new FlipPaymentGateway($apiKey,$apiUrl);
$response = $flip->editBill($transactionId,$status,$keterangan, $nominal);
$id_payment = $response['link_id'];
$url_payment = $response['link_url'];
$status_payment = $response['status'];
$stmt = $pdo->prepare("UPDATE agen_tambah_saldo SET nominal = :nominal, url_payment = :url_payment, status_payment = :status_payment WHERE id_payment = :id_payment");
$stmt->bindParam(':nominal', $nominal);
$stmt->bindParam(':url_payment', $url_payment);
$stmt->bindParam(':status_payment', $status_payment);
$stmt->bindParam(':id_payment', $ada['id_payment']);
// Eksekusi statement
$stmt->execute();
sweetAlert("Nominal Permintaan telah di ubah", "success");
} else {
sweetAlert("Nominal yang anda masukan kurang dari Rp. 25,000", "error");
}
} catch (PDOException $e) {
// Menangani kesalahan saat eksekusi
sweetAlert("Terjadi kesalahan: " . htmlspecialchars($e->getMessage()), "error");
}
}
}
?>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Ubah Nominal Isi Saldo</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form method="post">
<div class="modal-body">
<div class="form-group">
<label><small>Masukan Nominal</small></label>
<input type="text" class="form-control rupiah" id="rupiah0" value="<?php echo $ada['nominal']; ?>" name="nominal" required="required">
<i class="text-danger">Untuk isi saldo minimal Rp. 25,000</i>
</div><br>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary btn-sm" name="ubah_moninal">Ubah Nominal</button>
</div>
</form>
</div>
</div>
</div>
<script>
function copyText() {
// Membuat elemen textarea sementara untuk menyalin teks
const textToCopy = "<?php echo $ada['url_payment']; ?>"; // Teks yang ingin disalin
const tempTextArea = document.createElement('textarea');
// Menambahkan teks ke dalam textarea sementara
tempTextArea.value = textToCopy;
document.body.appendChild(tempTextArea);
// Memilih dan menyalin teks
tempTextArea.select();
tempTextArea.setSelectionRange(0, 99999); // Untuk perangkat mobile
// Menyalin teks ke clipboard
document.execCommand('copy');
// Menghapus textarea sementara setelah digunakan
document.body.removeChild(tempTextArea);
// Menampilkan pemberitahuan atau alert bahwa teks telah disalin
alert("Teks telah disalin: " + textToCopy);
}
</script>
+21
View File
@@ -0,0 +1,21 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Isi Saldo</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 50px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; border: none; z-index: 1;">
<div class="card-body">
<iframe src="<?php echo $page[1]; ?>" width="100%" height="800px" frameborder="0"></iframe>
</div>
</div>
+12
View File
@@ -0,0 +1,12 @@
<?php
// echo "<script>
// const data = {
// token: '',
// handphone: ''
// };
// AndroidInterface.saveData(JSON.stringify(data));
// </script>";
session_destroy();
echo "<script>location='".baseurl()."';</script>";
?>
+38
View File
@@ -0,0 +1,38 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">List Paket Voucher</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 750px; border: none; z-index: 1;">
<div class="card-body">
<?php
$sqlPaket = (empty($pcmem['list_paket'])) ? "" : "AND id IN (".$pcmem['list_paket'].")";
$ambil=$con->query("SELECT * FROM profile_paket WHERE id_data_server = '$pcmem[id_data_server]' AND jenis_profile = 'Hotspot' AND status = '1' $sqlPaket");
while ($tiap = $ambil->fetch_assoc()) {
$fee = $tiap["vi_agen"];
?>
<div class="card" style="margin-bottom: 10px; border: none; background-color: #e9e9e9e9; border-radius: 0px;">
<div class="card-body">
<h5><b><?php echo $tiap["nama"]; ?><b/></h5>
<h4 class="text-info">Harga jual : Rp. <?php echo number_format($tiap["harga_paket"]); ?></h4>
<?php if($jenisAgen === "Prabayar") { ?>
<h6>Fee Reseller : Rp. <?php echo number_format($fee); ?></h6>
<h6>Harga Beli Reseller : <?php echo number_format($tiap["harga_paket"]-$fee); ?></h6>
<?php } ?>
<hr>
</div>
</div>
<?php } ?>
</div>
</div>
+59
View File
@@ -0,0 +1,59 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Riwayat Transaksi</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 50px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 850px; border: none; z-index: 1;">
<div class="card-body m-4">
<table class="table mt-2" style="zoom: 95%;">
<tbody>
<?php
// Menetapkan batas dan offset untuk chunking
$limit = 10; // Jumlah data yang diambil setiap chunk
$offset = 0;
do {
// Mempersiapkan query menggunakan PDO dengan LIMIT dan OFFSET
$stmt = $pdo->prepare("SELECT * FROM transaksi_agen_voucher WHERE id_agen_voucher = :id_agen ORDER BY id DESC LIMIT :limit OFFSET :offset");
$stmt->bindParam(':id_agen', $_SESSION['agen'], PDO::PARAM_INT);
$stmt->bindParam(':limit', $limit, PDO::PARAM_INT);
$stmt->bindParam(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
// Mengambil hasil
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Menampilkan hasil
foreach ($rows as $pecah) {
?>
<tr>
<td class="p-2">
<?php echo htmlspecialchars($pecah['input_time']); ?>
<p class="m-0"><?php echo htmlspecialchars($pecah['keterangan']); ?></p>
</td>
<?php if (empty($pecah['debet'])) { ?>
<td class="p-2 text-right text-danger" style="min-width: 150px;">Rp. <?php echo number_format($pecah['kredit']); ?></td>
<?php } else { ?>
<td class="p-2 text-right text-success" style="min-width: 150px;">Rp. <?php echo number_format($pecah['debet']); ?></td>
<?php } ?>
</tr>
<?php
}
$offset += $limit; // Mengupdate offset untuk chunk berikutnya
} while (count($rows) === $limit); // Terus ambil data sampai tidak ada lagi yang tersisa
?>
</tbody>
</table>
</div>
</div>
+56
View File
@@ -0,0 +1,56 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Riwayat Transaksi</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 50px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 900px; border: none; z-index: 1;">
<div class="card-body m-4">
<center>
<h6 class="mb-4">Riwayat Penjualan Per Bulan</h6>
</center>
<table class="table mt-2" style="zoom: 95%">
<tbody>
<?php
// Mempersiapkan query menggunakan PDO dengan LIMIT dan OFFSET
$stmt = $pdo->prepare("SELECT * FROM v_detail_agen_pascabayar WHERE id_agen_voucher = :id_agen ORDER BY generate_time DESC");
$stmt->bindParam(':id_agen', $_SESSION['agen'], PDO::PARAM_INT);
$stmt->execute();
// Mengambil hasil
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Menampilkan hasil
foreach ($rows as $pecah) {
?>
<tr>
<td class="p-2">
<?php echo substr(formatIndo($pecah['generate_time']),3); ?>
<h4>Rp. <b><?php echo number_format($pecah['kredit']); ?></b></h4>
</td>
<td class="p-2 text-right">
<?php if($pecah['kredit'] > $pecah['debet']) { ?>
<h5 class="text-danger">Belum Lunas</h5>
<?php } else { ?>
<h5 class="text-success">Lunas</h5>
<?php } ?>
<a href="?<?php echo base64_encode('riwayat_transaksi_pascabayar_list|'.substr($pecah['generate_time'],0,7)); ?>" class="btn btn-info btn-sm m-1">Detail</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
@@ -0,0 +1,117 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-4 icon-container">
<a href="?<?php echo base64_encode('riwayat_transaksi_pascabayar'); ?>" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-8 text-right">
<h6 class="text-light mt-2 mb-2">Riwayat Transaksi <?php echo substr(formatIndo($page[1]),3); ?></h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 50px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 900px; border: none; z-index: 1;">
<div class="card-body m-4">
<?php
$stmt2 = $pdo->prepare("SELECT * FROM v_detail_agen_pascabayar WHERE id_agen_voucher = :id_agen AND generate_time = :gettime");
$stmt2->bindParam(':id_agen', $_SESSION['agen'], PDO::PARAM_INT);
$stmt2->bindParam(':gettime', $page[1]);
$stmt2->execute();
$rows2 = $stmt2->fetch(PDO::FETCH_ASSOC);
$stmt1 = $pdo->prepare("SELECT * FROM transaksi_agen_voucher WHERE id_agen_voucher = :id_agen AND DATE_FORMAT(generate_time, '%Y-%m') = :gettime AND debet IS NOT NULL");
$stmt1->bindParam(':id_agen', $_SESSION['agen'], PDO::PARAM_INT);
$stmt1->bindParam(':gettime', $page[1]);
$stmt1->execute();
$rows1 = $stmt1->fetchAll(PDO::FETCH_ASSOC);
?>
<table class="table mt-2">
<tbody>
<tr>
<td class="p-2" style="border: none;">Total Penjualan</td>
<td class="p-2 text-right text-success" style="min-width: 150px; border: none;"><h5>Rp. <b><?php echo number_format($rows2['kredit']) ?></b></h5></td>
</tr>
<tr>
<td class="p-2" style="border: none;">Jumlah Belum di Bayar</td>
<td class="p-2 text-right text-danger" style="min-width: 150px; border: none;"><h5>Rp. <b><?php echo number_format($rows2['kredit'] - $rows2['debet']) ?></b></h5></td>
</tr>
<tr>
<td class="p-2" style="border: none;">Status</td>
<td class="p-2 text-right text-success" style="min-width: 150px; border: none;">
<?php if($rows2['kredit'] != $rows2['debet']) {
echo '<a href="#" class="btn btn-danger btn-sm">Belum Lunas</a>';
} else {
echo '<a href="#" class="btn btn-success btn-sm">Lunas</a>';
}
?>
</td>
</tr>
</tbody>
</table><hr>
<?php if($rows1) { ?>
<div style="background: rgba(128, 128, 128, 0.1); padding: 20px; border-radius: 30px;">
<center>
<h6 class="mb-4">Riwayat Pembayaran</h6>
</center>
<table class="table mt-2">
<tbody>
<?php foreach ($rows1 as $pecah1) { ?>
<tr>
<td class="p-2">
<?php echo htmlspecialchars($pecah1['input_time']); ?>
<p class="m-0"><?php echo htmlspecialchars($pecah1['keterangan']); ?></p>
</td>
<td class="p-2 text-right" style="min-width: 150px;">Rp. <?php echo number_format($pecah1['debet']); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<center>
<h6 class="mb-4 mt-4">Riwayat Penjualan Voucher</h6>
</center>
<table class="table mt-2">
<tbody>
<?php
// Menetapkan batas dan offset untuk chunking
$limit = 10; // Jumlah data yang diambil setiap chunk
$offset = 0;
do {
// Mempersiapkan query menggunakan PDO dengan LIMIT dan OFFSET
$stmt = $pdo->prepare("SELECT * FROM transaksi_agen_voucher WHERE id_agen_voucher = :id_agen AND DATE_FORMAT(input_time, '%Y-%m') = :gettime AND kredit IS NOT NULL ORDER BY id DESC LIMIT :limit OFFSET :offset");
$stmt->bindParam(':id_agen', $_SESSION['agen'], PDO::PARAM_INT);
$stmt->bindParam(':gettime', $page[1]);
// Mengikat limit dan offset secara langsung (menggunakan bindValue)
$stmt->bindValue(':limit', (int)$limit, PDO::PARAM_INT);
$stmt->bindValue(':offset', (int)$offset, PDO::PARAM_INT);
$stmt->execute();
// Mengambil hasil
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Menampilkan hasil
foreach ($rows as $pecah) {
?>
<tr>
<td class="p-2">
<?php echo htmlspecialchars($pecah['input_time']); ?>
<p class="m-0"><?php echo htmlspecialchars($pecah['keterangan']); ?></p>
</td>
<td class="p-2 text-right text-success" style="min-width: 150px;">Rp. <?php echo number_format($pecah['kredit']); ?></td>
</tr>
<?php
}
$offset += $limit; // Mengupdate offset untuk chunk berikutnya
} while (count($rows) === $limit); // Terus ambil data sampai tidak ada lagi yang tersisa
?>
</tbody>
</table>
</div>
</div>
+17
View File
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+46
View File
@@ -0,0 +1,46 @@
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### JetBrains PhpStorm
.idea/
+18
View File
@@ -0,0 +1,18 @@
# routeros-api
Client API for RouterOS/Mikrotik
This class was originally written by Denis Basta and updated by several contributors. It aims to give a simple interface to the RouterOS API in PHP.
Mikrotik Wiki page at http://wiki.mikrotik.com/wiki/API_PHP_class
## Contributors (before moving to Git)
* Nick Barnes
* Ben Menking (ben [at] infotechsc [dot] com)
* Jeremy Jefferson (http://jeremyj.com)
* Cristian Deluxe (djcristiandeluxe [at] gmail [dot] com)
* Mikhail Moskalev (mmv.rus [at] gmail [dot] com)
## Changelog
Please see git logs. Version 1.0 through current version have been preserved in this Git repo.
+44
View File
@@ -0,0 +1,44 @@
{
"name": "BenMenking/routeros-api",
"description": "Client API for RouterOS/Mikrotik",
"keywords": [
"routeros",
"mikrotik"
],
"type": "library",
"support": {
"issues": "https://github.com/BenMenking/routeros-api/issues",
"wiki": "http://wiki.mikrotik.com/wiki/API_PHP_class",
"source": "https://github.com/BenMenking/routeros-api"
},
"authors": [
{
"name": "Denis Basta",
"email": "Denis.Basta@gmail.com"
},
{
"name": "Nick Barnes"
},
{
"name": "Ben Menking",
"email": "ben@infotechsc.com"
},
{
"name": "Jeremy Jefferson",
"url": "http://jeremyj.com"
},
{
"name": "Cristian Deluxe",
"url": "djcristiandeluxe@gmail.com"
},
{
"name": "Mikhail Moskalev",
"url": "mmv.rus@gmail.com"
}
],
"autoload": {
"classmap": [
"routeros_api.class.php"
]
}
}
+34
View File
@@ -0,0 +1,34 @@
<?php
include "../../config/api_mik.php";
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect2($m_ip, $m_user, $m_pass, $m_port)) {
$arrID=$API->comm("/ip/firewall/nat/getall",
array(
".proplist"=> ".id",
"?dst-port" => $m_remote ,
));
$API->comm("/ip/firewall/nat/set",
array(
".id" => $arrID[0][".id"],
"to-addresses" => "192.168.100.100",
)
);
$API->disconnect();
}
echo "<pre>";
print_r($arrID);
echo "</pre>";
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = false;
if ($API->connect('192.168.12.1', 'syifa1501', 'insh4re04')) {
$data = $API->comm('/ip/hotspot/user/print',
array(
"?uptime" => "0s"
));
echo "<pre>";
print_r($data);
echo "</pre>";
$API->disconnect();
}
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('111.111.111.111', 'LOGIN', 'PASSWORD')) {
$API->write('/interface/wireless/registration-table/print',false);
$API->write('=stats=');
$READ = $API->read(false);
$ARRAY = $API->parseResponse($READ);
print_r($ARRAY);
$API->disconnect();
}
?>
+25
View File
@@ -0,0 +1,25 @@
<?php
/* Example for adding a VPN user */
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('192.168.100.23', 'admin', 'putr4bungsu08')) {
$API->comm('/ppp/secret/add', array(
"name" => "user2",
"password" => "pass2",
"remote-address" => "192.168.5.121",
"comment" => "BARU3",
"service" => "pptp",
));
$API->disconnect();
}
?>
+24
View File
@@ -0,0 +1,24 @@
<?php
/* Example of finding registration-table ID for specified MAC */
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('111.111.111.111', 'LOGIN', 'PASSWORD')) {
$ARRAY = $API->comm("/interface/wireless/registration-table/print", array(
".proplist"=> ".id",
"?mac-address" => "00:0E:BB:DD:FF:FF",
));
print_r($ARRAY);
$API->disconnect();
}
?>
+24
View File
@@ -0,0 +1,24 @@
<?php
/* Example of counting leases from a specific IP Pool (using regexp) */
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect('111.111.111.111', 'LOGIN', 'PASSWORD')) {
$ARRAY = $API->comm("/ip/dhcp-server/lease/print", array(
"count-only"=> "",
"~active-address" => "1.1.",
));
print_r($ARRAY);
$API->disconnect();
}
?>
+35
View File
@@ -0,0 +1,35 @@
<?php
/* 3 step action
1) fetch all static dns hosts
2) remove all static dns hosts
3) add example host
*/
require('../routeros_api.class.php');
$API = new RouterosAPI();
if ($API->connect('192.168.100.23', 'admin', 'putr4bungsu08')) {
# Get all current hosts
$API->write('/ip/dns/static/print');
$ips = $API->read();
# delete them all !
foreach($ips as $num => $ip_data) {
$API->write('/ip/dns/static/remove', false);
$API->write("=.id=" . $ip_data[".id"], true);
}
#add some new
$API->comm("/ip/dns/static/add", array(
"name" => "jefkeklak",
"address" => "1.2.3.4",
"ttl" => "1m"
));
#show me what you got
$API->write('/ip/dns/static/print');
$ips = $API->read();
var_dump($ips);
$API->disconnect();
}
+26
View File
@@ -0,0 +1,26 @@
<?php
include "../../config/api_mik.php";
require('../routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = true;
if ($API->connect2($m_ip, $m_user, $m_pass, $m_port)) {
$cek = $API->comm("/ip/firewall/nat/set",
array(
"?dst-port" => $m_remote ,
"to-addresses" => "192.168.100.100",
)
);
$API->disconnect();
}
echo "<pre>";
print_r($cek);
echo "</pre>";
?>
+497
View File
@@ -0,0 +1,497 @@
<?php
/*****************************
*
* RouterOS PHP API class v1.6
* Author: Denis Basta
* Contributors:
* Nick Barnes
* Ben Menking (ben [at] infotechsc [dot] com)
* Jeremy Jefferson (http://jeremyj.com)
* Cristian Deluxe (djcristiandeluxe [at] gmail [dot] com)
* Mikhail Moskalev (mmv.rus [at] gmail [dot] com)
*
* http://www.mikrotik.com
* http://wiki.mikrotik.com/wiki/API_PHP_class
*
******************************/
class RouterosAPI
{
var $debug = false; // Show debug information
var $connected = false; // Connection state
var $port = 8728; // Port to connect to (default 8729 for ssl)
var $ssl = false; // Connect using SSL (must enable api-ssl in IP/Services)
var $timeout = 1; // Connection attempt timeout and data read timeout
var $attempts = 1; // Connection attempt count
var $delay = 1; // Delay between connection attempts in seconds
var $socket; // Variable for storing socket resource
var $error_no; // Variable for storing connection error number, if any
var $error_str; // Variable for storing connection error text, if any
/* Check, can be var used in foreach */
public function isIterable($var)
{
return $var !== null
&& (is_array($var)
|| $var instanceof Traversable
|| $var instanceof Iterator
|| $var instanceof IteratorAggregate
);
}
/**
* Print text for debug purposes
*
* @param string $text Text to print
*
* @return void
*/
public function debug($text)
{
if ($this->debug) {
echo $text . "\n";
}
}
/**
*
*
* @param string $length
*
* @return void
*/
public function encodeLength($length)
{
if ($length < 0x80) {
$length = chr($length);
} elseif ($length < 0x4000) {
$length |= 0x8000;
$length = chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
} elseif ($length < 0x200000) {
$length |= 0xC00000;
$length = chr(($length >> 16) & 0xFF) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
} elseif ($length < 0x10000000) {
$length |= 0xE0000000;
$length = chr(($length >> 24) & 0xFF) . chr(($length >> 16) & 0xFF) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
} elseif ($length >= 0x10000000) {
$length = chr(0xF0) . chr(($length >> 24) & 0xFF) . chr(($length >> 16) & 0xFF) . chr(($length >> 8) & 0xFF) . chr($length & 0xFF);
}
return $length;
}
/**
* Login to RouterOS
*
* @param string $ip Hostname (IP or domain) of the RouterOS server
* @param string $login The RouterOS username
* @param string $password The RouterOS password
*
* @return boolean If we are connected or not
*/
public function connect($ip, $login, $password)
{
for ($ATTEMPT = 1; $ATTEMPT <= $this->attempts; $ATTEMPT++) {
$this->connected = false;
$PROTOCOL = ($this->ssl ? 'ssl://' : '' );
$context = stream_context_create(array('ssl' => array('ciphers' => 'ADH:ALL', 'verify_peer' => false, 'verify_peer_name' => false)));
$this->debug('Connection attempt #' . $ATTEMPT . ' to ' . $PROTOCOL . $ip . ':' . $this->port . '...');
$this->socket = @stream_socket_client($PROTOCOL . $ip.':'. $this->port, $this->error_no, $this->error_str, $this->timeout, STREAM_CLIENT_CONNECT,$context);
if ($this->socket) {
socket_set_timeout($this->socket, $this->timeout);
$this->write('/login', false);
$this->write('=name=' . $login, false);
$this->write('=password=' . $password);
$RESPONSE = $this->read(false);
if (isset($RESPONSE[0])) {
if ($RESPONSE[0] == '!done') {
if (!isset($RESPONSE[1])) {
// Login method post-v6.43
$this->connected = true;
break;
} else {
// Login method pre-v6.43
$MATCHES = array();
if (preg_match_all('/[^=]+/i', $RESPONSE[1], $MATCHES)) {
if ($MATCHES[0][0] == 'ret' && strlen($MATCHES[0][1]) == 32) {
$this->write('/login', false);
$this->write('=name=' . $login, false);
$this->write('=response=00' . md5(chr(0) . $password . pack('H*', $MATCHES[0][1])));
$RESPONSE = $this->read(false);
if (isset($RESPONSE[0]) && $RESPONSE[0] == '!done') {
$this->connected = true;
break;
}
}
}
}
}
}
fclose($this->socket);
}
sleep($this->delay);
}
if ($this->connected) {
$this->debug('Connected...');
} else {
$this->debug('Error...');
}
return $this->connected;
}
/**
* Disconnect from RouterOS
*
* @return void
*/
public function disconnect()
{
// let's make sure this socket is still valid. it may have been closed by something else
if( is_resource($this->socket) ) {
fclose($this->socket);
}
$this->connected = false;
$this->debug('Disconnected...');
}
/**
* Login to RouterOS
*
* @param string $ip Hostname (IP or domain) of the RouterOS server
* @param string $login The RouterOS username
* @param string $password The RouterOS password
* @param string $portx The RouterOS port
*
* @return boolean If we are connected or not
*/
public function connect2($ip, $login, $password, $portx = '8728')
{
for ($ATTEMPT = 1; $ATTEMPT <= $this->attempts; $ATTEMPT++) {
$this->connected = false;
$PROTOCOL = ($this->ssl ? 'ssl://' : '' );
$context = stream_context_create(array('ssl' => array('ciphers' => 'ADH:ALL', 'verify_peer' => false, 'verify_peer_name' => false)));
$this->debug('Connection attempt #' . $ATTEMPT . ' to ' . $PROTOCOL . $ip . ':' . $portx . '...');
$this->socket = @stream_socket_client($PROTOCOL . $ip.':'. $portx, $this->error_no, $this->error_str, $this->timeout, STREAM_CLIENT_CONNECT,$context);
if ($this->socket) {
socket_set_timeout($this->socket, $this->timeout);
$this->write('/login', false);
$this->write('=name=' . $login, false);
$this->write('=password=' . $password);
$RESPONSE = $this->read(false);
if (isset($RESPONSE[0])) {
if ($RESPONSE[0] == '!done') {
if (!isset($RESPONSE[1])) {
// Login method post-v6.43
$this->connected = true;
break;
} else {
// Login method pre-v6.43
$MATCHES = array();
if (preg_match_all('/[^=]+/i', $RESPONSE[1], $MATCHES)) {
if ($MATCHES[0][0] == 'ret' && strlen($MATCHES[0][1]) == 32) {
$this->write('/login', false);
$this->write('=name=' . $login, false);
$this->write('=response=00' . md5(chr(0) . $password . pack('H*', $MATCHES[0][1])));
$RESPONSE = $this->read(false);
if (isset($RESPONSE[0]) && $RESPONSE[0] == '!done') {
$this->connected = true;
break;
}
}
}
}
}
}
fclose($this->socket);
}
sleep($this->delay);
}
if ($this->connected) {
$this->debug('Connected...');
} else {
$this->debug('Error...');
}
return $this->connected;
}
/**
* Parse response from Router OS
*
* @param array $response Response data
*
* @return array Array with parsed data
*/
public function parseResponse($response)
{
if (is_array($response)) {
$PARSED = array();
$CURRENT = null;
$singlevalue = null;
foreach ($response as $x) {
if (in_array($x, array('!fatal','!re','!trap'))) {
if ($x == '!re') {
$CURRENT =& $PARSED[];
} else {
$CURRENT =& $PARSED[$x][];
}
} elseif ($x != '!done') {
$MATCHES = array();
if (preg_match_all('/[^=]+/i', $x, $MATCHES)) {
if ($MATCHES[0][0] == 'ret') {
$singlevalue = $MATCHES[0][1];
}
$CURRENT[$MATCHES[0][0]] = (isset($MATCHES[0][1]) ? $MATCHES[0][1] : '');
}
}
}
if (empty($PARSED) && !is_null($singlevalue)) {
$PARSED = $singlevalue;
}
return $PARSED;
} else {
return array();
}
}
/**
* Parse response from Router OS
*
* @param array $response Response data
*
* @return array Array with parsed data
*/
public function parseResponse4Smarty($response)
{
if (is_array($response)) {
$PARSED = array();
$CURRENT = null;
$singlevalue = null;
foreach ($response as $x) {
if (in_array($x, array('!fatal','!re','!trap'))) {
if ($x == '!re') {
$CURRENT =& $PARSED[];
} else {
$CURRENT =& $PARSED[$x][];
}
} elseif ($x != '!done') {
$MATCHES = array();
if (preg_match_all('/[^=]+/i', $x, $MATCHES)) {
if ($MATCHES[0][0] == 'ret') {
$singlevalue = $MATCHES[0][1];
}
$CURRENT[$MATCHES[0][0]] = (isset($MATCHES[0][1]) ? $MATCHES[0][1] : '');
}
}
}
foreach ($PARSED as $key => $value) {
$PARSED[$key] = $this->arrayChangeKeyName($value);
}
return $PARSED;
if (empty($PARSED) && !is_null($singlevalue)) {
$PARSED = $singlevalue;
}
} else {
return array();
}
}
/**
* Change "-" and "/" from array key to "_"
*
* @param array $array Input array
*
* @return array Array with changed key names
*/
public function arrayChangeKeyName(&$array)
{
if (is_array($array)) {
foreach ($array as $k => $v) {
$tmp = str_replace("-", "_", $k);
$tmp = str_replace("/", "_", $tmp);
if ($tmp) {
$array_new[$tmp] = $v;
} else {
$array_new[$k] = $v;
}
}
return $array_new;
} else {
return $array;
}
}
/**
* Read data from Router OS
*
* @param boolean $parse Parse the data? default: true
*
* @return array Array with parsed or unparsed data
*/
public function read($parse = true)
{
$RESPONSE = array();
$receiveddone = false;
while (true) {
// Read the first byte of input which gives us some or all of the length
// of the remaining reply.
$BYTE = ord(fread($this->socket, 1));
$LENGTH = 0;
// If the first bit is set then we need to remove the first four bits, shift left 8
// and then read another byte in.
// We repeat this for the second and third bits.
// If the fourth bit is set, we need to remove anything left in the first byte
// and then read in yet another byte.
if ($BYTE & 128) {
if (($BYTE & 192) == 128) {
$LENGTH = (($BYTE & 63) << 8) + ord(fread($this->socket, 1));
} else {
if (($BYTE & 224) == 192) {
$LENGTH = (($BYTE & 31) << 8) + ord(fread($this->socket, 1));
$LENGTH = ($LENGTH << 8) + ord(fread($this->socket, 1));
} else {
if (($BYTE & 240) == 224) {
$LENGTH = (($BYTE & 15) << 8) + ord(fread($this->socket, 1));
$LENGTH = ($LENGTH << 8) + ord(fread($this->socket, 1));
$LENGTH = ($LENGTH << 8) + ord(fread($this->socket, 1));
} else {
$LENGTH = ord(fread($this->socket, 1));
$LENGTH = ($LENGTH << 8) + ord(fread($this->socket, 1));
$LENGTH = ($LENGTH << 8) + ord(fread($this->socket, 1));
$LENGTH = ($LENGTH << 8) + ord(fread($this->socket, 1));
}
}
}
} else {
$LENGTH = $BYTE;
}
$_ = "";
// If we have got more characters to read, read them in.
if ($LENGTH > 0) {
$_ = "";
$retlen = 0;
while ($retlen < $LENGTH) {
$toread = $LENGTH - $retlen;
$_ .= fread($this->socket, $toread);
$retlen = strlen($_);
}
$RESPONSE[] = $_;
$this->debug('>>> [' . $retlen . '/' . $LENGTH . '] bytes read.');
}
// If we get a !done, make a note of it.
if ($_ == "!done") {
$receiveddone = true;
}
$STATUS = socket_get_status($this->socket);
if ($LENGTH > 0) {
$this->debug('>>> [' . $LENGTH . ', ' . $STATUS['unread_bytes'] . ']' . $_);
}
if ((!$this->connected && !$STATUS['unread_bytes']) || ($this->connected && !$STATUS['unread_bytes'] && $receiveddone)) {
break;
}
}
if ($parse) {
$RESPONSE = $this->parseResponse($RESPONSE);
}
return $RESPONSE;
}
/**
* Write (send) data to Router OS
*
* @param string $command A string with the command to send
* @param mixed $param2 If we set an integer, the command will send this data as a "tag"
* If we set it to boolean true, the funcion will send the comand and finish
* If we set it to boolean false, the funcion will send the comand and wait for next command
* Default: true
*
* @return boolean Return false if no command especified
*/
public function write($command, $param2 = true)
{
if ($command) {
$data = explode("\n", $command);
foreach ($data as $com) {
$com = trim($com);
fwrite($this->socket, $this->encodeLength(strlen($com)) . $com);
$this->debug('<<< [' . strlen($com) . '] ' . $com);
}
if (gettype($param2) == 'integer') {
fwrite($this->socket, $this->encodeLength(strlen('.tag=' . $param2)) . '.tag=' . $param2 . chr(0));
$this->debug('<<< [' . strlen('.tag=' . $param2) . '] .tag=' . $param2);
} elseif (gettype($param2) == 'boolean') {
fwrite($this->socket, ($param2 ? chr(0) : ''));
}
return true;
} else {
return false;
}
}
/**
* Write (send) data to Router OS
*
* @param string $com A string with the command to send
* @param array $arr An array with arguments or queries
*
* @return array Array with parsed
*/
public function comm($com, $arr = array())
{
$count = count($arr);
$this->write($com, !$arr);
$i = 0;
if ($this->isIterable($arr)) {
foreach ($arr as $k => $v) {
switch ($k[0]) {
case "?":
$el = "$k=$v";
break;
case "~":
$el = "$k~$v";
break;
default:
$el = "=$k=$v";
break;
}
$last = ($i++ == $count - 1);
$this->write($el, $last);
}
}
return $this->read();
}
/**
* Standard destructor
*
* @return void
*/
public function __destruct()
{
$this->disconnect();
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
require('routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = false;
if ($API->connect('192.168.200.6', 'syifa1501', '150111')) {
$data = $API->comm('/ip/service/print',
array(
));
echo "<pre>";
print_r($data);
echo "</pre>";
$API->disconnect();
}
?>
+91
View File
@@ -0,0 +1,91 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Transfer Saldo Antar Agen</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
<center>
<p style="color: #fff;">Saldo Anda</p>
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo number_format($pcmem['saldo']); ?></b></h1>
</center>
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 750px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h2>Mohon maaf untuk sementara Transfer Saldo tidak bisa di gunakan</h2>
</center>
<!--<div class="alert alert-danger" style="border-radius: 30px;">-->
<!-- <h6 class="text-danger text-center"><b><u>PERHATIAN</u></b></h6>-->
<!-- <p class="text-danger"><i>Lakukan pengisian data dengan teliti untuk menghindari kesalahan transfer</i></p>-->
<!--</div>-->
<!--<form method="post">-->
<!-- <div class="form-group">-->
<!-- <label>Masukan Nomor Handphone Reseller Lain</label>-->
<!-- <input class="form-control" placeholder="08..." type="number" id="nohp" name="nohp" required="required">-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label>Masukan Nominal</label>-->
<!-- <input class="form-control" placeholder="Rp. 0" type="number" id="nominal" name="nominal" required="required">-->
<!-- </div><br>-->
<!-- <input type="submit" name="tranfer" style="border-radius: 20px;" class="btn btn-warning btn-lg btn-sm btn-block text" value="Transfer Saldo" />-->
<!--</form>-->
</div>
</div>
<?php
if (isset($_POST['tranfer']))
{
$cekseller = $con->query("SELECT * FROM member WHERE NoHp = '$_POST[nohp]' AND id_admin = '$pcmem[id_admin]'");
$reseller = $cekseller->fetch_assoc();
if ($reseller['NoHp'] == $pcmem['NoHp'])
{
sweetAlert("Transfer Gagal, anda tidak bisa tranfer ke nomor sendiri", "error");
//echo "<script>location='index.php?hal=TransferSaldo';</script>";
}
elseif ($saldo < $_POST['nominal'])
{
sweetAlert("Transfer Gagal, Saldo anda tidak cukup", "error");
//echo "<script>location='index.php?hal=TransferSaldo';</script>";
}
elseif ($reseller != '')
{
//yang mengirim saldo
$ket = "Transfer saldo ke ".$reseller['NamaMember']." ".$reseller['NoHp'];
$kredit = $con->query("INSERT INTO tranvoucher (id_admin,IdMember,KreditMember,KetTran) values ('$pcmem[id_admin]','$_SESSION[IdMember]','$_POST[nominal]','$ket')");
//yang menerima saldo
$idpenerima = $reseller['IdMember'];
$ket2 = "Transfer saldo dari ".$pcmem['NamaMember']." ".$pcmem['NoHp'];
$kredit = $con->query("INSERT INTO tranvoucher (id_admin,IdMember,DebetMember,KetTran) values ('$pcmem[id_admin]','$idpenerima','$_POST[nominal]','$ket2')");
//masuk ke db transfer saldo
$kredit = $con->query("INSERT INTO transfersaldo (id_admin,IdPengirim,IdPenerima,Nominal) values ('$pcmem[id_admin]','$_SESSION[IdMember]','$idpenerima','$_POST[nominal]')");
$last_id = mysqli_insert_id($con);
if ($kredit)
{
echo "<script>location='index.php?hal=StaTransSal&idts=$last_id'</script>";
}
}
else
{
sweetAlert("Transfer Gagal, Nomor tidak terdaftar sebagai Agent", "error");
//echo "<script>location='index.php?hal=TransferSaldo';</script>";
}
}
?>
<script type="text/javascript">
document.getElementById('nohp').value = "<?php echo $_POST['nohp'];?>";
document.getElementById('nominal').value = "<?php echo $_POST['nominal'];?>";
</script>
+187
View File
@@ -0,0 +1,187 @@
<?php
$ambil = $con->query("SELECT * FROM profile_paket WHERE id = '$page[1]'");
$data1 = $ambil->fetch_assoc();
$harga = $data1['harga_paket'] ;
$kodeprofile = $data1['nama_profile'];
$vim = $data1['vi_agen'] ;
$jumlah = $harga - $vim ;
$saldo = $pcmem['saldo'];
// echo "<pre>";
// print_r($pcmem);
// echo "</pre>";
?>
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="?<?php echo base64_encode('voucher_buat'); ?>" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Pembayaran</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
<center>
<p style="color: #fff;">Saldo Anda</p>
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo number_format($pcmem['saldo']); ?></b></h1>
</center>
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 750px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h6><b>Pembayaran Voucher Hotspot</b></h6><br>
</center>
<hr>
<div class="row">
<div class="col-6">
<h6>Pembelian</h6>
<h6>Paket</h6>
</div>
<div class="col-6 text-right">
<h6>Voucher</h6>
<h6><?php echo $data1['nama']; ?></h6>
</div>
</div>
<hr>
<div class="row">
<div class="col-6">
<h6>Harga</h6>
<h6>Fee Agen</h6>
</div>
<div class="col-6 text-right">
<h6>Rp. <?php echo number_format($data1['harga_paket']) ; ?></h6>
<h6>Rp. <?php echo number_format($vim ) ; ?></h6>
</div>
</div>
<hr>
<div class="row">
<div class="col-6">
<h6><b>TOTAL</b></h6>
</div>
<div class="col-6 text-right">
<h2><b>Rp. <?php echo number_format($jumlah ) ; ?></b></h2>
</div>
</div>
<?php if ($saldo < $jumlah): ?>
<div class="alert alert-danger fixed">
<b>Saldo Anda..!! </b>tidak mencukupi untuk melanjutkan transaksi
</div>
<div class="card-body">
<h3 class="text-danger">Saldo anda Rp. <?php echo number_format($saldo); ?></h3><br>
</div>
<?php else: ?>
<div class="card-body mt-4">
<form method="post">
<div class="card-body" id="btn001">
<input type="submit" style="border-radius: 20px;" name="pay" class="btn btn-warning btn-md btn-rounded btn-block" value="Generate Voucher" onclick="toggleButtons()"/>
</div>
<div class="card-body" id="btn002" style="display: none;">
<input type="submit" style="border-radius: 20px;" class="btn btn-warning btn-md btn-rounded btn-block" value="Sedang diproses..." disabled/>
</div>
</form>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php
if (isset($_POST['pay']) && $_SESSION['pay'] == 'true') {
$karakter = "QWERTYUIOPASDFGHJKLZXCV12345098760987612345BNMQWERTYUIOPASGHJKLZXCVBNM";
$str = $data1['durasi'];
$kodevoucher = $pcmem['kode_agen'] . $str . substr(str_shuffle($karakter), 0, 7);
if($pcmem['status'] == 'Aktif') {
// Fetch settings
$stmt = $pdo->prepare("SELECT * FROM setting_mikrotik WHERE id = :id");
$stmt->execute([':id' => $pcmem['id_setting_mikrotik']]);
$pset = $stmt->fetch(PDO::FETCH_ASSOC);
$m_ip = $pset['ip_address'];
$m_user = $pset['username'];
$m_pass = $pset['password'];
$m_port = $pset['port_api'];
require('router_api/routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = false;
if ($API->connect2($m_ip, $m_user, $m_pass, $m_port)) {
if ($saldo >= $jumlah) {
$ARRAY = $API->comm("/ip/hotspot/user/profile/print", array(
".proplist" => ".id",
"?name" => $kodeprofile,
));
if (empty($ARRAY) || $ARRAY[0]['.id'] == '') {
sweetAlert("Transaksi Gagal: Profile paket tidak terdaftar di server, silahkan hubungi admin", "error");
} else {
$date = date('Y-m-d H:i:s');
// Insert generated voucher
$stmt = $pdo->prepare("INSERT INTO ganerate_voucher
(id_data_server, id_agen_voucher, id_setting_mikrotik, id_profile_paket, voucher, harga, create_time)
VALUES (:id_data_server, :id_agen_voucher, :id_setting_mikrotik, :id_profile_paket, :voucher, :harga, :create_time)");
$stmt->execute([
':id_data_server' => $pcmem['id_data_server'],
':id_agen_voucher' => $_SESSION['agen'],
':id_setting_mikrotik' => $pcmem['id_setting_mikrotik'],
':id_profile_paket' => $page[1],
':voucher' => $kodevoucher,
':harga' => $harga,
':create_time' => $date
]);
$last_id = $pdo->lastInsertId();
// Add user in MikroTik
$API->comm('/ip/hotspot/user/add', array(
"name" => $kodevoucher,
"password" => $kodevoucher,
"profile" => $kodeprofile,
"server" => "all"
));
$API->disconnect();
$generate_time = date('Y-m-d');
$ket = 'pembelian voucher ' . $data1['nama'] . ' -> ' . $kodevoucher;
$stmt = $pdo->prepare("INSERT INTO transaksi_agen_voucher
(id_data_server, id_agen_voucher, id_ganerate_voucher, kredit, keterangan, input_time, generate_time)
VALUES (:id_data_server, :id_agen_voucher, :id_ganerate_voucher, :kredit, :keterangan, :input_time, :generate_time)");
$stmt->execute([
':id_data_server' => $pcmem['id_data_server'],
':id_agen_voucher' => $_SESSION['agen'],
':id_ganerate_voucher' => $last_id,
':kredit' => $jumlah,
':keterangan' => $ket,
':input_time' => $date,
':generate_time' => $generate_time
]);
sweetAlert("Transaksi Berhasil", "success", "?" . base64_encode('voucher_detail_berhasil|' . $last_id));
}
} else {
sweetAlert("Transaksi Gagal: Saldo Anda tidak Cukup", "error");
}
} else {
sweetAlert("Transaksi Gagal: Server tidak terhubung, silahkan hubungi admin", "error");
}
} else {
sweetAlert("Transaksi Gagal: Status agen Non Aktif, silahkan hubungi Admin", "error");
}
}
if ($_SESSION['pay'] == 'false') {
echo '<meta http-equiv="refresh" content="0;url=?'.base64_encode('Home').'">';
// exit();
}
?>
<script>
function toggleButtons() {
document.getElementById('btn001').style.display = 'none';
document.getElementById('btn002').style.display = 'block';
}
</script>
+98
View File
@@ -0,0 +1,98 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Voucher List</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h6><b>Voucher Hotspot</b></h6>
</center>
<div class="card-body">
<input type="text" id="search" placeholder="Cari Voucher" class="form-control">
</div>
<div id="voucher-table-container">
<table class="table" style="zoom: 90%" id="voucher-table">
<tbody>
<!-- Data will be loaded here -->
</tbody>
</table>
</div>
<div id="loading" style="display:none;">Loading...</div>
</div>
</div>
<script>
let page = 1;
let searchQuery = '';
document.getElementById('search').addEventListener('input', function() {
searchQuery = this.value;
page = 1; // Reset to the first page
loadVouchers(true); // Clear existing data on search
});
window.addEventListener('scroll', () => {
if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
page++;
loadVouchers(false); // Load more data without clearing
}
});
function loadVouchers(clearTable = false) {
document.getElementById('loading').style.display = 'block';
fetch(`list_data/list_belum_terjual.php?page=${page}&search=${encodeURIComponent(searchQuery)}`)
.then(response => response.json())
.then(data => {
const tableBody = document.querySelector('#voucher-table tbody');
// Clear the table if clearTable is true
if (clearTable) {
tableBody.innerHTML = ''; // Clear existing rows
}
// Populate table with new data
data.vouchers.forEach(voucher => {
const row = document.createElement('tr');
row.innerHTML = `
<td class="text-left">
<h5>Paket ${voucher.nama_paket}</h5>
<h5><b>${voucher.voucher}</b></h5>
<h6>Pembelian&ensp;&emsp;: ${voucher.create_time}</h6>
</td>
<td class="text-right">
<i class="fa fa-rss fa-2x"></i>
<h6>Rp. ${new Intl.NumberFormat().format(voucher.harga)}</h6>
<a class="text-info" href="?${btoa('voucher_detail_berhasil|' + voucher.id)}"><u>Detail</u></a>
</td>
`;
tableBody.appendChild(row);
});
document.getElementById('loading').style.display = 'none';
})
.catch(error => {
console.error('Error loading vouchers:', error);
document.getElementById('loading').style.display = 'none';
});
}
// Initial load
loadVouchers();
</script>
<!-- CEK LIST VOUCHER KE MIKROTIK UNTUK MEMASTIKAN STATUS NYA -->
+57
View File
@@ -0,0 +1,57 @@
<?php
$_SESSION['pay'] = 'true';
?>
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Jual Voucher</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
<?php if($jenisAgen == 'Prabayar') { ?>
<center>
<p style="color: #fff;">Saldo Anda</p>
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo number_format($pcmem['saldo']); ?></b></h1>
</center>
<?php } else { ?>
<center>
<p style="color: #fff;">Jumlah Transaksi</p>
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo substr(number_format($pcmem['saldo']),1); ?></b></h1>
</center>
<?php } ?>
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 750px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h6><b>Voucher Hotspot</b></h6><br>
</center>
<?php
$sqlPaket = (empty($pcmem['list_paket'])) ? "" : "AND id IN (".$pcmem['list_paket'].")";
$pageBayar = ($jenisAgen === 'Prabayar') ? "voucher_bayar|" : "voucher_generate|";
$ambil=$con->query("SELECT * FROM profile_paket WHERE id_data_server = '$pcmem[id_data_server]' AND jenis_profile = 'Hotspot' AND status = '1' $sqlPaket");
while ($tiap = $ambil->fetch_assoc()) {
?>
<div class="card" style="margin-bottom: 10px; border: none; background-color: #e9e9e9e9; border-radius: 0px;">
<div class="card-body">
<div class="row">
<div class="col-7">
<h6><b><?php echo $tiap["nama"]; ?></b></h6>
<h5>Harga : Rp. <?php echo number_format($tiap["harga_paket"]); ?></h5>
</div>
<div class="col-5">
<a href="?<?php echo base64_encode($pageBayar.$tiap['id']);?>" class="btn btn-warning btn-block" style="border-radius: 20px;"><b>Jual Voucher</b></a>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
+177
View File
@@ -0,0 +1,177 @@
<?php
$ambil = $con->query("SELECT * FROM v_ganerate_voucher WHERE id = '$page[1]'");
$data = $ambil->fetch_assoc();
$nama = $data['voucher'];
$_SESSION['pay'] = 'false';
?>
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Detail Voucher</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; border: none; z-index: 1;">
<div class="card-body">
<center>
<img src="images/tick.gif" width="35%">
<?php if(!empty($data['active_time'])) { ?>
<h5 class="text-danger">Voucher Sudah di Gunakan</h5>
<?php } else { ?>
<h4>Berhasil..!!</h4>
<?php } ?>
</center><hr>
<div class="text-center">
<h4><u>Kode Voucher</u></h4><br>
<h1><b><?php echo $nama ?></b></h1>
</div>
<br>
<table class="table table-block" style="zoom: 90%;">
<tr>
<td>Paket Voucher</td>
<td class="text-right"><?php echo $data['nama_paket']; ?></td>
</tr>
<tr>
<td>Tanggal Pembelian</td>
<td class="text-right"><?php echo $data['create_time']; ?></td>
</tr>
<?php if(!empty($data['active_time'])) { ?>
<tr>
<td>Tanggal Aktif</td>
<td class="text-right"><?php echo $data['active_time']; ?></td>
</tr>
<tr>
<td>Tanggal Expired</td>
<td class="text-right"><?php echo $data['expaired_time']; ?></td>
</tr>
<?php } ?>
<tr>
<td>Harga</td>
<td class="text-right"><h3><b>Rp. <?php echo number_format($data['harga']);?></b></h3></td>
</tr>
</table>
<div class="text-center">
<a href="whatsapp://send?text=*Pembelian Voucher*%0A%0ATanggal : <?php echo $data['create_time']; ?>%0APaket Voucher : <?php echo $data['nama_paket']; ?>%0AKode Voucher : *<?php echo $nama; ?>*%0A%0AVoucher hanya bisa digunakan pada 1 perangkat / device" class="btn btn-success btn-md btn-block mb-4 mt-4" style="border-radius: 20px;">
<i class="fab fa-whatsapp mr-2"></i>Kirim Whatsapp
</a>
<button onclick="initiatePrint()" class="btn btn-block btn-primary" style="border-radius: 20px;"><i class="fas fa-print mr-2"></i>Cetak Voucher</button>
<script>
let logMessages = [];
let currentIndex = 0;
function getPrintData() {
return "[C]<u><?php echo $pcmem['nama_server']; ?></u>\n" +
"[C]<?php echo $data['create_time']; ?>\n" +
"[C]================================\n" +
"[C]Kode Voucher\n" +
"[C]<font size='big'><?php echo $nama; ?></font>\n" +
"[C]================================\n" +
"[L]Paket :[R]<?php echo $data['nama_paket']; ?>\n" +
"[L]HARGA :[R]<?php echo number_format($data['harga']); ?>\n" +
"[C]================================\n";
}
function initiatePrint() {
const printData = getPrintData();
// Call the Kotlin interface method
if (typeof Android !== 'undefined' && Android.printToBluetooth) {
Android.printToBluetooth(printData);
} else {
logMessage("Print Gagal..! Apk belum update");
}
}
function updatePrintHistory() {
const printDetails = {
kodeVoucher: "<?php echo $nama; ?>", // Ganti dengan data yang sesuai
createTime: "<?php echo $data['create_time']; ?>"
};
fetch('list_data/log_cetak.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(printDetails)
});
}
function logMessage(message) {
logMessages.push(message); // Simpan log dalam array
updateLog(); // Perbarui tampilan log
showModal(); // Tampilkan modal
}
function updateLog() {
const logArea = document.getElementById('log');
const retryButtonContainer = document.getElementById('retryButtonContainer'); // Ambil elemen untuk tombol "Ulangi"
currentIndex = 0; // Reset index
logArea.innerHTML = ''; // Kosongkan area log
retryButtonContainer.innerHTML = ''; // Kosongkan isi tombol "Ulangi"
const interval = setInterval(() => {
if (currentIndex < logMessages.length) {
logArea.innerHTML = logMessages[currentIndex]; // Tampilkan log saat ini
currentIndex++;
if (logMessages[logMessages.length - 1] === "Pencetakan berhasil.") {
// Setelah cetak berhasil, update riwayat cetak
updatePrintHistory();
}
} else {
clearInterval(interval); // Hentikan interval setelah semua log ditampilkan
// Cek log terakhir
if (logMessages[logMessages.length - 1] === "Tidak ada printer Bluetooth yang terhubung.") {
retryButtonContainer.innerHTML = `<button onclick="initiatePrint()" class="btn btn-sm btn-primary">
<i class="fas fa-print mr-2"></i>Ulangi
</button>`;
}
}
}, 1000); // Delay 1 detik
}
function showModal() {
const myModal = new bootstrap.Modal(document.getElementById('myModal'));
myModal.show();
}
</script>
<!-- <a href="cetak.php?vcr2=<?php echo $nama; ?>" style="border-radius: 20px;" class="btn btn-secondary btn-lg btn-block mb-4 mt-4">
<i class="fa fa-print mr-2"></i>Cetak
</a> -->
</div>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" aria-labelledby="modalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header justify-content-center"> <!-- Pusatkan header -->
<h5 class="modal-title" id="modalLabel">Proses Status</h5>
</div>
<div class="modal-body text-center"> <!-- Pusatkan body -->
<div id="log" style="white-space: pre-wrap;"></div>
</div>
<div class="modal-footer justify-content-center"> <!-- Pusatkan footer -->
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Tutup</button>
<div id="retryButtonContainer"></div>
</div>
</div>
</div>
</div>
+23
View File
@@ -0,0 +1,23 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">List Diskon Voucher</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h5>Maaf fitur ini belum tersedia.</h5>
</center>
</div>
</div>
+165
View File
@@ -0,0 +1,165 @@
<?php
$ambil = $con->query("SELECT * FROM profile_paket WHERE id = '$page[1]'");
$data1 = $ambil->fetch_assoc();
$harga = $data1['harga_paket'] ;
$kodeprofile = $data1['nama_profile'];
$vim = $data1['vi_agen'] ;
$jumlah = $harga - $vim ;
$saldo = $pcmem['saldo'];
// echo "<pre>";
// print_r($pcmem);
// echo "</pre>";
?>
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="?<?php echo base64_encode('voucher_buat'); ?>" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Generate Voucher</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
<center>
<p style="color: #fff;">Total Transaksi Belum Di Bayar</p>
<h1 style="font-size: 36px; color: #fff;"><small>Rp. </small><b><?php echo substr(number_format($pcmem['saldo']),1); ?></b></h1>
</center>
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 750px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h6><b>Pembayaran Voucher Hotspot</b></h6><br>
</center>
<hr>
<div class="row">
<div class="col-6">
<h6>Pembelian</h6>
<h6>Paket</h6>
</div>
<div class="col-6 text-right">
<h6>Voucher</h6>
<h6><?php echo $data1['nama'] ; ?></h6>
</div>
</div>
<hr>
<div class="row">
<div class="col-6">
<h6>Harga</h6>
</div>
<div class="col-6 text-right">
<h2>Rp. <?php echo number_format($data1['harga_paket']) ; ?></h2>
</div>
</div>
<div class="card-body mt-4">
<form method="post">
<div class="card-body" id="btn001">
<input type="submit" style="border-radius: 20px;" name="pay" class="btn btn-warning btn-md btn-rounded btn-block" value="Generate Voucher" onclick="toggleButtons()"/>
</div>
<div class="card-body" id="btn002" style="display: none;">
<input type="submit" style="border-radius: 20px;" class="btn btn-warning btn-md btn-rounded btn-block" value="Sedang diproses..." disabled/>
</div>
</form>
</div>
</div>
</div>
</div>
<?php
if (isset($_POST['pay']) && $_SESSION['pay'] == 'true') {
$karakter = "QWERTYUPASDFGHJqwertyuipasdfghjkzxcvbnKLZXCV123459876987612345BNMQWERTYUPASGHJKLZXCVBNMqwertyuipasdfghjkzxcvbnm";
$str = $data1['durasi'];
$kodevoucher = $pcmem['kode_agen'] . $str . substr(str_shuffle($karakter), 0, 8);
if($pcmem['status'] == 'Aktif') {
// Fetch settings
$stmt = $pdo->prepare("SELECT * FROM setting_mikrotik WHERE id = :id");
$stmt->execute([':id' => $pcmem['id_setting_mikrotik']]);
$pset = $stmt->fetch(PDO::FETCH_ASSOC);
$m_ip = $pset['ip_address'];
$m_user = $pset['username'];
$m_pass = $pset['password'];
$m_port = $pset['port_api'];
require('router_api/routeros_api.class.php');
$API = new RouterosAPI();
$API->debug = false;
if ($API->connect2($m_ip, $m_user, $m_pass, $m_port)) {
$ARRAY = $API->comm("/ip/hotspot/user/profile/print", array(
".proplist" => ".id",
"?name" => $kodeprofile,
));
if (empty($ARRAY) || $ARRAY[0]['.id'] == '') {
sweetAlert("Transaksi Gagal: Profile paket tidak terdaftar di server, silahkan hubungi admin", "error");
} else {
$date = date('Y-m-d H:i:s');
// Insert generated voucher
$stmt = $pdo->prepare("INSERT INTO ganerate_voucher
(id_data_server, id_agen_voucher, id_setting_mikrotik, id_profile_paket, voucher, harga, create_time)
VALUES (:id_data_server, :id_agen_voucher, :id_setting_mikrotik, :id_profile_paket, :voucher, :harga, :create_time)");
$stmt->execute([
':id_data_server' => $pcmem['id_data_server'],
':id_agen_voucher' => $_SESSION['agen'],
':id_setting_mikrotik' => $pcmem['id_setting_mikrotik'],
':id_profile_paket' => $page[1],
':voucher' => $kodevoucher,
':harga' => $harga,
':create_time' => $date
]);
$last_id = $pdo->lastInsertId();
// Add user in MikroTik
$API->comm('/ip/hotspot/user/add', array(
"name" => $kodevoucher,
"password" => $kodevoucher,
"profile" => $kodeprofile,
"server" => "all"
));
$API->disconnect();
$generate_time = date('Y-m-d');
$ket = 'pembelian voucher ' . $data1['nama'] . ' -> ' . $kodevoucher;
$stmt = $pdo->prepare("INSERT INTO transaksi_agen_voucher
(id_data_server, id_agen_voucher, id_ganerate_voucher, kredit, keterangan, input_time, generate_time)
VALUES (:id_data_server, :id_agen_voucher, :id_ganerate_voucher, :kredit, :keterangan, :input_time, :generate_time)");
$stmt->execute([
':id_data_server' => $pcmem['id_data_server'],
':id_agen_voucher' => $_SESSION['agen'],
':id_ganerate_voucher' => $last_id,
':kredit' => $jumlah,
':keterangan' => $ket,
':input_time' => $date,
':generate_time' => $generate_time
]);
sweetAlert("Transaksi Berhasil", "success", "?" . base64_encode('voucher_detail_berhasil|' . $last_id));
}
} else {
sweetAlert("Transaksi Gagal: Server tidak terhubung, silahkan hubungi admin", "error");
}
} else {
sweetAlert("Transaksi Gagal: Status agen Non Aktif, silahkan hubungi Admin", "error");
}
}
if ($_SESSION['pay'] == 'false') {
echo '<meta http-equiv="refresh" content="0;url=?'.base64_encode('Home').'">';
// exit();
}
?>
<script>
function toggleButtons() {
document.getElementById('btn001').style.display = 'none';
document.getElementById('btn002').style.display = 'block';
}
</script>
+98
View File
@@ -0,0 +1,98 @@
<nav class="navbar fixed-top">
<div id="specificCard" class="card col-12" style="border-radius: 20px; background: none; border: none; margin-top: 10px;">
<div class="row">
<div class="col-6 icon-container">
<a href="index.php" class="fa fa-arrow-left text-light"></a>
</div>
<div class="col-6 text-right">
<h6 class="text-light mt-2 mb-2">Voucher Sudah Terjual</h6>
</div>
</div>
</div>
</nav>
<div class="card" style="border-radius: 0px; background: none; border: none; margin-top: 100px;">
<div class="card-body">
</div>
</div>
<div class="card" id="2" style="border-top-right-radius: 40px; border-top-left-radius: 40px; min-height: 800px; border: none; z-index: 1;">
<div class="card-body">
<center>
<h6><b>Voucher Hotspot</b></h6>
</center>
<div class="card-body">
<input type="text" id="search" placeholder="Cari Voucher" class="form-control">
</div>
<div id="voucher-table-container">
<table class="table" style="zoom: 90%" id="voucher-table">
<tbody>
<!-- Data will be loaded here -->
</tbody>
</table>
</div>
<div id="loading" style="display:none;">Loading...</div>
</div>
</div>
<script>
let page = 1;
let searchQuery = '';
document.getElementById('search').addEventListener('input', function() {
searchQuery = this.value;
page = 1; // Reset to the first page
loadVouchers(true); // Clear existing data on search
});
window.addEventListener('scroll', () => {
if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
page++;
loadVouchers(false); // Load more data without clearing
}
});
function loadVouchers(clearTable = false) {
document.getElementById('loading').style.display = 'block';
fetch(`list_data/list_sudah_terjual.php?page=${page}&search=${encodeURIComponent(searchQuery)}`)
.then(response => response.json())
.then(data => {
const tableBody = document.querySelector('#voucher-table tbody');
// Clear the table if clearTable is true
if (clearTable) {
tableBody.innerHTML = ''; // Clear existing rows
}
// Populate table with new data
data.vouchers.forEach(voucher => {
const row = document.createElement('tr');
row.innerHTML = `
<td class="text-left">
<h5>Paket ${voucher.nama_paket}</h5>
<h5><b>${voucher.voucher}</b></h5>
<h6>Pembelian&ensp;&emsp;: ${voucher.create_time}</h6>
<h6>Aktif&ensp;&emsp;: ${voucher.active_time}</h6>
<h6>Expired&ensp;&emsp;: ${voucher.expaired_time}</h6>
</td>
<td class="text-right">
<i class="fa fa-rss fa-2x"></i>
<h6>Rp. ${new Intl.NumberFormat().format(voucher.harga)}</h6>
<a class="text-info" href="?${btoa('voucher_detail_berhasil|' + voucher.id)}"><u>Detail</u></a>
</td>
`;
tableBody.appendChild(row);
});
document.getElementById('loading').style.display = 'none';
})
.catch(error => {
console.error('Error loading vouchers:', error);
document.getElementById('loading').style.display = 'none';
});
}
// Initial load
loadVouchers();
</script>