I need an alert on my Hotspot

Hi all,

I need help urgently.
Am running a hotspot service in my cafe and my customers are complaining bitter that they don’t know when their time is about to finish for them to round up their job.

So, how can i configure the hotspot to ALERT users once their uptime limit is below 5minutes? and an option for them to recharge or add additional credit unit to the existing one before the hotspot log them Out.

Almost impossible…

You can try some ‘hacks’ with: IP > Hotspot > User Profiles > “Advertise”

Or, if your users can be convinced to keep the status page open, use that coupled with JavaScript to show alert boxes. Below some basic HTML that should achieve that (not particularly tested, and I’m not particularly good with JS):

<html>
<head>
<meta http-equiv="refresh" content="300">
<script language="JavaScript">
<!--
function calculateSecondsLeft(timeLeft) {
	regex = /^(\d+d)?(\d+h)?(\d+m)?(\d+s)?$/;
	result = regex.exec(timeLeft);
	secondsLeft = 0;
	for(index = 1; index <= 4; index++) {
		if(result[index]) {
			regex = /^(\d+)[dhms]$/;
			parts = regex.exec(result[index]);
			numericPart = parts[1];
			switch(index) {
				case 1:
					secondsLeft += numericPart * 86400;
					break;
				case 2:
					secondsLeft += numericPart * 3600;
					break;
				case 3:
					secondsLeft += numericPart * 60;
					break;
				case 4:
					secondsLeft += numericPart * 1;
			}
		}
	}
	if(secondsLeft < 600) {
		alert("You have less than 10 minutes left on your account!");
	}
}
//-->
</script>
</head>
<body onLoad="calculateSecondsLeft('$(session-timeout)')">
Time left: $(session-timeout)
</body>
</html>

Thanks for quick reply,

But am still expecting more

Other option is to create some tiny application which uses MikroTik API and check for user status…
And offer that application on Your HotSpot login page…

@m4rk0 and all,

I’m not good in writing script.
Can you help me in writing that application script?

Thanks in advance

I do not think, this might work. Because ads are displayed only in pre-defined cycles. And changes to the ads-cycle are only recognized after log-out of the user.

has a solution been found? please pass it along if so

I have tried this along with other things but no luck
$(if uptime-secs < 60)

${endif}

function alertUser()
{
var timeLeft = Number($(session-time-left-secs))

if (timeLeft < 60)
{
alert("Your session is about to expire. You have one minute to save your progress!")
}

}

then you can either put that in the body tag as onload=“alertUser()” or use this in the head tag

window.onbeforeunload = alertUser

hope this helps someone…

@spence

Code:
function alertUser()
{
var timeLeft = Number($(session-time-left-secs))

if (timeLeft < 60)
{
alert(“Your session is about to expire. You have one minute to save your progress!”)
}

}

then you can either put that in the body tag as onload=“alertUser()” or use this in the head tag
Code:
window.onbeforeunload = alertUser

Can you please combine the codes together for easy understanding.

And where am i suppose to paste the code?

Any progress so far? how can these codes be combine and where is it going to be pasted or written to? Command line? System/scrpit? help pls.

this can be done if status.html not closed by hotspot user.
you can modified the status.html, each time status.html refreshed, check “session-time-left-secs”
if “session-time-left-secs” less than your threshold, display an alert using javascript.

Please, good moderation is highly needed.

instruction on how to make mikrotik pop up the alert is highly welcome

My Hotspot shows the time remaining as a pop up. Just enable pop ups in Firefox.

how did u do ur configuration? can u past it here for use?

Is it possible for hotspot users to add more time b4 terminating their access?

I just used the normal hotspot + usermanager setup in mikrotik. They cannot add time them self they have to go to the cashier to add credits.

this is what we all are using and none is getting head way as to the pop up comming up when time left is certain level set! Can you give more details regarding your setup?

I have set up over 20 hotspot and managing them currently and all require this feature.

Is mikrotik actually concerned about our request most time? This topic has been on running to two years now but nothing is said nor done about it by Mikrotik Moderator :open_mouth: :astonished: :frowning:

Sorry guys had a look at the hotspot i created for a customer and It only displays the notifier all the time and not as requested when it reach last 5 minutes.




followed this example to setup

http://wiki.mikrotik.com/wiki/User_Manager/Hotspot_Example

Used firefox and disabled popups in the tools-options-content menu

Does the status page remains on top of all webpages as one browse the internet? What I can see is, it either go to the background while checking other pages or minimised and the users might not be mindfull of the time running and all of a sudden get disconected before they go to check. This is what we are trying to avoid, being disconected at the middle of an important transaction, message or filling form.

Did you do any thing extra from the normal status page that pop up upon login in?