Hotspot on login script for counter and auto change image

Hi… This maybe a noob question but I need a hotspot on login script that will count how many logged in users, and every 1000 logged in users, login page image change according to my image list. And I need to keep counter in disk so when I need maintenance, the value remain after reboot. I’m using ROS 5.26. Any idea? Thanks :smiley:

This is possible… probably could be done a few ways.

Here is an example to get you started. Put this script in /ip hotspot user profile > On Login box. If you have multiple profiles, this would have to be put in all of them.

The “counter” is stored in the comment field of hotspot user “myUser” to survive reboots. This is could be changed to the comment field of any number of things. You could also save to file if you wanted.

The last few lines check if the count has reached a number, and then “uploads” via ftp a local file to overwrite the “myLogo.png” file.
:local count [:tonum [/ip hotspot user get [find name=“myUser”] comment]]
:local newCount ($count + 1)
/ip hotspot user set [find name=“myUser”] comment=$newCount

:if ($newCount = 1000) do={
/tool fetch address=127.0.0.1 mode=ftp upload=yes user=admin password=pass src-path=“/hotspot/img/logo1000.png” dst-path=“/hotspot/img/myLogo.png”
}
:if ($newCount = 2000) do={
/tool fetch address=127.0.0.1 mode=ftp upload=yes user=admin password=pass src-path=“/hotspot/img/logo2000.png” dst-path=“/hotspot/img/myLogo.png”
}In the long run, these :if statements won’t work because you would have to manually be always uploading new images and adding lines of code to check for the next multiple of 1000. There is probably some way to make this fully automated, depending on what you mean by “every 1000 logged in users, login page image change according to my image list”. Are you cycling through a number of images, or do you have separate images for every change of 1000?

thanks for the script and it works :smiley: