online users

Alex M radiussupport at lrcommunications.net
Fri Apr 13 20:43:04 CEST 2007


Be careful with\ just SQL Count (*)
Some times NASes terminate local session without radius session termination
(ex: nas was powered off) in this case you may have some users who
technically logged in but that is not true! To avoid that you can select all
users in the interwal between Current time and CurentTime-X (where X is your
Idle logout time)

This one still not 100% accurate but it will trim off all old garbage.


-----Original Message-----
From:
freeradius-users-bounces+radiussupport=lrcommunications.net at lists.freeradius
.org
[mailto:freeradius-users-bounces+radiussupport=lrcommunications.net at lists.fr
eeradius.org] On Behalf Of tnt at kalik.co.yu
Sent: Friday, April 13, 2007 2:28 PM
To: FreeRadius users mailing list
Subject: Re: online users

SELECT COUNT(*) FROM radacct WHERE AcctStopTime=0

That will give you the number of currently logged in users (according to
the database).

Ivan Kalik
Kalik Informatika ISP

Dana 13/4/2007, "Mordor Networks" <mordor.networks at gmail.com> piše:

>i want to know how many user logged in mysql database/radius but it only
>show the number of user in my databse for example is says 61 logged out
>and 0 login
>so here is the problem
>//login users from//
>$login_users = ; < what i have to write here ? which table i have to query?
>
>how i can fix that ?
>if i change the number from 0 to 1 it show me one user online so their
>must be a way to fix it?
>heres the code :
>
><?php
>
>include ("include/Artichow/class/jpgraph.php");
>include ("include/Artichow/class/jpgraph_pie.php");
>include ("include/Artichow/class/jpgraph_pie3d.php");
>include_once ("class/Oreon.class.php");
>include_once ("phpradmin.conf.php");
>
>$oreon_db = new OreonDatabase($conf_pra["host"], $conf_pra["user"],
>$conf_pra["password"], $conf_pra["db"]);
>$table = "userinfo";
>
>//este si es valido
>$total_users_in_db = $oreon_db ->getTotalRowsInTable($table);
>//$total_users_in_db = 500;
>
>//login users from DB (SELECT COUNT(*) FROM radacct??;)
>$login_users = ;
>//logoff users total_users_in_db - login_users
>$logoff_users = ($total_users_in_db - $login_users);
>//percent
>$percent_login = ($login_users * 100 / $total_users_in_db);
>$percent_logoff = ( 100 - $percent_login );
>$data = array($percent_login,$percent_logoff);
>//$data = array(12,88);
>
>$graph = new PieGraph(350,170,"auto");
>$graph->SetShadow();
>//$graph->title->Set( $lang['pra_total_users_in_db']":"
$total_users_in_db);
>$graph->title->Set("Total users in Data Base: $total_users_in_db");
>
>$graph->title->SetFont(FF_FONT1,FS_BOLD);
>$p1 = new PiePlot3D($data);
>$p1->ExplodeSlice( 1);
>$p1->SetLabelType( "PIE_VALUE_ABS");
>$p1->SetSize(0.40);
>$p1->SetCenter(0.33);
>$p1->SetSliceColors(array('green','blue'));
>$p1->setLegends(array(
>"LogIN Users: $login_users",
>"LogOUT Users: $logoff_users",
>));
>
>$graph->Add($p1);
>$graph->Stroke();
>
>?>
>-
>List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html
>
>

- 
List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html





More information about the Freeradius-Users mailing list