Location: PHPKode > projects > Network Traffic Monitor > online/graphs.php
<?php

#Network Traffic Monitor is an application to monitor the network traffic on all SNMP managable devices.
#
#Copyright (c) 2004, Daimler Trust nv <hide@address.com> - Jan Van Hees <hide@address.com>
# 
#This file is part of Network Traffic Monitor.
#
#    Network Traffic Monitor is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    Network Traffic Monitor is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Network Traffic Monitor; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

/*
* This script provides a user interface 2 list all bandwidth graphs 
*/
require_once("../auth.php");
require_once ("../config.php");
require_once ("HTML/Template/IT.php");

$hist = $_POST['history'];
if ($hist){
	$_SESSION['history']=$hist;
	$mon = date("n");
	if($hist==0) {$hist=$mon;}
	else {$mon = $mon - $hist;}
}
else {
	$mon = date("n");
	$_SESSION['history']=0;
	$hist=0;
}
	$m = mktime (1,1,1,$mon);
	$month = strftime("%B", $m);
if($_GET[i]){
#	$iface = $_GET[i];
	$_SESSION[iface]=$_GET[i];
}

$db = dbLogin();

$tpl = new HTML_Template_IT(TEMPLATEDIR);
$tpl->loadTemplatefile("data.tpl");
$tpl->setVariable("title","Bandwidth Graphs");
$date = date ("l: d-m-Y");
$tpl->setVariable("daylabel",$date);
$date = date ("F");
$tpl->setVariable("monthlabel",$month);
$tpl->setVariable("history", $hist);
$date = date("Y");
$tpl->setVariable("yearlabel",$date);
$tpl->setVariable("IFACE", "$_SESSION[iface]");
$content = $tpl->get();

fillFrame($db, $content);

dblogout($db);
?>
Return current item: Network Traffic Monitor