0% found this document useful (0 votes)
273 views3 pages

Template Mikrotik

The document contains PHP code to generate vouchers or coupons with different colors based on the price. It sets a color variable depending on the price, which is then used to style the background color of the price field. It can generate vouchers with just a code, username/password, or include a QR code. The styles and fields displayed are controlled based on variables for things like price, user mode, and whether to include a QR code.

Uploaded by

actnux
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
273 views3 pages

Template Mikrotik

The document contains PHP code to generate vouchers or coupons with different colors based on the price. It sets a color variable depending on the price, which is then used to style the background color of the price field. It can generate vouchers with just a code, username/password, or include a QR code. The styles and fields displayed are controlled based on variables for things like price, user mode, and whether to include a QR code.

Uploaded by

actnux
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

<?

php
/*
Copy Paste ke template editor [Settings -> Template Editor].
Sesuikan harga dan warna masing-masing.
warna bisa dilihat di https://material.io/guidelines/style/color.html#color-color-
palette
variable $color
background-color:<?= $color;?>; -webkit-print-color-adjust: exact;
ditambahkan ke style di tag html yang ingin dikasi warna.
*/

if ($getsprice == "1000") {
$color = "#2196F3";
} // jika harga == "1000" maka warna = "#2196F3"
elseif ($getsprice == "3000") {
$color = "#009688";
} elseif ($getsprice == "5000") {
$color = "#FF9800";
} // ini yang dicopy untuk menambah warna berdarsarkan harga, kemudian paste di
atas baris // else color

// else color
else {
$color = "#FFFFFF";
}
?>
<style>
.qrcode{
height:80px;
width:80px;
}
</style>
<table class="voucher" style=" width: 220px;">
<tbody>
<!-- Logo Hotspotname -->
<tr>
<td style="text-align: left; font-size: 14px; font-weight:bold; border-
bottom: 1px black solid;"><img src="<?= $logo; ?>" alt="logo"
style="height:30px;border:0;"> <?= $hotspotname; ?> <span id="num"><?= " [$num]";
?></span></td>
</tr>
<!-- / -->
<tr>
<td>
<table style=" text-align: center; width: 210px; font-size: 12px;">
<tbody>
<!-- Username Password QR -->
<tr>
<td>
<table style="width:100%;">
<!-- Username = Password -->
<?php if ($usermode == "vc") { ?>
<tr>
<td font-size: 12px;>Kode Voucher</td>
</tr>
<tr>
<td style="width:100%; border: 1px solid black; font-weight:bold; font-
size:16px;"><?= $username; ?></td>
</tr>
<!-- / -->
<!-- Username & Password -->
<?php
} elseif ($usermode == "up") { ?>
<!-- Check QR -->
<?php if ($qr == "yes") { ?>
<tr>
<td>Username</td>
</tr>
<tr>
<td style="border: 1px solid black; font-weight:bold;"><?= $username; ?
></td>
</tr>
<tr>
<td>Password</td>
</tr>
<tr>
<td style="border: 1px solid black; font-weight:bold;"><?= $password; ?
></td>
</tr>
<?php
} else { ?>
<tr>
<td style="width: 50%">Username</td>
<td >Password</td>
</tr>
<tr style="font-size: 14px;">
<td style="border: 1px solid black; font-weight:bold;"><?= $username; ?
></td>
<td style="border: 1px solid black; font-weight:bold;"><?= $password; ?
></td>
</tr>
<?php
}
} ?>
<!-- / -->
</table>
</td>
<!-- QR Code -->
<?php if ($qr == "yes") { ?>
<td>
<?= $qrcode ?>
</td>
<?php
} ?>
<!-- / -->
<tr>
<!-- Price -->
<td colspan="2" style="border-top: 1px solid black;font-weight:bold; font-
size:16px; background-color:<?= $color; ?>; -webkit-print-color-adjust: exact;"><?=
$validity; ?> <?= $timelimit; ?> <?= $datalimit; ?> <?= $price; ?></td>
<!-- / -->
</tr>
<tr>
<!-- Note -->
<td colspan="2" style="font-weight:bold; font-size:12px">Login: http://<?=
$dnsname; ?></td>
<!-- / -->
</tr>
<!-- / -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

You might also like