Hotspot trial limit by usage not time

Hi All,
I am wanting to limit the trial on my hotspots by usage mot time.
In other words, A user logs onto my hotspot and receives say 200Mb complimentary service, thereafter he needs to purchase access.
Any ideas??

Hi,

Have a look at the scrip here - http://www.mikrotik-routeros.com/2012/10/add-a-data-limit-to-trial-hotspot-users/

We’ve used it in a number of locations and found it works well, just read the comments about the multiplication of the data and you’ll be fine.

Thanks Cstan,
One thing more, to clear the users every 24 hrs how do Imodify the script?

The second script on that page allows you to clear the users.
Just place it into a script on your device (system → scripts) and then set up a scheduler entry (system → scheduler) to run that script every 24hrs (or whatever interval you like)

Thanks Stan,
Will give it a whirl

The scheduler is working ok.
But how do I apply the complimentary access when a user log onto the hotspot for the first time?
Can you maybe post your setup here. It would be a great help .

If you have a look at the standard login.html file that is on a Mikrotik with an active hotspot you will see this line of code:

<a href="$(link-login-only)?dst=$(link-orig-esc)&username=T-$(mac-esc)">

You have this link on a button, word, picture, whatever you want. This tells the Mikrotik to log the user in, using the trial user log in method of the hotspot.

So to get it working you need the following:

  • A hotspot setup with the trial user log in method enabled
  • A login.html file with that line of code somewhere to let the user log in
  • Those two scripts setup

When they user connects to the wifi the hotspot serves them the login.html. They then click on the link, attached to a button or image etc. It then passes that to the Mikrotik and creates an active user as in the image below.
active trial users.PNG
HTML Example.PNG
Hotspot and Script Setup.PNG

this scripts affects any account even in userman as long as its in hotspot server it will also be disconnected when it reaches its qouta.. can anyone share solutions how to prevent account from radius? thanks

I had the same problem, so I updated the script. Whenever I some up with a solution I document it on my blog, the tutorial below will do what you require, I use it extensively myself:
http://binaryheartbeat.blogspot.com/2014/03/mikrotik-hotspot-data-limit-trial.html

have Just added a Script

http://forum.mikrotik.com/t/hotspot-data-limits/90475/1

this works well for me - and takes away from running scripts every 5-10 mins

The script is not working correctly for me. When i test it will limit megabit download and not megabyte download.