<?php
extract($_POST);
extract($_GET);
$configpath = str_replace(array("/user/graph_page.php", "\user\graph_page.php"), "", __FILE__) . "/config.php";
include($configpath);
include_once("$cs_base_path/include/aloe/aloe_config.php");
include_once("$cs_base_path/include/aloe/graph.php");
if (isset($_COOKIE['clearsite']['user_ID'])) {
$user_ID = $_COOKIE['clearsite']['user_ID'];
if (empty($act)) {
mysql_connect("$DBhost:$DBport",$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$sqlquery = "SELECT DISTINCT page_name FROM user_groups WHERE user_ID = \"$user_ID\"";
$results = mysql_query($sqlquery);
$num_rows = mysql_num_rows($results);
mysql_close();
if ($num_rows >= 1) {
while ($row = mysql_fetch_assoc($results)) {
print "<h4><a href=\"$ClearsiteBaseURL/my.php?page=graph_page.php&act=graph_group_display&page_name=$row[page_name]\">$row[page_name]</a></h4>
";
};
} else {
print "No graph groups created.";
};
} else if ($act == "graph_group_display") {
mysql_connect("$DBhost:$DBport",$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db("$DBName") or die("Unable to select database $DBName");
$graph_group_query = "SELECT interface_type, interface_ID, label FROM user_groups WHERE user_ID = \"$user_ID\" and page_name = \"$page_name\"";
$graph_group_results = mysql_query($graph_group_query);
mysql_close();
while ($graph_group_row = mysql_fetch_assoc($graph_group_results)) {
if ($graph_group_row['interface_type'] == "css_cr") {
$detail_name = "cr_ID";
} else if ($graph_group_row['interface_type'] == "cpus") {
$detail_name = "cpu_ID";
} else if ($graph_group_row['interface_type'] == "css_sv") {
$detail_name = "sv_ID";
} else if ($graph_group_row['interface_type'] == "css_owner") {
$detail_name = "owner_ID";
} else if ($graph_group_row['interface_type'] == "vpn_stats") {
$detail_name = "device_ID";
} else if ($graph_group_row['interface_type'] == "wap_stats") {
$detail_name = "device_ID";
} else {
$detail_name = "interface_ID";
};
$interface_type = $graph_group_row['interface_type'];
$detail_ID = $graph_group_row['interface_ID'];
${$detail_name} = $detail_ID;
$beginyear = date('Y', strtotime("-1 day"));
$beginmonth = date('m', strtotime("-1 day"));
$beginday = date('d', strtotime("-1 day"));
$beginhour = date("H:i", strtotime("-1 day"));
$endyear = date('Y', strtotime("-5 minutes"));
$endmonth = date('m', strtotime("-5 minutes"));
$endday = date('d', strtotime("-5 minutes"));
$endhour = date("H:i", strtotime("-5 minutes"));
$action = "customtimeframe";
print "
<p>
$graph_group_row[label]
</p>
";
include("$cs_base_path/include/aloe/aloe_details.php");
};
};
} else {
print "<font class=\"admin_error\">Please Log In</font><p />";
};
?>