API PHP commands to disable an user in HOTSpot

Hi

I am new in PHP API command, please I need an example to disable an user in HotSpot that login by MAC
Please let`s think that the MAC is 00:00:00:00:00.
Also I need to remove the MAC 00:00:00:00:00 in /ip hotspot host .

Could some one please send an example

Thanks

use same commands as in CLI

Sorry could you show me an example:

I have in my PHP-API program

$API->write(‘/ip/hotspot/host/print’);
But now I dont know how remove an user ( we loging by mac, so the name the user is for example 00:00:00:00:00)

Sorry for my question but I understand just a litter englis and thas why I ask for example

Best Regards

please tell, how you do that in CLI

Hi I will do the next in CLI

To disable:
ip hot use set [find name=00:02:55:BF:07:59] disable=yes
To enable
ip hot use set [find name=00:02:55:BF:07:59] disable=no
To remove
ip hot use remove [find name=00:02:55:BF:07:59]

I have seen some samples but I dont understan the las part (both cases enable/disable and remove ) when you refer to the .id , When I write my program in PHP, I dont have the .id ; so what exactly Do I have to put in my PHP program (Sorry my question I think that I dont understan for my english) If you could show me exactly what do I have to put in my PHP program I will really apreciate it.

about id: http://forum.mikrotik.com/t/api-acl-control/29390/7

so, you first execute

/ip/hotspot/user/print
=.proplist=.id
?name=00:02:55:BF:07:59

then

/ip/hotspot/user/set
=.id=your_id_here
?disabled=yes|no

and

/ip/hotspot/user/remove
=.id=your_id_here

Sorry ( I dont know how to say in englis closed, no smart,… but I dont get it. )

I will put in my PHP API program all these and in that same form:


/ip/hotspot/user/print
=.proplist=.id
?name=00:02:55:BF:07:59
/ip/hotspot/user/set
=.id=your_id_here What does mean “your_id_here”, I am doing a program to enable or disable any MAC, so now is
?disabled=yes

I am doing a program to enable or disable any MAC, so now is 00:02:55:BF:07:59 ,but then will be another so will be another MAC and another .id.. It is a program in PHP I want that work for any time just I put the any MAC

Iam really sorry to dont understand

I am asking because I am doing a aplication in PHP to disable or enable the MAC .. so my program will ask me .. introduce the MAC TO DISABLE, I will put the MAC, my program take these , put into a variable and the send the comands to the router to disable that MAC.

I hope that now I explain correctly.. Sorry again

so what’s problem?.. you send ‘/print’ command with any MAC you want, receive its .id, then do with it what you want: disable, remove, even change MAC =)

So. to get the .id I have to run the funtion read() and put into a variable what is sending the router , then send the command to disable/enable with that varibale,
If I am Ok.. please could you show me with all lines commands that i have to use (I am using the funtion that are in wiki.mikrotik.api ) please using that funtion. could you write me how to do that..
I am using $v_mac as the variable that have the MAC

\

<?php require('routeros_api.class.php'); $API = new routeros_api(); $API->debug = true; if ($API->connect('111.111.111.111', 'LOGIN', 'PASSWORD')) { $API->write('/ip/hotspot/user/print'); $API->write('=.proplist=.id'); $API->write('?name='.$v_mac); ...????????it is ok? THEN???? \ \ $API->disconnect(); } ?>

Thanks

at first,

$API->write(‘/ip/hotspot/user/print’, false);
$API->write(‘=.proplist=.id’, false);
$API->write(‘?name=’.$v_mac);


yes, it is as it should be

something like

$A = $API->read();
$A = $A[0];
$API->write(‘/ip/hotspot/user/set’, false);
$API->write(‘=.id=’.$A[‘.id’], false);
$API->write(‘=disabled=yes’);
$API->read();

Thks.. It is working

2 more things

1 ) One more question. I will use it to enable/disable, add/ remove user a lot of other things etc etc etc.., Do I have to be carefull with something, or waht will I could not do or waht command are possible to execute or which ones not..

  1. If I use a User Manager ..
    2.1 Could I use these API command to enable/disable user that are in User manager
    2.2 If I use User Manager DO I have to have the user in the User Manager and in each
    router too ?
    2.1 Does User Manager have a walled garden…like HotSpot
    2.1 Have a profile (to use diferentes Band with) to apli to diferents user

Best Regards




Best Regards

user manager doesn’t replace hotspot, it just is a visual interface for managing users OF HOTSPOT. the same walled garden is still used.

Please I did read about User Manager but In some place I read that I have to delete all configuration of the Hotspot in each router to be able to use the User Manager:

http://wiki.mikrotik.com/wiki/User_Manager/Hotspot_Example

  • Note, first local HotSpot database is consulted, then User Manager database.

It means that if you have configuration in ‘/ ip hotspot user print’, users will be able to authenticate in HotSpot using these data. Delete users configuration from ‘/ ip hotspot print’ to stop using local HotSpot database for authentication. To move batch of local HotSpot users to the User Manager database use export/import . Use text editor program to create appropriate file to import local users to the User Manager database.

Sorry I dont Understand, If I have to keep the local configuration of each user ( to be able to use the "advertising and script " that have the profile user. So How can I use the profile user If I cant say to each user in USERMANAGER what is its profile.
Even more.. If I want to create new User DO I have to creat in local Hotspot or in USERMANAGER or both.

Again I am sorry. Pease help me

this is only to help you migrate. you DO NOT HAVE TO create any users locally, you can make all users only in user manager

Hi Normis, and every one here.
Please i need some help on userman and hotspot is there a way i could make some users created on hotspot userman such that the name could only be active from 6pm till 7am the following day and then be disable from 7am till 6pm agin i.e they can only be use at night?