Page 1 of 1

hotspot status page

Posted: Sat Feb 15, 2014 12:31 pm
by obadaabdullah
Hi all
i have Mikrotik RB V6.7, i have hotspot with username and password
what is the parameter that i can but in the status page to let users know their total bytes remaining (limit total bytes - (bytes in + bytes out ))???
i'v tried many things but they all useless
pleas help

Re: hotspot status page

Posted: Sat Feb 15, 2014 3:18 pm
by SurferTim
The variables I think you want are $(remain-bytes-in) and $(remain-bytes-out).

Read the section about traffic counters here:
http://wiki.mikrotik.com/wiki/Manual:Cu ... _variables

Re: hotspot status page

Posted: Sun Feb 23, 2014 10:05 pm
by obadaabdullah
The variables I think you want are $(remain-bytes-in) and $(remain-bytes-out).

Read the section about traffic counters here:
http://wiki.mikrotik.com/wiki/Manual:Cu ... _variables

thank v.much
is their any way to make this variables in MB ??

Re: hotspot status page

Posted: Tue Mar 04, 2014 8:43 pm
by obadaabdullah
The variables I think you want are $(remain-bytes-in) and $(remain-bytes-out).

Read the section about traffic counters here:
http://wiki.mikrotik.com/wiki/Manual:Cu ... _variables

thank v.much
is their any way to make this variables in MB ??

thanks again i found it

Re: hotspot status page

Posted: Wed Oct 29, 2014 8:28 am
by EllyJr
Hi,

I have a similar issue and I have tried the above I still get the NaN undefined.

I am using RouterBoard 2011UiAS-2HnD.

Please assist.

Re: hotspot status page

Posted: Tue Jan 19, 2016 5:45 am
by corkuck
Hi,

I have a similar issue and I have tried the above I still get the NaN undefined.

I am using RouterBoard 2011UiAS-2HnD.

Please assist.

So I struggled with
NaN (Not A Number) when trying the following:
remain-bytes-in
remain-bytes-out
limit-bytes-in
limit-bytes-out

I got nothing/NaN/ not defined/showed nothing out at all.

For days this was KILLING ME........... then I found out this. So I have to share. It needs posted all over. So many of us that have or are struggled with this can be over. Works great once you do what's shown below, for the above variables shown to work.

Using your WAN IP address:
http://<WAN IP-Adds>/userman
Login:
Password:
Click Routers
Click on your router name
Click on down arrow of Radius incomming
Uncheck the CoA support: X Use CoA
It's a BOX that needs unchecked
Click Save
Click Logout
Reboot your router. The change of CoA will not take place or work unless you reboot.

It's my understanding that, with CoA checked, the User Manager sends out, nothing or zeros, for the above variables until you uncheck CoA. and reboot the router.

Good Luck so glad I'm passed this one, on to the next. What a great product........

Happy Mikrotik,,ing

/rk

Re: hotspot status page

Posted: Sun Jan 24, 2016 1:29 pm
by lectrapon
Try this in the head tag of your status html :
<script language="JavaScript">
<!--
var tl;
tl = $(limit-bytes-total) - $(bytes-total);

function readablizeBytes(bytes) {
var s = ['octets', 'ko', 'Mo', 'Go', 'To', 'Po'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}

$(if advert-pending == 'yes')
    var popup = '';
    function focusAdvert() {
	if (window.focus) popup.focus();
    }
    function openAdvert() {
	popup = open('$(link-advert)', 'hotspot_advert', '');
	setTimeout("focusAdvert()", 1000);
    }
$(endif)
    function openLogout() {
	if (window.name != 'hotspot_status') return true;
        open('$(link-logout)', 'hotspot_logout', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=1,width=280,height=250');
	window.close();
	return false;
    }
//-->
</script>
and then put this in body of your status html :
<form action="$(link-logout)" name="logout" onSubmit="return openLogout()">
<table border="1" class="tabula">
$(if login-by == 'trial')
	<br><div style="text-align: center;">Bienvenu Utilisateur test!</div><br>
$(elif login-by != 'mac')
	<br><div style="text-align: center;">Bienvenu $(username)!</div><br>
$(endif)
	<tr><td align="right">Address IP:</td><td>$(ip)</td></tr>
	<tr><td align="right">débits montants / descendants:</td><td>$(bytes-in-nice) / $(bytes-out-nice)</td></tr>
$(if session-time-left)
	<tr><td align="right">connecté depuis / temps restant:</td><td>$(uptime) / $(session-time-left)</td></tr>
$(else)
	<tr><td align="right">connecté:</td><td>$(uptime)</td></tr>
$(endif)
$(if blocked == 'yes')
	<tr><td align="right">statut:</td><td><div style="color: #FF8080">
<a href="$(link-advert)" target="hotspot_advert">advertisement</a> required</div></td>
$(if limit-bytes-total)
	$(elif refresh-timeout)
		<tr style="color:#FF0000"><td align="right">débits restant</td><td><script language="JavaScript">
	document.write(readablizeBytes(tl));
	</script></td></tr>
	$(endif)
$(endif)
</table>
$(if login-by-mac != 'yes')
<br>
<!-- user manager link. if user manager resides on other router, replace $(hostname) by its address
<button onclick="document.location='http://$(hostname)/user?subs='; return false;">status</button>
<!-- end of user manager link -->
<input type="submit" value="déconnecter">
$(endif)
</form>

Re: hotspot status page

Posted: Tue Mar 01, 2016 7:09 pm
by jauza
I have tried this method but no improvement can you please write complete status page or explain me in detail. thanks in advance

Re: hotspot status page

Posted: Tue Mar 01, 2016 7:13 pm
by jauza
<html>
<head>
<script language="JavaScript">
<!--
var tl;
tl = $(limit-bytes-total) - $(bytes-total);

function readablizeBytes(bytes) {
var s = ['octets', 'ko', 'Mo', 'Go', 'To', 'Po'];
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}

$(if advert-pending == 'yes')
var popup = '';
function focusAdvert() {
if (window.focus) popup.focus();
}
function openAdvert() {
popup = open('$(link-advert)', 'hotspot_advert', '');
setTimeout("focusAdvert()", 1000);
}
$(endif)
function openLogout() {
if (window.name != 'hotspot_status') return true;
open('$(link-logout)', 'hotspot_logout', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=1,width=280,height=250');
window.close();
return false;
}
//-->
</script>

</head>

<body bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0"
$(if advert-pending == 'yes')
onLoad="openAdvert()"
$(endif)
>
<table width="100%" height="100%">

<tr>
<td align="center" valign="middle">
<form action="$(link-logout)" name="logout" onSubmit="return openLogout()">
<table border="1" class="tabula">
$(if login-by == 'trial')
<br><div style="text-align: center;">Bienvenu Utilisateur test!</div><br>
$(elif login-by != 'mac')
<br><div style="text-align: center;">Bienvenu $(username)!</div><br>
$(endif)
<tr><td align="right">Address IP:</td><td>$(ip)</td></tr>
<tr><td align="right">débits montants / descendants:</td><td>$(bytes-in-nice) / $(bytes-out-nice)</td></tr>
$(if session-time-left)
<tr><td align="right">connecté depuis / temps restant:</td><td>$(uptime) / $(session-time-left)</td></tr>
$(else)
<tr><td align="right">connecté:</td><td>$(uptime)</td></tr>
$(endif)
$(if blocked == 'yes')
<tr><td align="right">statut:</td><td><div style="color: #FF8080">
<a href="$(link-advert)" target="hotspot_advert">advertisement</a> required</div></td>
$(if limit-bytes-total)
$(elif refresh-timeout)
<tr style="color:#FF0000"><td align="right">débits restant</td><td><script language="JavaScript">
document.write(readablizeBytes(tl));
</script></td></tr>
$(endif)
$(endif)
</table>
$(if login-by-mac != 'yes')
<br>
<!-- user manager link. if user manager resides on other router, replace $(hostname) by its address
<button onclick="document.location='http://$(hostname)/user?subs='; return false;">status</button>
<!-- end of user manager link -->
<input type="submit" value="déconnecter">
$(endif)
</form>

</td>
</table>
</body>
</html>

Re: hotspot status page

Posted: Tue Mar 01, 2016 8:22 pm
by lectrapon
I have tried this method but no improvement can you please write complete status page or explain me in detail. thanks in advance
<html>
<head>
<script language="JavaScript">
<!--
var tl;
tl = $(limit-bytes-total) - $(bytes-total);

function readablizeBytes(bytes) {
//French values of data unit ('Bytes', 'kB', 'MB', 'GB', 'TB', 'PB')
var s = ['octets', 'ko', 'Mo', 'Go', 'To', 'Po'];
//Convertion method for displaying 
var e = Math.floor(Math.log(bytes)/Math.log(1024));
return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}

$(if advert-pending == 'yes')
    var popup = '';
    function focusAdvert() {
   if (window.focus) popup.focus();
    }
    function openAdvert() {
   popup = open('$(link-advert)', 'hotspot_advert', '');
   setTimeout("focusAdvert()", 1000);
    }
$(endif)
    function openLogout() {
   if (window.name != 'hotspot_status') return true;
        open('$(link-logout)', 'hotspot_logout', 'toolbar=0,location=0,directories=0,status=0,menubars=0,resizable=1,width=280,height=250');
   window.close();
   return false;
    }
//-->
</script>
</head>

<boby>
<form action="$(link-logout)" name="logout" onSubmit="return openLogout()">
<table border="1" class="tabula">
$(if login-by == 'trial')
//French welcome message when user TEST login
   <br><div style="text-align: center;">Bienvenu Utilisateur test!</div><br>
$(elif login-by != 'mac')
//French welcome message when users login
   <br><div style="text-align: center;">Bienvenu $(username)!</div><br>
$(endif)
   <tr><td align="right">Adresse IP:</td><td>$(ip)</td></tr>
   <tr><td align="right">débits montants / descendants:</td><td>$(bytes-in-nice) / $(bytes-out-nice)</td></tr>
$(if session-time-left)
   <tr><td align="right">connecté depuis / temps restant:</td><td>$(uptime) / $(session-time-left)</td></tr>
$(else)
   <tr><td align="right">connecté:</td><td>$(uptime)</td></tr>
$(endif)
$(if blocked == 'yes')
   <tr><td align="right">statut:</td><td><div style="color: #FF8080">
<a href="$(link-advert)" target="hotspot_advert">advertisement</a> required</div></td>
$(if limit-bytes-total)
   $(elif refresh-timeout)
      <tr style="color:#FF0000"><td align="right">débits restant</td><td><script language="JavaScript">
   document.write(readablizeBytes(tl));
   </script></td></tr>
   $(endif)
$(endif)
</table>
$(if login-by-mac != 'yes')
<br>
<!-- user manager link. if user manager resides on other router, replace $(hostname) by its address
<button onclick="document.location='http://$(hostname)/user?subs='; return false;">status</button>
<!-- end of user manager link -->
<input type="submit" value="déconnecter">
$(endif)
</form>
</boby>

</html>

Re: hotspot status page

Posted: Wed Mar 02, 2016 11:51 am
by jauza
dear i want to show user total usage from 1st day of every month (i have set reset counter last day of every month) but its only show session usage