Part 3 - Mikrotik Hotspot & Freeradius -- Create your own user manager

If in the previous part we are using phpMyAdmin for inserting a new user and it's information, but in this third part you have to write a little php script for inserting and querying MySQL database.

First we need to ensure that you understand with basic php programing especially with MySQL data processing. If you don't understand than i suggest you to go to one of my favorite links and learn some basic php MySQL programing. Don't ask me why, just read the title of this post "Create your own....", it's mean i am not give you any tutorials for php programing or something like that in this time, i just give you some clue for made it your self.

Next create a page contain with username, password and session time (in Second) selection form. Then create submit page to process the form and insert it into radcheck tables in freeradius database, the result will be like this example image.

Then give the user a group.
Another image to see.

There are 3 steps to do, first you need to add a user and password next you give the user a maximum session time (this is an optional, if you don't do this step then user will be have an unlimited session time) then add the user into a group.

Sql code:
INSERT INTO radcheck VALUES('', 'auserloginname', 'User-Password', '==', 'auserpassword')
INSERT INTO radcheck VALUES('', 'auserloginname', 'Max-All-Session', ':=', '10800')
INSERT INTO usergroup VALUES('auserloginname', agroupname', '1')

Please note that the "op" field in the radcheck it's is not the same form the first code and the second code.

OK, now you had made your own user registration page, user now can login into MikrotikHotspot (assume that Mikrotik box has already connect to radius server).

Next: Managing User Stats.