Community discussions

MikroTik App
 
MBAGA
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 53
Joined: Fri Oct 03, 2014 1:07 pm

hotspot User Profile's on login script works only for first

Wed Dec 17, 2014 4:00 pm

Hi
i have a problem :
i have a hotspot User Profile with scripts on login / on logout which write info into the log but when a User with that User Profile logged in , only if it is the first User Connected the on login script works , while the on logout script always works
Shared users are 300.

So i have this situation :
- No active users
- User1 (with this User Profile) logged in
- the on login script writes login's info about User1 into the log
- 1 active user
- User2 (with this User Profile) logged in
- the on login script DOESN'T write login's info about User1 into the log (DOESN'T WORK)
- 2 active users
- User2 logged out
- the on logout script writes logout's info about User2 into the log
- 1 active user
- User1 logged out
- the on logout script writes logout's info about User1 into the log
- No active users

I MUST always get this on login / on logout info Because this info Contain IP/MAC and the correct on login / on logout date-time

It would be even better if i could get the Users' IP/MAC and the correct on login / on logout date-time with PHP ...

My ROS is 5.6 but i'd rather don't update it , if possible ...

Thanks
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: hotspot User Profile's on login script works only for fi

Wed Dec 17, 2014 4:37 pm

Sounds like a RouterOS bug, and I wouldn't be surprised if it's already fixed in 6.23 if not even earlier.

Perhaps you could set up a "lab" in which you can try if the new version has fixed this? I mean, I realize it's risky to just "blindly" upgrade, but this would let you try out the new without much of a risk.

To do this, install GNS3 and perhaps VirtualBox.
Then install RouterOS 6.23 on a virtual machine, and install another two VMs for test clients.
Set up the RouterOS VM to have settings as your current router, with scripts and everything.
Then try to connect with both clients to see if the issue still persists.

Even if it does persist, this exercise would enable you to prepare in advance for any migration issues you'll have once the issue is fixed later (because MikroTik are surely not going to fix it in the 5.* branch, so an upgrade is inevitable).
 
gszpiniak
just joined
Posts: 16
Joined: Mon Oct 25, 2010 9:52 pm
Location: Barcelona

Re: hotspot User Profile's on login script works only for fi

Wed Jan 21, 2015 2:25 pm

Hello,

I have the same problem.
I add script on-login and on-logout to write info log but is only work for the first user on login. The script on logout doen't work at all.

The on-login scritp is:
:log info message=("LogIN: ".[/system identity get name].";$user;".[/ip hotspot active get [find user=$user] mac-address].";".[/ip hotspot active get [find user=$user] address]);
The on-logout scritp is:
:log info message=("LogOUT: ".[/system identity get name].";$user;".[/ip hotspot active get [find user=$user] mac-address].";".[/ip hotspot active get [find user=$user] address]);
I upgraded to the last RouterOS v.6.25 but the problem still the same.
Any idea or work arround to solve this issue??

I appreciate any help.

Thank you.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: hotspot User Profile's on login script works only for fi

Wed Jan 21, 2015 2:37 pm

I suggest you write to support then.
 
gszpiniak
just joined
Posts: 16
Joined: Mon Oct 25, 2010 9:52 pm
Location: Barcelona

Re: hotspot User Profile's on login script works only for fi

Fri Jan 23, 2015 2:13 pm

Issue solved!

Despite $user is an internal variable I have to declare a local variable to work with it.

Script On-Login:
local a $user
:log info message=("LogIN: ".[/system identity get name].";$a;".[/ip hotspot active get [find user=$a] mac-address].";".[/ip hotspot active get [find user=$a] address]);
Script On-Logout:
:log info message=("LogOUT $user")
The script On-Logout can't show more info about the user because the script is executated after logout, so variables like mac-address or address are no longer avaiable.

Hope this helps to someone else.
 
chshahzadnasir
newbie
Posts: 27
Joined: Sat Nov 05, 2016 8:26 pm
Location: Pakistan
Contact:

Re: hotspot User Profile's on login script works only for first

Mon Dec 19, 2016 9:57 am

How to auto fix user mac on first time login in Hotspot Just like a user manager option