Community discussions

 
flynno
Member Candidate
Member Candidate
Topic Author
Posts: 241
Joined: Wed Aug 27, 2014 8:11 pm

Hotspot User API

Wed Aug 27, 2014 8:23 pm

Hi Guys,

I'm new to the forums only joined today but I have been reading them with quiet some time now.

I got a hotspot running with a while, customers pay by paypal and then get redirected to a php form I have
hosted on my web server to collect the username and passwords they create,
but I have to enter the username and password manually into the router using winbox.

What I want to do is use API to enter the username and password that is collected with the php form
automatically into the router running the hotspot, so I dont have any involvement in creating accounts.

<?php

require('routeros_api.class.php');

$API = new routeros_api();

$API->debug = false;

if ($API->connect('webserver', 'admin', 'password')) {


(((What code goes here to allow for automatic username and password creation)))


$API->disconnect();
}

?>


If anyone can help me out with this it would be aswum
 
flynno
Member Candidate
Member Candidate
Topic Author
Posts: 241
Joined: Wed Aug 27, 2014 8:11 pm

Re: Hotspot User API

Thu Aug 28, 2014 9:09 pm

I decided to use freeradius on a DigitalOcean to manage 'New Wifi Users'.
New users can now create their own username and passwords after making a payment by paypal.

When payment is made the new users get redirected to a form on my webserver to collect customer details,
upon completion the required information is sent to my SQL database on my Freeradius Server,
I am also emailed the contents of the form and the username and password is entered into the Radius server.

The new users are then redirected to the login page to enter in their chosen username and password.

Those anyone else have a easier method than this that would like to share with me?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Hotspot User API

Fri Aug 29, 2014 6:15 pm

Long term, what you have is the best possible option, since if you have an additional hotspot router, it can connect back to the same radius server.

The easier way, without RADIUS, is to use the API to issue "/ip/hotspot/user/add", but then if you add a new hotspot, it would have its own independent user DB.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
flynno
Member Candidate
Member Candidate
Topic Author
Posts: 241
Joined: Wed Aug 27, 2014 8:11 pm

Re: Hotspot User API

Fri Aug 29, 2014 11:14 pm

Hi boen_robot

Ya I think freeradius is the best option but im having difficulty with new user hotspot profiles,
I cant seem to create custom porfiles, the users seem to just be using the 'default' profile.

I have this setup:

Radusergroup =
username groupname priority
test 1mb 0


Radgroupreply =
groupname attribute op value
1mb Mikrotik-Rate-Limit = 512000/1000000


Not sure if im going in the right direction with these configs,
cant seem to find a good tutorial on how to set up profiles.

Do you know of any that could get me on the right path?
 
flynno
Member Candidate
Member Candidate
Topic Author
Posts: 241
Joined: Wed Aug 27, 2014 8:11 pm

Re: Hotspot User API

Mon Sep 01, 2014 5:13 am

======================================
`radcheck`
======================================
username attribute op value
test Cleartext-Password := test

======================================
`radgroupreply`
======================================
groupname attribute op value
1mb Mikrotik-Rate-Limit := 512k/1M

======================================
`radgroupcheck`
======================================
groupname attribute op value
1mb Simultaneous-Use := 2

=======================================
`radusergroup`
=======================================
username groupname priority
test 1mb 0
=======================================


Ok I got it working now, These are configs I used incase anyone else had same
issues

Who is online

Users browsing this forum: No registered users and 21 guests