You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
6.0 KiB
178 lines
6.0 KiB
<?php
|
|
/*****************************************************************************
|
|
IP Reg, a PHP/MySQL IPAM tool
|
|
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
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
For more information, visit http://sourceforge.net/projects/ipreg,
|
|
or contact me at wietsew@users.sourceforge.net
|
|
*****************************************************************************/
|
|
|
|
// start page
|
|
// includes
|
|
include("includes.php");
|
|
|
|
// start output
|
|
include("header.php");
|
|
|
|
// set language variables
|
|
$smarty->assign($lang);
|
|
|
|
// get string that was searched for ($search is already set in header.php)
|
|
if (empty($search)) {
|
|
// parse nosearch box
|
|
$smarty->assign("nosearch", TRUE);
|
|
} else {
|
|
// hide nosearch box
|
|
$smarty->assign("nosearch", FALSE);
|
|
$smarty->assign("search", $search);
|
|
|
|
// set needle
|
|
$needle = '%' . $search . '%';
|
|
|
|
// set counter
|
|
$resultcounter = 0;
|
|
|
|
// setup asset
|
|
// build query
|
|
$query = "SELECT
|
|
asset.asset_id AS id,
|
|
asset.asset_name AS name,
|
|
asset.asset_info AS description
|
|
FROM
|
|
asset
|
|
WHERE
|
|
asset.asset_name LIKE '" . $needle . "'
|
|
OR asset.asset_hostname LIKE '" . $needle . "'
|
|
OR asset.asset_info LIKE '" . $needle . "'
|
|
ORDER BY
|
|
asset.asset_name";
|
|
|
|
// run query
|
|
$assets = $db->db_select($query);
|
|
$resultcounter += count($assets);
|
|
$smarty->assign("assets", $assets);
|
|
|
|
// setup location
|
|
// build query
|
|
$query = "SELECT
|
|
location.location_id AS id,
|
|
location.location_name AS name
|
|
FROM
|
|
location
|
|
WHERE
|
|
location.location_name LIKE '" . $needle . "'
|
|
OR location.location_info LIKE '" . $needle . "'
|
|
ORDER BY
|
|
location.location_name";
|
|
|
|
// run query
|
|
$locations = $db->db_select($query);
|
|
$resultcounter += count($locations);
|
|
$smarty->assign("locations", $locations);
|
|
|
|
// setup node
|
|
// build query
|
|
$query = "SELECT
|
|
node.node_id AS id,
|
|
node.node_ip AS ip
|
|
FROM
|
|
node
|
|
WHERE
|
|
node.node_ip LIKE '" . $needle . "'
|
|
OR node.node_mac LIKE '" . $needle . "'
|
|
OR node.node_dns1 LIKE '" . $needle . "'
|
|
OR node.node_dns2 LIKE '" . $needle . "'
|
|
OR node.node_info LIKE '" . $needle . "'
|
|
ORDER BY
|
|
node.node_ip";
|
|
|
|
// run query
|
|
$nodes = $db->db_select($query);
|
|
$resultcounter += count($nodes);
|
|
$smarty->assign("nodes", $nodes);
|
|
|
|
// setup subnet
|
|
// build query
|
|
$query = "SELECT
|
|
subnet.subnet_id AS id,
|
|
subnet.subnet_address AS address
|
|
FROM
|
|
subnet
|
|
WHERE
|
|
subnet.subnet_address LIKE '" . $needle . "'
|
|
OR subnet.subnet_info LIKE '" . $needle . "'
|
|
ORDER BY
|
|
subnet.subnet_address";
|
|
|
|
// run query
|
|
$subnets = $db->db_select($query);
|
|
$resultcounter += count($subnets);
|
|
$smarty->assign("subnets", $subnets);
|
|
|
|
// setup vlan
|
|
// build query
|
|
$query = "SELECT
|
|
vlan.vlan_id AS id,
|
|
vlan.vlan_name AS name
|
|
FROM
|
|
vlan
|
|
WHERE
|
|
vlan.vlan_name LIKE '" . $needle . "'
|
|
OR vlan.vlan_info LIKE '" . $needle . "'
|
|
ORDER BY
|
|
vlan.vlan_name";
|
|
|
|
// run query
|
|
$vlans = $db->db_select($query);
|
|
$resultcounter += count($vlans);
|
|
$smarty->assign("vlans", $vlans);
|
|
|
|
// setup zone
|
|
// build query
|
|
$query = "SELECT
|
|
zone_id AS id,
|
|
zone_origin AS origin
|
|
FROM
|
|
zone
|
|
WHERE
|
|
zone_origin LIKE '" . $needle . "'
|
|
OR zone_soa LIKE '" . $needle . "'
|
|
OR zone_hostmaster LIKE '" . $needle . "'
|
|
OR zone_ns1 LIKE '" . $needle . "'
|
|
OR zone_ns2 LIKE '" . $needle . "'
|
|
OR zone_ns3 LIKE '" . $needle . "'
|
|
OR zone_mx1 LIKE '" . $needle . "'
|
|
OR zone_mx2 LIKE '" . $needle . "'
|
|
OR zone_info LIKE '" . $needle . "'
|
|
ORDER BY
|
|
zone_origin";
|
|
|
|
// run query
|
|
$zones = $db->db_select($query);
|
|
$resultcounter += count($zones);
|
|
$smarty->assign("zones", $zones);
|
|
|
|
// grand totals
|
|
$smarty->assign("resultcounter", $resultcounter);
|
|
}
|
|
|
|
// end page
|
|
// output
|
|
$smarty->display("search.tpl");
|
|
|
|
// end output
|
|
include("footer.php");
|
|
?>
|
|
|