Community discussions

 
yan2x
just joined
Topic Author
Posts: 23
Joined: Sat Jun 14, 2014 2:28 am

Hotspot Script

Thu Aug 07, 2014 6:08 am

2 scripts 30 days and 7 days script...
can you help me where do i put the 30 Days or 7 Days on the script?
I'm poor on scripts...:((
It works with no 30 Days or 7 Days on the comment.

The script to add the date comment:
{
 :local date [ /system clock get date ]
 :if ( [ /ip hotspot user get $user comment ] = "" ) do={
  [ /ip hotspot user set $user comment="$date 30 Days" Or "$date 7 Days" ]
 }
}
Script for 30 days or 7 days
{
 :local offset 30
 :global today

 {
  :local date [ /system clock get date ]
  :local montharray ( "jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec" )
  :local monthdays ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )
  :local days [ :pick $date 4 6 ]
  :local monthtxt [ :pick $date 0 3 ]
  :local year [ :pick $date 7 11 ]
  :local months ([ :find $montharray $monthtxt]  )
  :for nodays from=0 to=$months do={
   :set days ( $days + [ :pick $monthdays $nodays ] )
  }
  :set days ($days + $year * 365) 
  :set today $days
 }

 :foreach i in [ /ip hotspot user find where disabled=no ] do={
  :if ([ :find [ /ip hotspot user get $i comment ] ] = 0 ) do={
   :local date [ /ip hotspot user get $i comment ]
   :local montharray ( "jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec" )
   :local monthdays ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 )
   :local days [ :pick $date 4 6 ]
   :local monthtxt [ :pick $date 0 3 ]
   :local year [ :pick $date 7 11 ]
   :local months ( [ :find $montharray $monthtxt ] )
   :for nodays from=0 to=$months do={
    :set days ( $days + [ :pick $monthdays $nodays ] )
   }
   :set days ($days + $year * 365)
   :if ( ($days + $offset) < $today ) do={ 
    :local name [/ip hotspot user get $i name]
    :log info "HOTSPOT EXPIRE SCRIPT: Disabling Hotspot user $name first logged in $date"
    [ /ip hotspot user disable $i ]
:foreach i in=[/ip hotspot user find disabled=yes] do={/ip hotspot active remove [find user=[/ip hotspot user get $i name]]}
   }
  }
 }
}
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 2946
Joined: Tue Feb 25, 2014 12:49 pm
Location: Capalbio, Tuscany, Italy

Re: Hotspot Script

Thu Aug 07, 2014 5:27 pm

First of all must be fixed the first script:
{
 :local date value=[/system clock get value-name=date];
 :if ( ([/ip hotspot user get $user value-name=comment]."") = "" ) do={
  /ip hotspot user set $user comment=$date;
 }
}
But, after I fix it, I notice which I do not understand what you want to do... is one mess...

Ignoring the script: what you want to do exactly?
Probably some function already exist inside RouterOS without do any script!
I'm Italian, not English. Sorry for my imperfect grammar.
 
yan2x
just joined
Topic Author
Posts: 23
Joined: Sat Jun 14, 2014 2:28 am

Re: Hotspot Script

Thu Aug 07, 2014 11:34 pm

I want to put 30 days and 7 days validity on user account...
For example 1 customer purchase 7 days account and other customer purchase 30 days account if i run that script with 7 days offset the 30 days customer will be deactivated also....:(
I dont want to use userman because there's a bug on at first logon and till time always unknown until i reboot the router...
I'm using v6.18

that's why i want to put additional 30 days on the comment or 7 days.
My question is where do i put the additional 30 days comment on the 2nd script so that if i run the script only 30 days user account will be deactivated...
 
yan2x
just joined
Topic Author
Posts: 23
Joined: Sat Jun 14, 2014 2:28 am

Re: Hotspot Script

Mon Aug 11, 2014 1:05 am

Anybody? Pls help me... :(
 
kraker
Frequent Visitor
Frequent Visitor
Posts: 88
Joined: Thu Aug 02, 2012 9:34 am

Re: Hotspot Script

Tue Aug 12, 2014 1:38 pm

same issue...Anybody help us?
 
yan2x
just joined
Topic Author
Posts: 23
Joined: Sat Jun 14, 2014 2:28 am

Re: Hotspot Script

Sun Aug 24, 2014 2:31 am

Hello? Pls help....:(
 
nonac
newbie
Posts: 27
Joined: Tue Sep 02, 2014 7:36 pm

Re: Hotspot Script

Sun Oct 05, 2014 12:41 pm

mt support pls
 
Matellito
just joined
Posts: 4
Joined: Fri Sep 14, 2012 5:02 am

Re: Hotspot Script

Thu Dec 15, 2016 1:10 am

I have a public hotspot configured like this:
1 user only with user and password, in Limit Uptime I have configured 01:00:00 (1 hour), in the User tab

Profile and Shared users 25.

When xxxx users log in while the limit is not expired Up:00 01:00:00 everything works fine, the problem

Is if other users want to log in after finishing the Limit Uptime 01:00:00 no longer loguea, leaves the

Message "User XXXX has reached uptime limit. Open way to delete not the user but by IP or Mac of this one

User who ran out of Limit UpTime ?.

Who is online

Users browsing this forum: No registered users and 7 guests