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(); ?>
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@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
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@lists.freeradius .org [mailto:freeradius-users-bounces+radiussupport=lrcommunications.net@lists.fr eeradius.org] On Behalf Of tnt@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@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
hi ivan thank you for your reply it tried this : $requet = "SELECT COUNT(*) FROM radcheck WHERE AcctStopTime=0"; $login_users = $requet and $login_users = SELECT COUNT(*) FROM radcheck WHERE AcctStopTime=0; still 0 , what im doing wrong?
You need to be querying to radacct table - that is where you would find information on sessions. radcheck is generally only the static data regarding the users on your system. regards Graham Beneke Mordor Networks wrote:
hi ivan thank you for your reply it tried this : $requet = "SELECT COUNT(*) FROM radcheck WHERE AcctStopTime=0"; $login_users = $requet and
$login_users = SELECT COUNT(*) FROM radcheck WHERE AcctStopTime=0; still 0 , what im doing wrong? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
hi Graham yes sir i know but my question is how to do that im all new to all this.. thank you
Mordor Networks wrote:
hi Graham yes sir i know but my question is how to do that im all new to all this.. thank you
Connect to your mysql database and type "show tables;", then you'll see a list of tables in your database. It's probably the "radacct" table you need to query for session information. If you don't know how to write SQL queries, have a look at http://www.mysql.org/doc/ Thor.
Thor Spruyt wrote:
Mordor Networks wrote:
hi Graham yes sir i know but my question is how to do that im all new to all this.. thank you
Connect to your mysql database and type "show tables;", then you'll see a list of tables in your database. It's probably the "radacct" table you need to query for session information. If you don't know how to write SQL queries, have a look at http://www.mysql.org/doc/
Thor.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Thanks for your info , i fixed the issue with this : $request = "SELECT COUNT(*) FROM radacct WHERE AcctStopTime=0"; $res = mysql_query($request); while( $row = mysql_fetch_array($res) ) { $login_users = $row[0]; } print $row[0];
participants (5)
-
Alex M -
Graham Beneke -
Mordor Networks -
Thor Spruyt -
tnt@kalik.co.yu