DoubleD Posted July 18, 2022 Report Share Posted July 18, 2022 Здравейте, Мъча се тук да менажирам хотспот юзери без юзер-менажер.. та, ето скрипта и проблема: /ip hotspot :foreach i in=[user find where name!="admin" and name!="default-trial" and disabled=no] do={ :global EpochTime; :local epoch [$EpochTime]; :local ts [user get $i comment]; :local user [user get $i name]; :if ($ts!="") do={ :local ts1 [:tonum $ts]; :log info "DEBUG User: $user, Expires: $ts1, Epoch: $epoch" :if ($epoch >= $ts1) do={ :log info "EXPIRED user: $user, Expires: $ts1, Epoch: $epoch" user disable $i cookie remove [find where user=$user] active remove [find where user=$user] } } else={ :log info "Checked user: $user, Expires: $ts1, Epoch: $epoch" } } Проблема идва при викането на: cookie remove [find where user=$user] active remove [find where user=$user] В случая - вместо да премахнат active и cookie само юзера за който ги "викам" - махат всички. Някакви идеи? Поздрави, Д Link to comment Share on other sites More sharing options...
byte Posted July 18, 2022 Report Share Posted July 18, 2022 Това в лог-а какво ти вади ? :log info "EXPIRED user: $user, Expires: $ts1, Epoch: $epoch" Link to comment Share on other sites More sharing options...
DoubleD Posted July 18, 2022 Author Report Share Posted July 18, 2022 (edited) 5 hours ago, byte said: Това в лог-а какво ти вади ? :log info "EXPIRED user: $user, Expires: $ts1, Epoch: $epoch" :log info "EXPIRED user: $user, Expires: $ts1, Epoch: $epoch" В това лога си е ок, юзера си е там, всичко си е там. Disable работи, след него cookie и active - не работят, т.е. трият за всички юзери, не само за текущия. Пробвах да ги сложа и преди user disable $i, но същата работа. В лога диркетно виждам 500 реда "item removed by admin" (за кукитата), следвано от 500 реда "User-X (IP-ADDR): logged out: admin reset" Ако махна куки/актив - всичко ок, disable-ва само юзерите които са експайрнали, но не ги kick-ва (поради което опитвам да ги махна ръчно) Предполагам това е нещо като (bug)Feature за да ни накарат да ползваме User-Manager, за който за да имаш повече от 50 онлайн сесии.. трябва да изсипеш 200$ / рутер. F that.. Edited July 18, 2022 by DoubleD Link to comment Share on other sites More sharing options...
byte Posted July 19, 2022 Report Share Posted July 19, 2022 [find where user=$user] - явно връща винаги 0 Ако стане [/ip hotspot active find where user=$user] Link to comment Share on other sites More sharing options...
DoubleD Posted July 20, 2022 Author Report Share Posted July 20, 2022 (edited) On 7/19/2022 at 9:57 AM, byte said: [find where user=$user] - явно връща винаги 0 Ако стане [/ip hotspot active find where user=$user] Скрипта не run-ва така ... Пробвах и: cookie remove numbers=[find where user=$user] active remove numbers=[find where user=$user] Пак махна всички..... Edited July 20, 2022 by DoubleD Link to comment Share on other sites More sharing options...
byte Posted July 20, 2022 Report Share Posted July 20, 2022 Изял съм малко /ip hotspot cookie remove [ /ip hotspot cookie find where user=$user] това работи при мен Link to comment Share on other sites More sharing options...
DoubleD Posted August 8, 2022 Author Report Share Posted August 8, 2022 проблема бил че ползвам като променлива $user а не трябвало ... user: $user Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now