graphs auth.inc.phps to db*

git-svn-id: http://www.observium.org/svn/observer/trunk@2303 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-13 12:49:23 +00:00
parent c086264fc2
commit 3041b03da2
11 changed files with 19 additions and 42 deletions

View File

@@ -3,7 +3,7 @@
if (is_numeric($id))
{
$data = mysql_fetch_assoc(mysql_query("SELECT * FROM bgpPeers WHERE bgpPeer_id = '".$id."'"));
$data = dbFetchRow("SELECT * FROM bgpPeers WHERE bgpPeer_id = ?", array($id));
if (is_numeric($data['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($data['device_id'])))
{

View File

@@ -6,27 +6,14 @@ include("../includes/billing.php");
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted($_GET['id'])))
{
$bill_query = mysql_query("SELECT * FROM `bills` WHERE bill_id = '".mres($_GET['id'])."'");
$bill = mysql_fetch_assoc($bill_query);
# $day_data = getDates($bill['bill_day']);
# $datefrom = $day_data['0'];
# $dateto = $day_data['1'];
#print_r($day_data);
$bill = dbFetchRow("SELECT * FROM `bills` WHERE bill_id = ?", array($_GET['id']));
$datefrom = date('YmdHis', $_GET['from']);
$dateto = date('YmdHis', $_GET['to']);
$rates = getRates($_GET['id'], $datefrom, $dateto);
$ports = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
WHERE B.bill_id = '".mres($_GET['id'])."' AND P.interface_id = B.port_id
AND D.device_id = P.device_id");
$ports = dbFetchRows("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D WHERE B.bill_id = ? AND P.interface_id = B.port_id AND D.device_id = P.device_id", array($_GET['id']));
$auth = TRUE;
}

View File

@@ -2,8 +2,7 @@
if (is_numeric($id))
{
$query = mysql_query("SELECT * FROM `cef_switching` AS C, `devices` AS D WHERE C.cef_switching_id = '".$id."' AND C.device_id = D.device_id");
$cef = mysql_fetch_assoc($query);
$cef = dbFetchRow("SELECT * FROM `cef_switching` AS C, `devices` AS D WHERE C.cef_switching_id = ? AND C.device_id = D.device_id", array($id));
if (is_numeric($cef['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($cef['device_id'])))
{

View File

@@ -2,8 +2,7 @@
if (is_numeric($id))
{
$query = mysql_query("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE U.diskio_id = '".$id."' AND U.device_id = D.device_id");
$disk = mysql_fetch_assoc($query);
$disk = dbFetchRow("SELECT * FROM `ucd_diskio` AS U, `devices` AS D WHERE U.diskio_id = ? AND U.device_id = D.device_id", array($id));
if (is_numeric($disk['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($disk['device_id'])))
{

View File

@@ -3,10 +3,7 @@
if (is_numeric($id))
{
$query = mysql_query("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = '".mres($id)."'
AND I.interface_id = M.interface_id AND I.device_id = D.device_id");
$acc = mysql_fetch_assoc($query);
$acc = dbFetchRow("SELECT * FROM `mac_accounting` AS M, `ports` AS I, `devices` AS D WHERE M.ma_id = ? AND I.interface_id = M.interface_id AND I.device_id = D.device_id", array($id));
if (($config['allow_unauth_graphs'] || port_permitted($acc['interface_id']))
&& is_file($config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd")))
@@ -19,8 +16,6 @@ if (is_numeric($id))
$title .= " :: Port ".generate_port_link($port);
$title .= " :: " . formatMac($acc['mac']);
$auth = TRUE;
}
}
?>

View File

@@ -2,8 +2,7 @@
if (is_numeric($id))
{
$sql = mysql_query("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = '".mres($id)."' AND C.device_id = D.device_id");
$mempool = mysql_fetch_assoc($sql);
$mempool = dbFetchRow("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = ? AND C.device_id = D.device_id", array($id));
if (is_numeric($mempool['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($mempool['device_id'])))
{

View File

@@ -1,7 +1,6 @@
<?php
$sql = mysql_query("SELECT * FROM `processors` where `processor_id` = '".mres($id)."'");
$proc = mysql_fetch_assoc($sql);
$proc = dbFetchRow("SELECT * FROM `processors` where `processor_id` = ?", array($id));
if (is_numeric($proc['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($proc['device_id'])))
{

View File

@@ -2,7 +2,7 @@
if (is_numeric($id))
{
$sensor = mysql_fetch_assoc(mysql_query("SELECT * FROM sensors WHERE sensor_id = '".mres($id)."'"));
$sensor = dbFetchRow("SELECT * FROM sensors WHERE sensor_id = ?", array($id));
if (is_numeric($sensor['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($sensor['device_id'])))
{

View File

@@ -2,7 +2,7 @@
if (is_numeric($id))
{
$service = mysql_fetch_assoc(mysql_query("SELECT * FROM services WHERE service_id = '".mres($id)."'"));
$service = dbFetchRow("SELECT * FROM services WHERE service_id = ?", array($id));
if (is_numeric($service['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($service['device_id'])))
{

View File

@@ -2,8 +2,7 @@
if (is_numeric($id))
{
$sql = mysql_query("SELECT * FROM `storage` WHERE `storage_id` = '".mres($id)."'");
$storage = mysql_fetch_assoc($sql);
$storage = dbFetchRow("SELECT * FROM `storage` WHERE `storage_id` = ?", array($id));
if (is_numeric($storage['device_id']) && ($config['allow_unauth_graphs'] || device_permitted($storage['device_id'])))
{