Changes adopted from version 0.5
This commit is contained in:
117
index.php
117
index.php
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2008 Wietse Warendorff
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,46 +20,89 @@
|
||||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/index.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(asset.asset_id) AS asset_counter
|
||||
FROM
|
||||
asset";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("asset_counter", $assets[0]['asset_counter']);
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/index.tpl");
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(location.location_id) AS location_counter
|
||||
FROM
|
||||
location";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("location_counter", $locations[0]['location_counter']);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(node.node_id) AS node_counter
|
||||
FROM
|
||||
node";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("node_counter", $nodes[0]['node_counter']);
|
||||
|
||||
// calculate assets
|
||||
$query = mysql_query("SELECT asset_id FROM asset") or die(mysql_error());
|
||||
$assetcount = mysql_num_rows($query);
|
||||
$tp->set('assetcount', $assetcount);
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(subnet.subnet_id) AS subnet_counter
|
||||
FROM
|
||||
subnet";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("subnet_counter", $subnets[0]['subnet_counter']);
|
||||
|
||||
// calculate locations
|
||||
$query = mysql_query("SELECT location_id FROM location") or die(mysql_error());
|
||||
$locationcount = mysql_num_rows($query);
|
||||
$tp->set('locationcount', $locationcount);
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
COUNT(vlan.vlan_id) AS vlan_counter
|
||||
FROM
|
||||
vlan";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("vlan_counter", $vlans[0]['vlan_counter']);
|
||||
|
||||
// calculate nodes
|
||||
$query = mysql_query("SELECT node_id FROM node") or die(mysql_error());
|
||||
$nodecount = mysql_num_rows($query);
|
||||
$tp->set('nodecount', $nodecount);
|
||||
|
||||
// calculate subnets
|
||||
$query = mysql_query("SELECT subnet_id FROM subnet") or die(mysql_error());
|
||||
$subnetcount = mysql_num_rows($query);
|
||||
$tp->set('subnetcount', $subnetcount);
|
||||
|
||||
// calculate vlans
|
||||
$query = mysql_query("SELECT vlan_id FROM vlan") or die(mysql_error());
|
||||
$vlancount = mysql_num_rows($query);
|
||||
$tp->set('vlancount', $vlancount);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
||||
Reference in New Issue
Block a user