********************************************************************************************************* * Description: * this graph extension procduces a query of the overall logins * * Authors: Liran Tal <*****@*****.**> * ********************************************************************************************************* */ include 'checklogin.php'; $type = $_REQUEST['type']; if ($type == "daily") { daily(); } elseif ($type == "monthly") { monthly(); } elseif ($type == "yearly") { yearly(); } function daily() { include 'opendb.php'; include 'libchart/libchart.php'; header("Content-type: image/png"); $chart = new VerticalChart(680, 500); $sql = "SELECT count(AcctStartTime), DAY(AcctStartTime) AS Day from " . $configValues['CONFIG_DB_TBL_RADACCT'] . " group by Day;"; $res = $dbSocket->query($sql); while ($row = $res->fetchRow()) { $chart->addPoint(new Point("{$row['1']}", "{$row['0']}")); } $chart->setTitle("Distribución de ingresos por día"); $chart->render(); include 'closedb.php';
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ********************************************************************************************************* * Description: * this graph extension procduces a query of the alltime downloads made by all users on a daily, monthly and yearly basis. * * Authors: Liran Tal <*****@*****.**> * ********************************************************************************************************* */ if ($type == "daily") { daily($username, $orderBy, $orderType); } elseif ($type == "monthly") { monthly($username, $orderBy, $orderType); } elseif ($type == "yearly") { yearly($username, $orderBy, $orderType); } function daily($username, $orderBy, $orderType) { include 'opendb.php'; $sql = "SELECT sum(AcctOutputOctets) as Downloads, day(AcctStartTime) AS day, UserName from " . $configValues['CONFIG_DB_TBL_RADACCT'] . " where UserName='******' AND acctstoptime>0 AND AcctStartTime>DATE_SUB(curdate(),INTERVAL (DAY(curdate())-1) DAY) AND AcctStartTime< now() group by day ORDER BY {$orderBy} {$orderType};"; $res = $dbSocket->query($sql); $total_downloads = 0; // initialize variables $count = 0; $array_downloads = array(); $array_days = array(); while ($row = $res->fetchRow()) { // The table that is being procuded is in the format of: // +--------+------+ // | Download | Day |
case "gigabytes": $sizeDivision = "1073741824"; break; case "megabytes": $sizeDivision = "1048576"; break; default: $sizeDivision = "1048576"; break; } if ($type == "daily") { daily($username); } elseif ($type == "monthly") { monthly($username); } elseif ($type == "yearly") { yearly($username); } function daily($username) { global $sizeDivision; global $size; include 'opendb.php'; include 'libchart/libchart.php'; $username = $dbSocket->escapeSimple($username); header("Content-type: image/png"); $chart = new VerticalChart(680, 500); $sql = "SELECT UserName, sum(AcctInputOctets) as Uploads, day(AcctStartTime) AS day FROM " . $configValues['CONFIG_DB_TBL_RADACCT'] . " WHERE username='******' AND acctstoptime>0 AND AcctStartTime>DATE_SUB(curdate(),INTERVAL (DAY(curdate())+30) DAY) AND AcctStartTime< now() GROUP BY day;"; $res = $dbSocket->query($sql); while ($row = $res->fetchRow()) { $uploads = number_format($row[1] / $sizeDivision, 2, '.', ''); $chart->addPoint(new Point("{$row['2']}", "{$uploads}"));
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ********************************************************************************************************* * Description: * this graph extension procduces a query of the alltime logins made by all users on a daily, monthly and yearly basis. * * Authors: Liran Tal <*****@*****.**> * ********************************************************************************************************* */ if ($type == "daily") { daily($orderBy, $orderType); } elseif ($type == "monthly") { monthly($orderBy, $orderType); } elseif ($type == "yearly") { yearly($orderBy, $orderType); } function daily($orderBy, $orderType) { include 'opendb.php'; $sql = "SELECT count(username) AS numberoflogins, day(AcctStartTime) AS day from " . $configValues['CONFIG_DB_TBL_RADACCT'] . " GROUP BY day ORDER BY {$orderBy} {$orderType};"; $res = $dbSocket->query($sql); $total_logins = 0; // initialize variables $count = 0; $array_logins = array(); $array_days = array(); while ($row = $res->fetchRow()) { // The table that is being procuded is in the format of: // +--------+------+ // | Logins/Hits | Day |