Community discussions

MikroTik App
 
firewallrule
Member Candidate
Member Candidate
Topic Author
Posts: 118
Joined: Tue Oct 13, 2009 9:23 pm

I need an alert on my Hotspot

Fri Oct 16, 2009 4:16 pm

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.
 
User avatar
m4rk0
Member Candidate
Member Candidate
Posts: 196
Joined: Sat Feb 16, 2008 8:30 pm
Location: BA
Contact:

Re: I need an alert on my Hotspot

Fri Oct 16, 2009 9:22 pm

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"
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: I need an alert on my Hotspot

Fri Oct 16, 2009 9:28 pm

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>
 
firewallrule
Member Candidate
Member Candidate
Topic Author
Posts: 118
Joined: Tue Oct 13, 2009 9:23 pm

Re: I need an alert on my Hotspot

Fri Oct 16, 2009 11:01 pm

Thanks for quick reply,

But am still expecting more
 
User avatar
m4rk0
Member Candidate
Member Candidate
Posts: 196
Joined: Sat Feb 16, 2008 8:30 pm
Location: BA
Contact:

Re: I need an alert on my Hotspot

Sat Oct 17, 2009 12:10 pm

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...
 
firewallrule
Member Candidate
Member Candidate
Topic Author
Posts: 118
Joined: Tue Oct 13, 2009 9:23 pm

Re: I need an alert on my Hotspot

Sat Oct 17, 2009 4:58 pm

@m4rk0 and all,

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

Thanks in advance
 
reinerotto
Long time Member
Long time Member
Posts: 520
Joined: Thu Dec 04, 2008 2:35 am

Re: I need an alert on my Hotspot

Fri Oct 23, 2009 1:42 pm


Almost impossible...

You can try some 'hacks' with: IP > Hotspot > User Profiles > "Advertise"
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.
 
spence
just joined
Posts: 7
Joined: Fri Jun 26, 2009 10:19 pm

Re: I need an alert on my Hotspot

Thu Feb 18, 2010 1:50 am

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)
<script type="text/javascript">

{
alert(Session is about to expire. You have one minute to save your progress!)
}
</script>
${endif}
 
spence
just joined
Posts: 7
Joined: Fri Jun 26, 2009 10:19 pm

Re: I need an alert on my Hotspot

Thu Feb 18, 2010 9:26 pm

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....
 
firewallrule
Member Candidate
Member Candidate
Topic Author
Posts: 118
Joined: Tue Oct 13, 2009 9:23 pm

Re: I need an alert on my Hotspot

Tue Feb 23, 2010 7:20 pm

@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?
 
User avatar
JP_Wireless
Member Candidate
Member Candidate
Posts: 276
Joined: Thu Dec 13, 2007 4:31 pm
Location: Lagos Nigeria
Contact:

Re: I need an alert on my Hotspot

Fri Mar 26, 2010 9:31 pm

@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.
 
monkeymagic
just joined
Posts: 1
Joined: Sun Dec 12, 2010 8:36 am

Re: I need an alert on my Hotspot

Sun Dec 12, 2010 8:52 am

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.
 
firewallrule
Member Candidate
Member Candidate
Topic Author
Posts: 118
Joined: Tue Oct 13, 2009 9:23 pm

Re: I need an alert on my Hotspot

Mon Mar 14, 2011 5:07 pm

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
 
happydaddy
Member Candidate
Member Candidate
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Re: I need an alert on my Hotspot

Mon Mar 14, 2011 7:40 pm

My Hotspot shows the time remaining as a pop up. Just enable pop ups in Firefox.
 
firewallrule
Member Candidate
Member Candidate
Topic Author
Posts: 118
Joined: Tue Oct 13, 2009 9:23 pm

Re: I need an alert on my Hotspot

Tue Mar 15, 2011 2:48 pm

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?
 
happydaddy
Member Candidate
Member Candidate
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Re: I need an alert on my Hotspot

Tue Mar 15, 2011 10:15 pm

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.
 
User avatar
JP_Wireless
Member Candidate
Member Candidate
Posts: 276
Joined: Thu Dec 13, 2007 4:31 pm
Location: Lagos Nigeria
Contact:

Re: I need an alert on my Hotspot

Sun Mar 20, 2011 11:20 pm

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 :shock: :o :(
 
happydaddy
Member Candidate
Member Candidate
Posts: 145
Joined: Thu May 24, 2007 12:18 am

Re: I need an alert on my Hotspot

Mon Mar 21, 2011 10:45 am

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.

Image


followed this example to setup

http://wiki.mikrotik.com/wiki/User_Mana ... ot_Example

Used firefox and disabled popups in the tools-options-content menu
 
User avatar
JP_Wireless
Member Candidate
Member Candidate
Posts: 276
Joined: Thu Dec 13, 2007 4:31 pm
Location: Lagos Nigeria
Contact:

Re: I need an alert on my Hotspot

Sun Jun 05, 2011 10:14 am

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.

Image


followed this example to setup

http://wiki.mikrotik.com/wiki/User_Mana ... ot_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?

Who is online

Users browsing this forum: No registered users and 8 guests