Ip hotspot active user = Ip Bindings

Hi

I need a script that will make possible to resolve below problem

IP HOTSPOT ACTIVCE USER β†’ IP BINDINGS


If the user log in correctly with correct log in and a password in the hotspot HTML
it will automatically be transfered in IP BINDINGS place with the same address IP and address mac

heellllp me :slight_smile:

:foreach user in=[/ip hotspot active find] do={
    :local ip [/ip hotspot active get $user address];
    :local mac [/ip hotspot active get $user mac-address];
    :local username [/ip hotspot active get $user user];
    :foreach binding in=[/ip hotspot ip-binding find address=$ip] do={
        /ip hotspot ip-binding remove $binding;
        }
    /ip hotspot ip-binding add type=bypassed mac-address=$mac address=$ip comment=$username;
}

But you need to make sure, that DHCP server will give user the same IP all the time, otherwise he will be asked for password again if the IP changes.

You are crazy… Thanks Dasiu

This version will not ask password if the ip change any ip ok for same mac

:foreach user in=[/ip hotspot active find] do={
:local ip [/ip hotspot active get $user address];
:local mac [/ip hotspot active get $user mac-address];
:local username [/ip hotspot active get $user user];
:foreach binding in=[/ip hotspot ip-binding find address=$ip] do={
/ip hotspot ip-binding remove $binding;
}
/ip hotspot ip-binding add type=bypassed mac-address=$mac address=0.0.0.0 comment=$username;
}

why all of user active = ip binding. please change to only spesification user β†’ ip binding

thank u