Community discussions

MikroTik App
 
jjer
just joined
Topic Author
Posts: 4
Joined: Tue Mar 04, 2014 6:29 pm

Allow multiple devices per user but not simultaneous

Tue Mar 04, 2014 6:48 pm

Hi,

This is my first post in MT forum so you can imagine I'm a little bit new on this. I hope you can help me to do this script.

We offer internet access with a Hotspot validating users via external RADIUS. We want to limit only one connection at the same time per user but we want users to be able to connect as many devices as they want "without logging out".

(f.e) Imagine that our user is in a hotel and has a laptop and a mobile device. When he decides to use the mobile, he should be able to logging in introducing user and password, logging out the laptop automatically.

Is that possible with PHP API? What should be best way to do it?

Regards.
 
User avatar
aacable
Member
Member
Posts: 435
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: Allow multiple devices per user but not simultaneous

Thu Mar 06, 2014 7:59 pm

you can try this [add it in hotspot user profile ON LOGIN SCRIPT]

it will automatically remove first logged in user automatically , if the same id is logged in from 2nd computer.
:local uname $user;
:local usercount 0;
:local usertime "00:00:00";
:local kickable;
:local maxuser 2;

:foreach i in=[/ip hotspot active find user=$uname] do= {
  :local curup [/ip hotspot active get $i uptime];
  :if ( $curup > $usertime ) do={
        :set usertime $curup;
        :set kickable $i;
   }
  :set usercount ($usercount+1);
}
:if ($usercount >= $maxuser) do={
  :log info "Login user: $uname ($usercount/$maxuser) - Oldest $usertime will be logout!";
  /ip hotspot active remove numbers=$kickable;
} else {
   :log info "Login user: $uname ($usercount/$maxuser)";
}
posted here first.
http://forum.mikrotik.com/viewtopic.php?f=2&t=64443
 
jjer
just joined
Topic Author
Posts: 4
Joined: Tue Mar 04, 2014 6:29 pm

Re: Allow multiple devices per user but not simultaneous

Tue Mar 11, 2014 1:13 pm

Thank you so much, I will try it and tell you.

Regards
 
SurferTim
Forum Guru
Forum Guru
Posts: 4636
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: Allow multiple devices per user but not simultaneous

Tue Mar 11, 2014 1:28 pm

From previous experience, this will cause a "login war" between clients and complaints to you. Best to deny second login attempt with RADIUS.

Imagine Dad and Mom in the living room logged in and watching a Netflix movie. Just as the movie reaches its climax, Junior in the bedroom connects and logs in so he can Twitter with his girlfriend, disconnecting Dad and Mom, and ruining the movie. Let the complaints begin!

Just a thought...
 
User avatar
aacable
Member
Member
Posts: 435
Joined: Wed Sep 17, 2008 11:58 am
Location: ISLAMIC Republic of PAKISTAN
Contact:

Re: Allow multiple devices per user but not simultaneous

Wed Mar 12, 2014 10:06 am

From previous experience, this will cause a "login war" between clients and complaints to you. Best to deny second login attempt with RADIUS.
Imagine Dad and Mom in the living room logged in and watching a Netflix movie. Just as the movie reaches its climax, Junior in the bedroom connects and logs in so he can Twitter with his girlfriend, disconnecting Dad and Mom, and ruining the movie. Let the complaints begin!
Just a thought...
hahahaha nice one ;) :lol:
 
dana1975
Frequent Visitor
Frequent Visitor
Posts: 94
Joined: Sat Jul 04, 2009 8:32 pm

Re: Allow multiple devices per user but not simultaneous

Mon Apr 20, 2015 7:46 am

what happen when we use radius (i mean windows 2008 active directory or NPS) ??? because the user profile can not be assign to these radius users

Who is online

Users browsing this forum: No registered users and 11 guests