* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ********************************************************************************************************* * 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");
$size = $_REQUEST['size']; switch ($size) { 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()) {
* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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:
* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * 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:
function makecalendar($month, $year, $month_calendar, $lunarstream = '') { global $nowtime, $mbcon, $config; $all_date = monthly($month, $year); $weekline = count($all_date) / 7; for ($i = 0; $i < $weekline; $i++) { $chart .= "<tr class=\"calendar-weekdays\">"; for ($j = 0; $j < 7; $j++) { $currentdate = $all_date[$i * 7 + $j]; if ($j == 0) { $class = "calendar-sunday"; } elseif ($j == 6) { $class = "calendar-saturday"; } else { $class = "calendar-day"; } //workdays $outurl = getlink_date($year, $month, $currentdate); if (@in_array($currentdate, $month_calendar)) { $ca_sh = "<a href=\"{$outurl}\" rel=\"noindex,nofollow\">{$currentdate}</a>"; } else { $ca_sh = $currentdate; } if (is_array($lunarstream)) { if ($mbcon['lunarcalendar'] == 2) { $ca_sh = "<span title='{$lunarstream[$currentdate]}'>{$ca_sh}</span>"; } else { $ca_sh .= '<br/>' . $lunarstream[$currentdate]; } } if ($currentdate !== '') { $chart .= "<td id=\"cal{$currentdate}\" class=\"{$class}\">{$ca_sh}</td>"; } else { $chart .= "<td class=\"{$class}\">{$ca_sh}</td>"; } } $chart .= "</tr>"; } return $chart; }