Tuesday, May 21, 2013

How to Create Voucher in Mikrotik User Manager


Mikrotik hotspot voucher
This post continues the previous post. Make sure you've managed to create a Mikrotik User Manager as Radius Server. In this post, I will explain how make voucher easily. There are 2 types of vouchers are often used, first, vouchers that use time limit, and second, vouchers that use quota limit.  You will be able to develop, by combining the two types, so get a voucher that uses a time limit and quota limit.
Let's go to make it. This is the plan.
1. Time Voucher 2 hours, price 5,000, expired 10 days from the start of use.
2. Quota Voucher 1 GB, price 3,000, expired 30 days from the start of use.


Login
Open browser, and go to http://<ip-address-mikrotik>/userman. You will find login page Mikrotik User Manager, then enter username and password.
mikrotik user manager

Create Limitation Profiles
Click Profiles – Limitation tab. Click add – New. In Limitation detail box, enter name "1 Giga Bytes", limit download. Other options, you can fill rate limit. Then click add.
user manager - limitation profiles

Next, on Limitation tab, click add – New, In Limitation details box, enter another name "2 Hours" and in section Limits, uptime : 120m. then click add.
user manager - limitation details

Create Profiles Voucher
Next, in tab Profiles, click sign plus ( + ), to create profile. Fill name "Time 2 Hours", then click create.
user manager - profiles voucher

Continue to fill validity box, price and other option. Then click add new limitation. Look at picture.
user manager - profiles voucher settings

Dialog box about Profile part, will be appear. In Limits section, check 2 hours, then click add. Back to tab Profiles, click Save profile
user manager - profiles voucher settings 2

A profile voucher has been created. Next other profile vouchers, the same steps as before. Click sign plus ( + ), then in create profile, enter name : Quota 1 GB, then click create. Next, enter validity and price. Then click add new limitation. 
user manager - profiles voucher settings 3

Dialog box about Profile part, will be appear. In Limits section, check 1 Giga Bytes, then click add. Then save profile.
user manager - profiles voucher settings 4

Create Users
Click Users – Add – Batch. In user details box, fill numbers of users, username length, etc. Then in assign profile, select Assign profile : Time 2 Hours, which has been made. Then click add. Continue to make another users with the same steps, for Quota 1 GB.
user manager - users settings

So, you will get many username that already used.
user manager - list users

If you don't see the password, you must configure menu setting. In section of setting, you will find table column, about some menu. Click users, then click password in the hidden column, move to visible column, with click left sign.And for the other menu, you can explore by yourself. Then click save.
user manager - settings

Setting Template Voucher
Click Settings – Templates. Select name : Vouchers. 
user manager - settings templates

Copy code below and paste in Header box,
<!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> <style> @media print { .noprint { display: none; } .pagebreak { page-break-after: always; } } body { font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif; padding: 100px; font-size: 13px; }  div.box {  background: rgb(230,240,163); /* Old browsers */ background: -moz-linear-gradient(-45deg, rgba(230,240,163,1) 0%, rgba(210,230,56,1) 50%, rgba(195,216,37,1) 51%, rgba(219,240,67,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,rgba(230,240,163,1)), color-stop(50%,rgba(210,230,56,1)), color-stop(51%,rgba(195,216,37,1)), color-stop(100%,rgba(219,240,67,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(-45deg, rgba(230,240,163,1) 0%,rgba(210,230,56,1) 50%,rgba(195,216,37,1) 51%,rgba(219,240,67,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(-45deg, rgba(230,240,163,1) 0%,rgba(210,230,56,1) 50%,rgba(195,216,37,1) 51%,rgba(219,240,67,1) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(-45deg, rgba(230,240,163,1) 0%,rgba(210,230,56,1) 50%,rgba(195,216,37,1) 51%,rgba(219,240,67,1) 100%); /* IE10+ */ background: linear-gradient(135deg, rgba(230,240,163,1) 0%,rgba(210,230,56,1) 50%,rgba(195,216,37,1) 51%,rgba(219,240,67,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e6f0a3', endColorstr='#dbf043',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */  width: 3.6in; height: 2.1in; padding: 0 17px 18px 12px; margin: 10px 0; border: solid 1px #D9D9D9; border-radius: 10px; -webkit-border-radius: 2px; -moz-border-radius: 2px; }  div.box h2 {  background: rgb(30,87,153); /* Old browsers */ background: -moz-linear-gradient(top, rgba(30,87,153,1) 0%, rgba(41,137,216,1) 50%, rgba(32,124,202,1) 51%, rgba(125,185,232,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(50%,rgba(41,137,216,1)), color-stop(51%,rgba(32,124,202,1)), color-stop(100%,rgba(125,185,232,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* IE10+ */ background: linear-gradient(to bottom, rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */  margin: 0 -17px 1px -12px; padding: 15px 0px 0 10px; height: 20px; border-top-left-radius: 10px; border-top-right-radius: 10px; -webkit-border-radius: 2px; -moz-border-radius: 2px; font: bold 18px/0.2 Arial; color: #fff; text-shadow: red 0.1em 0.1em 0.6em}  div.box h3 { background-color: #FFF8DC; border-color: #000; border-style:solid; border-width:1px; margin: -35px 0 0 70px; padding: 12px 50px 3px 10px; height: 8px; width: 30px; font: bold 12px/0 Arial; color: #000; } div.box h4 {  background: rgb(174,188,191); /* Old browsers */ background: -moz-linear-gradient(top, rgba(174,188,191,1) 0%, rgba(110,119,116,1) 50%, rgba(10,14,10,1) 51%, rgba(10,8,9,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(174,188,191,1)), color-stop(50%,rgba(110,119,116,1)), color-stop(51%,rgba(10,14,10,1)), color-stop(100%,rgba(10,8,9,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, rgba(174,188,191,1) 0%,rgba(110,119,116,1) 50%,rgba(10,14,10,1) 51%,rgba(10,8,9,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, rgba(174,188,191,1) 0%,rgba(110,119,116,1) 50%,rgba(10,14,10,1) 51%,rgba(10,8,9,1) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, rgba(174,188,191,1) 0%,rgba(110,119,116,1) 50%,rgba(10,14,10,1) 51%,rgba(10,8,9,1) 100%); /* IE10+ */ background: linear-gradient(to bottom, rgba(174,188,191,1) 0%,rgba(110,119,116,1) 50%,rgba(10,14,10,1) 51%,rgba(10,8,9,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#aebcbf', endColorstr='#0a0809',GradientType=0 ); /* IE6-9 */ margin: 0px -17px 0px -12px; padding: 10px 10px 5px 10px; height: 10px; font: bold 14px/0.2 Arial; color: #fff; text-shadow: white 0.1em 0.1em 0.6em  } .txtbox { background-color: transparent; width: 330px;  }  </style> </head> <body>

And code below, copy and paste in Row box.
<div class="box"> <h2>Hotspot - Internet Card Rs %u_moneyPaid%</h2> <div class="txtbox">Connect to Wireless Network and open you webbrowser. Put the <b>UserName</b> and  <b>Password</b> in required field, then <b>click login button.</b></div> <br> <p align="left">UserName:</p>  <h3>%u_username%</h3> <p align="left">Password:</p>  <h3>%u_password%</h3> <h5 style="margin-top: -70px; margin-left: 230px; font: bold 30px Arial; color: #fff; text-shadow: black 0.1em 0.1em 0.6em;">%u_timeLeft%</h5> <p style="margin-top: -40px; margin-left: 250px;">Price: %u_moneyPaid%</p> <br> <h4>Contact for more info. myconfigure.blogspot.com</h4> </div>

Generate Vouchers
Next, from users list, we generate voucher, that will be printed. Click Users. Check all users, then click Generate - Vouchers.
user manager - users voucher

The new dialog box will appear, then click generate.
user manager - generate vouchers

Pop-up browser will be shown. This is the end result of a voucher that will be printed. You can change the code of the template voucher, so you can get a more attractive.
mikrotik hotspot vouchers

Try Login From Client Computer
We have finished to create and print voucher. Now from client computer, in login page browser, enter username and password of voucher. It should be correct, and you will be connected to internet.
Look at Hotspot dialog box, click Active tab.  Current users will be seen, and there is a sign R, on the left side, meaning the user from radius server.
Mikrotik hotspot active users

And at last, make sure, if time or quota of vouchers has been exceeded, the client computer will automatically disconnect from the internet, and will return to the login page.
Good luck..!!!

Reference :
*  Original Code Template Voucher from wifitech, http://www.wifitech.com.pk/mikrotik-voucher-template/
** http://wiki.mikrotik.com/wiki/User_Manager/Voucher_template  

31 comments:

  1. The "Validity:" 10 days have expired, or not.

    Thank you.

    ReplyDelete
  2. Hi Thank You very much for this post....

    ReplyDelete
  3. hi ..
    i have some question if i can ??

    ReplyDelete
  4. Thank you so much.. you have made it clearer to me.

    ReplyDelete
  5. thanks you so much, really so great explain above.

    ReplyDelete
  6. Thanks a lot i have used it on my machines se at : http://www.wifinederland.nl/index.php?PP=Mikrotik%20router%20pc%20met%20hdd%20%20en%20routeros

    Greetings Pascal

    ReplyDelete
  7. Nice job.
    I have a problem when add users with Batch button. When i use this, vouchers not have a time and price, but if add manually one by one it`s not problem.

    ReplyDelete
  8. Hello everyone,

    I need to know if someone could help about a script which can delete users who has reached uptime limit. Because after creating a 100+ users, it is very difficult to delete users.

    Thank you

    ReplyDelete
  9. hello every one.
    when I try to use the voucher I generate it shows radius server not responding. but I can connect the internet with the client I added. what can do to make I connect

    ReplyDelete
  10. i tried this but it gives error radius saver not found pls help

    ReplyDelete
  11. my network refresh after every minute

    ReplyDelete
  12. Hello Every one,

    I want to know how to know which IP address to use when connecting to userman, I mean when you want to create a voucher.

    Thank you for your help

    ReplyDelete
  13. Use IP address that you have created on the interface mikrotik...

    ReplyDelete
  14. the client can play online games or browsing only

    ReplyDelete
  15. Hello all Please help me.
    Share user doesn't work on mikrotik usermanager

    ReplyDelete
  16. hello everyone,
    is that session timeout (userprofile-webcofig) and uptime (profile- user manager or radius) different?
    i got a problem that: the time (2 Hours) as the guide above of my new user cannot be set. it logout after 15 minutes as my session timeout default.
    thanks in advance !

    ReplyDelete
  17. I created a voucher template but only last voucher printed. All others are hodden.. please help

    ReplyDelete
  18. So after creating the user. how can you delete it???

    ReplyDelete
    Replies
    1. yes, i want to know too. how to delete it and generate new users

      Delete
  19. Thanks a lot i manage go on successfully

    ReplyDelete
  20. To delete users: select one or all and click in Edit. Then choice Remove

    ReplyDelete
  21. thank you for sharing ideas sir big help for me.

    ReplyDelete
  22. Thank you for sharing good idea sir big help for me.

    ReplyDelete
  23. thank you for your lesson but here am stacked,hotspot users are fine only user manager with the voucher I created looks like unlimited,I limit time to 1Hrs but they can browse for all day. Where did I me-sap?

    ReplyDelete
  24. Impressed a lot, I really like your blog.
    Thanks for the post.
    Event Ticket

    ReplyDelete
  25. Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject.
    Marley Spoon Offer
    Marley Spoon Offer
    Marley Spoon Offer

    ReplyDelete