Changed database access to PDO using prepared statements
This commit is contained in:
54
index.php
54
index.php
@@ -11,57 +11,31 @@ include("includes.php");
|
||||
|
||||
include("header.php");
|
||||
|
||||
// asset
|
||||
$query = "SELECT
|
||||
COUNT(asset_id) AS asset_counter
|
||||
FROM
|
||||
asset";
|
||||
// Statistics
|
||||
|
||||
$assets = $db->db_select($query);
|
||||
$smarty->assign("asset_counter", $assets[0]['asset_counter']);
|
||||
// asset
|
||||
$sth = $dbh->query("SELECT COUNT(asset_id) AS asset_counter FROM asset");
|
||||
$smarty->assign("asset_counter", $sth->fetchColumn());
|
||||
|
||||
// location
|
||||
$query = "SELECT
|
||||
COUNT(location_id) AS location_counter
|
||||
FROM
|
||||
location";
|
||||
|
||||
$locations = $db->db_select($query);
|
||||
$smarty->assign("location_counter", $locations[0]['location_counter']);
|
||||
$sth = $dbh->query("SELECT COUNT(location_id) AS location_counter FROM location");
|
||||
$smarty->assign("location_counter", $sth->fetchColumn());
|
||||
|
||||
// node
|
||||
$query = "SELECT
|
||||
COUNT(node_id) AS node_counter
|
||||
FROM
|
||||
node";
|
||||
|
||||
$nodes = $db->db_select($query);
|
||||
$smarty->assign("node_counter", $nodes[0]['node_counter']);
|
||||
$sth = $dbh->query("SELECT COUNT(node_id) AS node_counter FROM node");
|
||||
$smarty->assign("node_counter", $sth->fetchColumn());
|
||||
|
||||
// subnet
|
||||
$query = "SELECT
|
||||
COUNT(subnet_id) AS subnet_counter
|
||||
FROM
|
||||
subnet";
|
||||
$subnets = $db->db_select($query);
|
||||
$smarty->assign("subnet_counter", $subnets[0]['subnet_counter']);
|
||||
$sth = $dbh->query("SELECT COUNT(subnet_id) AS subnet_counter FROM subnet");
|
||||
$smarty->assign("subnet_counter", $sth->fetchColumn());
|
||||
|
||||
// vlan
|
||||
$query = "SELECT
|
||||
COUNT(vlan_id) AS vlan_counter
|
||||
FROM
|
||||
vlan";
|
||||
|
||||
$vlans = $db->db_select($query);
|
||||
$smarty->assign("vlan_counter", $vlans[0]['vlan_counter']);
|
||||
$sth = $dbh->query("SELECT COUNT(vlan_id) AS vlan_counter FROM vlan");
|
||||
$smarty->assign("vlan_counter", $sth->fetchColumn());
|
||||
|
||||
// zone
|
||||
$query = "SELECT
|
||||
COUNT(zone_id) AS zone_counter
|
||||
FROM
|
||||
zone";
|
||||
$zones = $db->db_select($query);
|
||||
$smarty->assign("zone_counter", $zones[0]['zone_counter']);
|
||||
$sth = $dbh->query("SELECT COUNT(zone_id) AS zone_counter FROM zone");
|
||||
$smarty->assign("zone_counter", $sth->fetchColumn());
|
||||
|
||||
$smarty->display("index.tpl");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user