Add a QR code login to your hotspot vouchers with the following template. Free for commercial use!
Open the "User Manager" interface in your browser.
Navigate to the "Settings" page
Select the "Templates" tab
Select "Vouchers"
Add the following code in the appropriate boxes:
Header
Make sure that you update the path to the jquery libraries, you can use mine at :
jquery.min.js: https://drive.google.com/file/d/0B-Vs3naHEfHGMWZoaENuSWd6cFE
jquery.qrcode.min.js: https://drive.google.com/file/d/0B-Vs3naHEfHGQ2tBQWU5V1ZtSm8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Vouchers</title>
<script src="http://path-to-your-host/jquery.min.js" type="text/javascript"></script>
<script src="http://path-to-your-host/jquery.qrcode.min.js" type="text/javascript"></script>
<style>
@page {
size: A4;
margin: 0;
}
@media print {
html, body {
width: 210mm;
height: 297mm;
margin-left: auto;
margin-right: auto;
}
}
@media screen {
html, body {
width: 800px;
}
}
body
{
padding: 5mm;
margin:0;
margin-left: auto;
margin-right: auto;
font-size: 20px;
font-family: Arial, 'Arial Unicode MS', Helvetica, Sans-Serif;
line-height: 85%;
}
#main-wrap {
background-color: #fff;
max-height: 317px;
text-align: center;
border: solid;
border-width: 1px;
display: inline-block;
}
#main-wrap > div {
max-height: 307px;
}
#main-wrap {
overflow: hidden;
width: 45%;
padding-top: 20px;
padding-bottom: 20px;
}
#leftside {
display: inline-block;
width: 50%;
font-size: 22px;
line-height: 22px;
height: 220px;
}
#rightside {
display: inline-block;
width: 45%;
height: 220px;
font-size: 18px
}
img.logo {
width: 100%;
margin-left: auto;
margin-right: auto;
}
.qrcode {
height: 150px;
width: 150px;
}
</style>
</head>
<body>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Vouchers</title>
<script src="http://path-to-your-host/jquery.min.js" type="text/javascript"></script>
<script src="http://path-to-your-host/jquery.qrcode.min.js" type="text/javascript"></script>
<style>
@page {
size: A4;
margin: 0;
}
@media print {
html, body {
width: 210mm;
height: 297mm;
margin-left: auto;
margin-right: auto;
}
}
@media screen {
html, body {
width: 800px;
}
}
body
{
padding: 5mm;
margin:0;
margin-left: auto;
margin-right: auto;
font-size: 20px;
font-family: Arial, 'Arial Unicode MS', Helvetica, Sans-Serif;
line-height: 85%;
}
#main-wrap {
background-color: #fff;
max-height: 317px;
text-align: center;
border: solid;
border-width: 1px;
display: inline-block;
}
#main-wrap > div {
max-height: 307px;
}
#main-wrap {
overflow: hidden;
width: 45%;
padding-top: 20px;
padding-bottom: 20px;
}
#leftside {
display: inline-block;
width: 50%;
font-size: 22px;
line-height: 22px;
height: 220px;
}
#rightside {
display: inline-block;
width: 45%;
height: 220px;
font-size: 18px
}
img.logo {
width: 100%;
margin-left: auto;
margin-right: auto;
}
.qrcode {
height: 150px;
width: 150px;
}
</style>
</head>
<body>
Row
Make sure you update the IP to reflect your Hotspot IP, and point it to a valid logo image.
Logo dimensions in my example are 437px wide by 71px high.
<div id="main-wrap">
<img class="logo" src="logo.png">
<div id="leftside"><br>
<strong>%u_actualProfileName%</strong><br><br>
<strong>Username:</strong> <br>%u_username%<br><br>
<strong>Password:</strong> <br>%u_password%<br><br>
</div>
<div id="rightside"><br>SCAN TO LOG IN<br>
<div class="qrcode" id="%u_username%"></div>
<script> jQuery(function(){jQuery('#%u_username%').qrcode(
{
"render": 'div',
"size": 150,
"minVersion": 5,
"maxVersion": 5,
"ecLevel": 'L',
"mode": 0,
"text": "http://hotspot-ip/login?username=%u_username%&password=%u_password%",
"quiet": 0,
}
); }) </script>
<span style= "font-size: 12px">Or browse to: <br>http://hotspot-dns-name<br></span>
</div>
<div class="bottom">
Ask your host for more information
</div>
</div>
<img class="logo" src="logo.png">
<div id="leftside"><br>
<strong>%u_actualProfileName%</strong><br><br>
<strong>Username:</strong> <br>%u_username%<br><br>
<strong>Password:</strong> <br>%u_password%<br><br>
</div>
<div id="rightside"><br>SCAN TO LOG IN<br>
<div class="qrcode" id="%u_username%"></div>
<script> jQuery(function(){jQuery('#%u_username%').qrcode(
{
"render": 'div',
"size": 150,
"minVersion": 5,
"maxVersion": 5,
"ecLevel": 'L',
"mode": 0,
"text": "http://hotspot-ip/login?username=%u_username%&password=%u_password%",
"quiet": 0,
}
); }) </script>
<span style= "font-size: 12px">Or browse to: <br>http://hotspot-dns-name<br></span>
</div>
<div class="bottom">
Ask your host for more information
</div>
</div>
Footer
</body>
</html>
</html>
Break
<p class="noprint" style="font-size: 10px"> ................ page break ................ </p> <p class="pagebreak"> </p>
Let me know if you have any suggestions in the comments!
How to use this voucher template on 2 hotspot server integrated with radius?
ReplyDelete1 Router have User Manager and the other is doesn't have user manager but they have hotspot server. I want user can use the voucher to login on both hotspot server.
hi how i can use this in my server i try but the qr code does not apper
ReplyDeletehi how i can use this in my server i try but the qr code does not apper
ReplyDeletecan you try to change:
Delete"render": 'div',
to
"render": 'img',
and let me know how it goes?
ok i will try know
ReplyDeletesame problem
ReplyDeletescript src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHazFJWmtXTGhWc28/jquery.min.js" type="text/javascript"
ReplyDeletescript src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHY2tPNXpoZ19TQlU/jquery.qrcode.min.js" type="text/javascript"
en que del codigo htlm insertado esa parte de codigo
Deletescript src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHazFJWmtXTGhWc28/jquery.min.js" type="text/javascript"
ReplyDeletescript src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHY2tPNXpoZ19TQlU/jquery.qrcode.min.js" type="text/javascript"
every thing is ok
ReplyDeletebut the qr code does not apper
Now every thing is OK
ReplyDeleteBut the size of card is bigger
How I can resize
Sizing is a pain, but you can play around with the css values:
Delete.qrcode {
height: 150px;
width: 150px;
}
note that when you use the img version, it gets slightly blurry
how did you fix your problem with appear the qr code?????
Deleteits not appear with me
change
Delete"render": 'div',
to
"render": 'img',
Not work for me, qrcode still not appear
Delete
ReplyDeletethank sir for the idea of linking user manager by qr code I want to ask you a question Can you created the cards operate only whatsapp
I have honestly never tried it. Is your idea to send the qr code to a client using whatsapp?
DeleteHola buenas noches estoy utlizando su codigo todo lo demas me carga en plantilla menos el qr que me hace falta pra lograr visualizar el QR?
ReplyDeleteLo sentimos, no hablo español, ¿puedes por favor trate Inglés.
Deleteqr code does not apper
ReplyDeleteI need to do it then appears the image of the QR ?
ReplyDeleteNo sir u do not understand me??
ReplyDeleteI need generate a count. This a count only used for whatsapp...
Only can be used call and send text messages by whatsapp
ReplyDeleteAnd other app. Not run ...
script src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHazFJWmtXTGhWc28/jquery.min.js" type="text/javascript"
ReplyDeletescript src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHY2tPNXpoZ19TQlU/jquery.qrcode.min.js"
ERROR PLISE REPLY خطاء برجاء التصحيح
Reply
Hello such as changing the logo of the voucher , if I can do as I say ...... thank you very much !
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis why yes? still can not arise QR barcode
ReplyDelete"div" I've replace "img"
http://i.imgur.com/lislLu9.jpg
Heloo Abdulah, how you can fix your problem about appear QR Code ? because i can't appear the qr code.
ReplyDeleteWhether you use this sources :
script src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHazFJWmtXTGhWc28/jquery.min.js" type="text/javascript"
script src="http://https://drive.google.com/open?id=0B_EIqDVjNAlHY2tPNXpoZ19TQlU/jquery.qrcode.min.js" type="text/javascript"
Or you change the script ?
Need your help, please.
Sorry, I have fixed my problem with QR Code on Mikrotik.
ReplyDeleteSolution :
use this script on Header :
script src="https://www.kangndo.com/qrcode/jquery.min.js"
script src="https://www.kangndo.com/qrcode/jquery.qrcode.min.js"
And in order to you can scan qr code and direct connect to login, on mikrotik you can seting IP --> Hotspot, On Server Profiles Tab, choose and click your server profile that you use, then at the Login Tab, you checklist HTTP PAP option.
And Clear.
:-D
If you confuse, you can email me in : swarabhaskara11@gmail.com
Hi Ardhy Baskara,
DeleteYes your solution works in terms of generating the QR code and appearing on the page for printing, but the QR code is not being scanned (read) by any application (Specifically I used "QR & Barcode Scanner" and "Barcode Scanner" from Play Store). But 2 or 3 times after scanning for more than 30 Seconds I got the code recognised, which is really unusual and impractical for general users.
Jurgens Krause and you have done a great job here. Now if you get the time for checking the last status of these codes outcome, then that would be even great for rest of us.
Cheers for you.
why the QR code cand read it with any QR CODE SCANNER?
ReplyDeletetakes longer to read the code qr please any solution to this problem ....
ReplyDeletesrc="https://drive.google.com/file/d/0B-Vs3naHEfHGMWZoaENuSWd6cFE"
ReplyDeletesrc="https://drive.google.com/file/d/0B-Vs3naHEfHGQ2tBQWU5V1ZtSm8"
tried using tha code above still QR and logo doesnt show up btw where do i put the logo in the router or web hosted?
how can i decrease the size of the qr code? Please help me with that
ReplyDeleteHey; cool voucher. Just wondering if I could use this code in my own project?(http://unifispot.com)
ReplyDeletePlease do let me know if its ok to include a modified version of this code.
This comment has been removed by the author.
ReplyDeletewhere is logo in directory
ReplyDeletenot work pro
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeletehow to center the qr code?
ReplyDeletehi i dont understant this part
ReplyDelete<< Make sure that you update the path to the jquery libraries, you can use mine at :
jquery.min.js: https://drive.google.com/file/d/0B-Vs3naHEfHGMWZoaENuSWd6cFE
jquery.qrcode.min.js: https://drive.google.com/file/d/0B-Vs3naHEfHGQ2tBQWU5V1ZtSm8 >>
where and how to update please help
Hello,
ReplyDeleteFirst of all thank you, that is very educative!
But I'm having a issue i get modified my voucher template, perfonalized with image and text and all is working and the QR is recognized but the password is not accepted by the hotspot becuse it is not chap encrypted, could you please help me?
Hello, can you resize the size of the voucher. its definitely big.
ReplyDelete