Community discussions

MikroTik App
 
obadaabdullah
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 71
Joined: Wed Jan 08, 2014 7:41 pm

hotspot status page

Sat Feb 15, 2014 12:31 pm

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
 
SurferTim
Forum Guru
Forum Guru
Posts: 4637
Joined: Mon Jan 07, 2008 10:31 pm
Location: Miramar Beach, Florida

Re: hotspot status page

Sat Feb 15, 2014 3:18 pm

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
 
obadaabdullah
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 71
Joined: Wed Jan 08, 2014 7:41 pm

Re: hotspot status page

Sun Feb 23, 2014 10:05 pm

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 ??
 
obadaabdullah
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 71
Joined: Wed Jan 08, 2014 7:41 pm

Re: hotspot status page

Tue Mar 04, 2014 8:43 pm

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
 
EllyJr
just joined
Posts: 4
Joined: Tue Oct 15, 2013 3:34 pm

Re: hotspot status page

Wed Oct 29, 2014 8:28 am

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.
 
corkuck
just joined
Posts: 18
Joined: Wed Jan 22, 2014 9:06 pm

Re: hotspot status page

Tue Jan 19, 2016 5:45 am

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
 
User avatar
lectrapon
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Tue Mar 03, 2015 2:10 pm

Re: hotspot status page

Sun Jan 24, 2016 1:29 pm

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>
 
jauza
just joined
Posts: 10
Joined: Sun Feb 16, 2014 7:24 pm

Re: hotspot status page

Tue Mar 01, 2016 7:09 pm

I have tried this method but no improvement can you please write complete status page or explain me in detail. thanks in advance
 
jauza
just joined
Posts: 10
Joined: Sun Feb 16, 2014 7:24 pm

Re: hotspot status page

Tue Mar 01, 2016 7:13 pm

<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>
You do not have the required permissions to view the files attached to this post.
 
User avatar
lectrapon
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Tue Mar 03, 2015 2:10 pm

Re: hotspot status page

Tue Mar 01, 2016 8:22 pm

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>
 
jauza
just joined
Posts: 10
Joined: Sun Feb 16, 2014 7:24 pm

Re: hotspot status page

Wed Mar 02, 2016 11:51 am

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
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 14 guests