Changes adopted from version 0.5
43
about.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,25 +20,28 @@
|
|||
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/about.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// setup page
|
||||
// set vars
|
||||
$tp->set("config_version", $config_version);
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/about.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set vars
|
||||
$tp->set("config_version", $config_version);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
135
asset.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,35 +20,110 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("asset", $config_auth_assetview, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/asset.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT a.asset_id, a.asset_name, a.assetclass_id, ac.assetclass_name FROM asset a, assetclass ac WHERE ac.assetclass_id=a.assetclass_id ORDER BY a.asset_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->parse("assetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
include("footer.php");
|
||||
// set template
|
||||
$tp = new Template("tpl/asset.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// create letter links
|
||||
// build query
|
||||
$query = "SELECT
|
||||
SUBSTRING(UPPER(asset.asset_name),1,1) AS asset_letter
|
||||
FROM
|
||||
asset
|
||||
GROUP BY
|
||||
asset_letter
|
||||
ORDER BY
|
||||
asset_letter";
|
||||
|
||||
// run query
|
||||
$alphabet = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$alphabet_counter = count($alphabet);
|
||||
|
||||
// any letters?
|
||||
if ($alphabet_counter>0) {
|
||||
// get objects
|
||||
foreach($alphabet AS $alphabet_letter) {
|
||||
// to tpl
|
||||
$tp->set("asset_letter", strtoupper($alphabet_letter['asset_letter']));
|
||||
|
||||
// parse every row
|
||||
$tp->parse("letter_row");
|
||||
}
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("letter_table");
|
||||
|
||||
// setup asset
|
||||
// setup current letter
|
||||
if(isset($_GET['asset_letter'])) {
|
||||
$asset_letter = sanitize($_GET['asset_letter']);
|
||||
} else {
|
||||
$asset_letter = $alphabet[0]['asset_letter'];
|
||||
}
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name,
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
asset,
|
||||
assetclass
|
||||
WHERE
|
||||
SUBSTRING(asset.asset_name,1,1) = '" . $asset_letter . "'
|
||||
AND assetclass.assetclass_id=asset.assetclass_id
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$asset_counter = count($assets);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("asset_counter", $asset_counter);
|
||||
|
||||
// any assets?
|
||||
if ($asset_counter>0) {
|
||||
// get objects
|
||||
foreach($assets AS $asset) {
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset['asset_id']);
|
||||
$tp->set("asset_name", $asset['asset_name']);
|
||||
|
||||
$tp->set("assetclass_id", $asset['assetclass_id']);
|
||||
$tp->set("assetclass_name", $asset['assetclass_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("asset_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("asset_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("asset_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
85
assetadd.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,37 +20,58 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
if((isset($_GET['assetclass_id'])) ? $assetclass_id = sanitize($_GET['assetclass_id']) : $assetclass_id = "");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get id
|
||||
if((isset($_GET['assetclass_id'])) ? $assetclass_id = $_GET['assetclass_id'] : $assetclass_id = "");
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
|
||||
foreach($assetclasses AS $assetclass) {
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass['assetclass_name']);
|
||||
|
||||
if($assetclass['assetclass_id']==$assetclass_id) {
|
||||
$tp->set("assetclass_selected", "selected");
|
||||
} else {
|
||||
$tp->set("assetclass_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_table");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("asset", $config_auth_assetadd, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclassgroup information
|
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->assetclass_id==$assetclass_id) ? $tp->set("assetclass_selected", "selected") : $tp->set("assetclass_selected", ""));
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->parse("assetclassrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,33 +20,70 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclass", $config_auth_assetclassview, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclass.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclass info
|
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->parse("assetclassrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclass.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name,
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclass,
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=assetclass.assetclassgroup_id
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$assetclass_counter = count($assetclasses);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("assetclass_counter", $assetclass_counter);
|
||||
|
||||
// any assetclasses?
|
||||
if ($assetclass_counter>0) {
|
||||
// get objects
|
||||
foreach($assetclasses AS $assetclass) {
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass['assetclass_name']);
|
||||
|
||||
$tp->set("assetclassgroup_id", $assetclass['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclass['assetclassgroup_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("assetclass_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("assetclass_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,37 +20,59 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']) : $assetclassgroup_id = "");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get id
|
||||
if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = $_GET['assetclassgroup_id'] : $assetclassgroup_id = "");
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclassgroup
|
||||
ORDER BY
|
||||
assetclassgroup.assetclassgroup_name";
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// get objects
|
||||
foreach($assetclassgroup AS $assetclassgroup) {
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup['assetclassgroup_name']);
|
||||
|
||||
if($assetclassgroup['assetclassgroup_id']==$assetclassgroup_id) {
|
||||
$tp->set("assetclassgroup_selected", "selected");
|
||||
} else {
|
||||
$tp->set("assetclassgroup_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_table");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclass", $config_auth_assetclassadd, $assetclass_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclassgroup information
|
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->assetclassgroup_id==$assetclassgroup_id) ? $tp->set("assetclassgroup_selected", "selected") : $tp->set("assetclassgroup_selected", ""));
|
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
$tp->parse("assetclassgrouprow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,33 +20,44 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclass_id = $_GET['assetclass_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclass", $config_auth_assetclassdel, $assetclass_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassdel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclass info
|
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass WHERE assetclass_id='$assetclass_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// get id
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
WHERE
|
||||
assetclass.assetclass_id=" . $assetclass_id;
|
||||
|
||||
// run query
|
||||
$assetclass = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass[0]['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass[0]['assetclass_name']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,45 +20,77 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclass_id = $_GET['assetclass_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclass", $config_auth_assetclassedit, $assetclass_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get assetclass information
|
||||
$result = mysql_query("SELECT assetclass_name, assetclassgroup_id FROM assetclass WHERE assetclass_id='$assetclass_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$assetclassgroup_id = $row->assetclassgroup_id;
|
||||
$tp->set("assetclass_id", $assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup_id);
|
||||
// get id
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name,
|
||||
assetclass.assetclassgroup_id AS assetclassgroup_id
|
||||
FROM
|
||||
assetclass
|
||||
WHERE
|
||||
assetclass.assetclass_id=" . $assetclass_id;
|
||||
|
||||
// run query
|
||||
$assetclass = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass[0]['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass[0]['assetclass_name']);
|
||||
|
||||
// get assetclassgroup information
|
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->assetclassgroup_id==$assetclassgroup_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
$tp->parse("assetclassgrouprow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup"));
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclassgroup
|
||||
ORDER BY
|
||||
assetclassgroup.assetclassgroup_name";
|
||||
|
||||
// run query
|
||||
$assetclassgroups = $db->db_select($query);
|
||||
|
||||
// get objects
|
||||
foreach($assetclassgroups AS $assetclassgroup) {
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup['assetclassgroup_name']);
|
||||
|
||||
if($assetclassgroup['assetclassgroup_id']==$assetclass[0]['assetclassgroup_id']) {
|
||||
$tp->set("assetclassgroup_selected", "selected");
|
||||
} else {
|
||||
$tp->set("assetclassgroup_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_table");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,34 +20,65 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclassgroup", $config_auth_assetclassgroupview, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroup.tpl");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroup.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclassgroup
|
||||
ORDER BY
|
||||
assetclassgroup.assetclassgroup_name";
|
||||
|
||||
// run query
|
||||
$assetclassgroups = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$assetclassgroup_counter = count($assetclassgroups);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("assetclassgroup_counter", $assetclassgroup_counter);
|
||||
|
||||
// any assetclassgroups?
|
||||
if ($assetclassgroup_counter>0) {
|
||||
// get objects
|
||||
foreach($assetclassgroups AS $assetclassgroup) {
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup['assetclassgroup_name']);
|
||||
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup['assetclassgroup_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("assetclassgroup_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("assetclassgroup_table");
|
||||
}
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
$tp->parse("assetclassgrouprow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,24 +20,24 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclassgroup", $config_auth_assetclassgroupadd, 0);
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,33 +20,44 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclassgroup_id = $_GET['assetclassgroup_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclassgroup", $config_auth_assetclassgroupdel, $assetclassgroup_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupdel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclass info
|
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup WHERE assetclassgroup_id='$assetclassgroup_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// get id
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=" . $assetclassgroup_id;
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,34 +20,46 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclassgroup_id = $_GET['assetclassgroup_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclassgroup", $config_auth_assetclassgroupedit, $assetclassgroup_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get assetclass information
|
||||
$result = mysql_query("SELECT assetclassgroup_name, color FROM assetclassgroup WHERE assetclassgroup_id='$assetclassgroup_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
$tp->set("color", $row->color);
|
||||
// get id
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name,
|
||||
assetclassgroup.assetclassgroup_color AS assetclassgroup_color
|
||||
FROM
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=" . $assetclassgroup_id;
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
|
||||
$tp->set("assetclassgroup_color", $assetclassgroup[0]['assetclassgroup_color']);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,42 +20,86 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclassgroup_id = $_GET['assetclassgroup_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclassgroup", $config_auth_assetclassgroupview, $assetclassgroup_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupview.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get assetclassgroup info
|
||||
$result = mysql_query("SELECT assetclassgroup_name, color FROM assetclassgroup WHERE assetclassgroup_id='$assetclassgroup_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
$tp->set("color", $row->color);
|
||||
|
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass WHERE assetclassgroup_id='$assetclassgroup_id' ORDER BY assetclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->parse("assetclassrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
|
||||
// get id
|
||||
$assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassgroupview.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name,
|
||||
assetclassgroup.assetclassgroup_color AS assetclassgroup_color
|
||||
FROM
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclassgroup.assetclassgroup_id=" . $assetclassgroup_id;
|
||||
|
||||
// run query
|
||||
$assetclassgroup = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
|
||||
$tp->set("assetclassgroup_color", $assetclassgroup[0]['assetclassgroup_color']);
|
||||
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
WHERE
|
||||
assetclass.assetclassgroup_id=" . $assetclassgroup_id . "
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$assetclass_counter = count($assetclasses);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("assetclass_counter", $assetclass_counter);
|
||||
|
||||
// any assets?
|
||||
if ($assetclass_counter>0) {
|
||||
// get objects
|
||||
foreach($assetclasses AS $assetclass) {
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass['assetclass_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("assetclass_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("assetclass_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,44 +20,95 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$assetclass_id = $_GET['assetclass_id'];
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assetclass", $config_auth_assetclassview, $assetclass_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassview.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclassgroup info
|
||||
$result = mysql_query("SELECT ac.assetclassgroup_id, ac.assetclass_name, acg.assetclassgroup_name FROM assetclass ac, assetclassgroup acg WHERE ac.assetclass_id='$assetclass_id' AND acg.assetclassgroup_id=ac.assetclassgroup_id") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$tp->set("assetclass_id", $assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
// get id
|
||||
$assetclass_id = sanitize($_GET['assetclass_id']);
|
||||
|
||||
// get assets for this assetclassgroup
|
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset WHERE assetclass_id='$assetclass_id' ORDER BY asset_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->parse("assetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// set template
|
||||
$tp = new Template("tpl/assetclassview.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
include("footer.php");
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name,
|
||||
assetclassgroup.assetclassgroup_id AS assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name AS assetclassgroup_name
|
||||
FROM
|
||||
assetclass,
|
||||
assetclassgroup
|
||||
WHERE
|
||||
assetclass.assetclass_id=" . $assetclass_id . "
|
||||
AND assetclassgroup.assetclassgroup_id=assetclass.assetclassgroup_id";
|
||||
|
||||
// run query
|
||||
$assetclass = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass[0]['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass[0]['assetclass_name']);
|
||||
$tp->set("assetclass_selected", "");
|
||||
|
||||
$tp->set("assetclassgroup_id", $assetclass[0]['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclass[0]['assetclassgroup_name']);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
asset.assetclass_id='" . $assetclass_id . "'
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$asset_counter = count($assets);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("asset_counter", $asset_counter);
|
||||
|
||||
// any assets?
|
||||
if ($asset_counter>0) {
|
||||
// sort using "natural order"
|
||||
// ksort($assets);
|
||||
|
||||
// get objects
|
||||
foreach($assets AS $asset) {
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset['asset_id']);
|
||||
$tp->set("asset_name", $asset['asset_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("asset_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("asset_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("asset_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
114
assetdel.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,42 +20,80 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$asset_id = $_GET['asset_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("asset", $config_auth_assetdel, $asset_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetdel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT asset_name FROM asset WHERE asset_id='$asset_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
|
||||
// get node info
|
||||
$result = mysql_query("SELECT n.node_id, n.ip, n.mac, n.dns1, n.dns2, n.node_info, s.subnet_id, s.subnet_address, s.subnet_mask FROM node n, subnet s WHERE asset_id='$asset_id' AND s.subnet_id=n.subnet_id ORDER BY INET_ATON(n.ip)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("node_id", $row->node_id);
|
||||
$tp->set("ip", $row->ip);
|
||||
$tp->parse("noderow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
asset.asset_id=" . $asset_id;
|
||||
|
||||
// run query
|
||||
$asset = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("asset_name", $asset[0]['asset_name']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.asset_id=" . $asset_id . "
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// set id
|
||||
$tp->set("node_id", $node['node_id']);
|
||||
$tp->set("node_ip", $node['node_ip']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
123
assetedit.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");
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get id
|
||||
$asset_id = $_GET['asset_id'];
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
asset.asset_hostname AS asset_hostname,
|
||||
asset.asset_info AS asset_info,
|
||||
asset.assetclass_id AS assetclass_id
|
||||
FROM
|
||||
asset
|
||||
WHERE
|
||||
asset.asset_id=" . $asset_id;
|
||||
|
||||
// run query
|
||||
$asset = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("asset_name", $asset[0]['asset_name']);
|
||||
$tp->set("asset_hostname", $asset[0]['asset_hostname']);
|
||||
$tp->set("asset_info", $asset[0]['asset_info']);
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("asset", $config_auth_assetedit, $asset_id);
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$assetclass_counter = count($assetclasses);
|
||||
|
||||
// any nodes?
|
||||
if ($assetclass_counter>0) {
|
||||
// get objects
|
||||
foreach($assetclasses AS $assetclass) {
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass['assetclass_name']);
|
||||
|
||||
// set select box
|
||||
if($assetclass['assetclass_id']==$asset[0]['assetclass_id']) {
|
||||
$tp->set("assetclass_selected", "selected");
|
||||
} else {
|
||||
$tp->set("assetclass_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("assetclass_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("assetclass_table");
|
||||
}
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get asset information
|
||||
$result = mysql_query("SELECT asset_name, hostname, assetclass_id, asset_info FROM asset WHERE asset_id='$asset_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$assetclass_id = $row->assetclass_id;
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->set("hostname", $row->hostname);
|
||||
$tp->set("asset_info", $row->asset_info);
|
||||
|
||||
// get assetclass information
|
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->assetclass_id==$assetclass_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->parse("assetclassrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
138
assetview.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,54 +20,94 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetview.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
asset.asset_hostname AS asset_hostname,
|
||||
asset.asset_info AS asset_info,
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
asset,
|
||||
assetclass
|
||||
WHERE
|
||||
asset.asset_id=" . $asset_id . "
|
||||
AND assetclass.assetclass_id=asset.assetclass_id";
|
||||
|
||||
// run query
|
||||
$asset = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("asset_name", $asset[0]['asset_name']);
|
||||
$tp->set("asset_hostname", $asset[0]['asset_hostname']);
|
||||
$tp->set("asset_info", nl2br($asset[0]['asset_info']));
|
||||
|
||||
$tp->set("assetclass_id", $asset[0]['assetclass_id']);
|
||||
$tp->set("assetclass_name", $asset[0]['assetclass_name']);
|
||||
|
||||
// get id
|
||||
$asset_id = $_GET['asset_id'];
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.asset_id=" . $asset_id . "
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("node_counter", $node_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// send to tpl
|
||||
$tp->set("node_id", $node['node_id']);
|
||||
$tp->set("node_ip", $node['node_ip']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// check authorisation
|
||||
auth("asset", $config_auth_assetview, $asset_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assetview.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT a.asset_name, a.hostname, a.asset_info, ac.assetclass_id, ac.assetclass_name FROM asset a, assetclass ac WHERE a.asset_id='$asset_id' AND ac.assetclass_id=a.assetclass_id") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->set("hostname", $row->hostname);
|
||||
$tp->set("asset_info", nl2br($row->asset_info));
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
|
||||
// get node info
|
||||
$result = mysql_query("SELECT n.node_id, n.ip, n.mac, n.dns1, n.dns2, n.node_info, s.subnet_id, s.subnet_address, s.subnet_mask FROM node n, subnet s WHERE asset_id='$asset_id' AND s.subnet_id=n.subnet_id ORDER BY INET_ATON(n.ip)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("node_id", $row->node_id);
|
||||
$tp->set("ip", $row->ip);
|
||||
$tp->set("mac", write_mac($row->mac));
|
||||
$tp->set("dns1", $row->dns1);
|
||||
$tp->set("dns2", $row->dns2);
|
||||
$tp->set("node_info", nl2br($row->node_info));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->set("nodecount", $i+1);
|
||||
$tp->parse("noderow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2008 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
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get asset_id, ip or subnet_id
|
||||
if((isset($_GET['asset_id'])) ? $asset_id = $_GET['asset_id'] : $asset_id = "");
|
||||
if((isset($_GET['ip'])) ? $ip = $_GET['ip'] : $ip = "");
|
||||
if((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = "");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("assigniptoasset", $config_auth_assigniptoasset, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assigniptoasset.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set variables
|
||||
$tp->set("asset_id", $asset_id);
|
||||
$tp->set("ip", $ip);
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("config_dns1suffix", $config_dns1suffix);
|
||||
$tp->set("config_dns2suffix", $config_dns2suffix);
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset ORDER BY asset_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->asset_id==$asset_id) ? $tp->set("asset_selected", "selected") : $tp->set("asset_selected", ""));
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->parse("assetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->subnet_id==$subnet_id) ? $tp->set("subnet_selected", "selected") : $tp->set("subnet_selected", ""));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.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,35 +20,46 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// get ip and id
|
||||
$ip = $_GET['ip'];
|
||||
$subnet_id = $_GET['subnet_id'];
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assigniptonode.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set variables
|
||||
$tp->set("ip", $ip);
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_address, subnet_mask FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// get ip and id
|
||||
$node_ip = sanitize($_GET['node_ip']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
include("footer.php");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assigniptonode.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
$tp->set("node_ip", $node_ip);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2008 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
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// get id
|
||||
if((isset($_GET['location_id'])) ? $location_id = $_GET['location_id'] : $location_id = "");
|
||||
if((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = "");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assignlocationtosubnet.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get location info
|
||||
$result = mysql_query("SELECT location_id, location_name FROM location ORDER BY location_name");
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->location_id==$location_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("location_id", $row->location_id);
|
||||
$tp->set("location_name", $row->location_name);
|
||||
$tp->parse("locationrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("location") : $tp->hide("location"));
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->subnet_id==$subnet_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,133 @@
|
|||
<?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");
|
||||
|
||||
// get id
|
||||
$asset_id = sanitize($_GET['asset_id']);
|
||||
$node_ip = sanitize($_GET['node_ip']);
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assignnodetoasset.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// to tpl
|
||||
$tp->set("node_ip", $node_ip);
|
||||
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name
|
||||
FROM
|
||||
asset
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$asset_counter = count($assets);
|
||||
|
||||
// any assets?
|
||||
if ($asset_counter>0) {
|
||||
// get objects
|
||||
foreach($assets AS $asset) {
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset['asset_id']);
|
||||
$tp->set("asset_name", $asset['asset_name']);
|
||||
|
||||
if($asset['asset_id']==$asset_id) {
|
||||
$tp->set("asset_selected", "selected");
|
||||
} else {
|
||||
$tp->set("asset_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("asset_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("asset_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("asset_table");
|
||||
}
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$subnet_counter = count($subnets);
|
||||
|
||||
// any subnets?
|
||||
if ($subnet_counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
|
||||
if($subnet['subnet_id']==$subnet_id) {
|
||||
$tp->set("subnet_selected", "selected");
|
||||
} else {
|
||||
$tp->set("subnet_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("subnet_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2008 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
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/assignvlantosubnet.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get id
|
||||
if((isset($_GET['vlan_id'])) ? $vlan_id = $_GET['vlan_id'] : $vlan_id = "");
|
||||
if((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = "");
|
||||
|
||||
// get vlan info
|
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan ORDER BY vlan_number") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->vlan_id==$vlan_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("vlan_id", $row->vlan_id);
|
||||
$tp->set("vlan_name", $row->vlan_name);
|
||||
$tp->set("vlan_number", $row->vlan_number);
|
||||
$tp->parse("vlanrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan"));
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->subnet_id==$subnet_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.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
|
||||
|
@ -27,13 +27,13 @@
|
|||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/comments.tpl");
|
||||
$tp = new Template("tpl/comments.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get error
|
||||
$comments = $_GET['comments'];
|
||||
$comments = sanitize($_GET['comments']);
|
||||
|
||||
// set veriables
|
||||
$tp->set("comments", $lang['lang_comments_' . $comments]);
|
||||
|
|
73
config.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
|
||||
|
@ -21,69 +21,18 @@
|
|||
*****************************************************************************/
|
||||
|
||||
// version
|
||||
$config_version = 'v0.4b';
|
||||
$config_version = 'v0.5';
|
||||
|
||||
// db connection
|
||||
$config_mysql_host = "localhost";
|
||||
$config_mysql_username = '';
|
||||
$config_mysql_password = '';
|
||||
$config_mysql_dbname = '';
|
||||
|
||||
// default settings for new users
|
||||
$config_user_lang = 'en';
|
||||
$config_user_pass = 'welcome';
|
||||
$config_mysql_host = 'localhost';
|
||||
$config_mysql_username = 'db_user';
|
||||
$config_mysql_password = 'db_pass';
|
||||
$config_mysql_dbname = 'db_name';
|
||||
|
||||
// domain suffix for dns input fields
|
||||
$config_dns1suffix = '.domain.com';
|
||||
$config_dns2suffix = '.domain.com';
|
||||
// error reporting
|
||||
$config_yapter_error = 15; // see yapter.php for more information
|
||||
|
||||
// default colors for IP blocks
|
||||
$config_color_blocked = 'FFFFFF';
|
||||
$config_color_unused = 'D3D3D3';
|
||||
|
||||
// set userlevels
|
||||
$config_auth_assetadd = 2;
|
||||
$config_auth_assetdel = 2;
|
||||
$config_auth_assetedit = 2;
|
||||
$config_auth_assetview = 1;
|
||||
$config_auth_assetclassadd = 2;
|
||||
$config_auth_assetclassdel = 2;
|
||||
$config_auth_assetclassedit = 2;
|
||||
$config_auth_assetclassview = 1;
|
||||
$config_auth_assetclassgroupadd = 2;
|
||||
$config_auth_assetclassgroupdel = 2;
|
||||
$config_auth_assetclassgroupedit = 2;
|
||||
$config_auth_assetclassgroupview = 1;
|
||||
$config_auth_assigniptoasset = 2;
|
||||
$config_auth_assigniptonode = 2;
|
||||
$config_auth_assignlocationtosubnet = 2;
|
||||
$config_auth_assignvlantosubnet = 2;
|
||||
$config_auth_locationadd = 2;
|
||||
$config_auth_locationdel = 2;
|
||||
$config_auth_locationedit = 2;
|
||||
$config_auth_locationview = 1;
|
||||
$config_auth_nodeadd = 2;
|
||||
$config_auth_nodedel = 2;
|
||||
$config_auth_nodeedit = 2;
|
||||
$config_auth_nodeview = 1;
|
||||
$config_auth_subnetadd = 2;
|
||||
$config_auth_subnetdel = 2;
|
||||
$config_auth_subnetedit = 2;
|
||||
$config_auth_subnetview = 1;
|
||||
$config_auth_useradd = 2;
|
||||
$config_auth_userdel = 2;
|
||||
$config_auth_useredit = 2;
|
||||
$config_auth_userview = 1;
|
||||
$config_auth_userclassadd = 2;
|
||||
$config_auth_userclassdel = 2;
|
||||
$config_auth_userclassedit = 2;
|
||||
$config_auth_userclassview = 1;
|
||||
$config_auth_userclassauthadd = 2;
|
||||
$config_auth_userclassauthdel = 2;
|
||||
$config_auth_userclassauthedit = 2;
|
||||
$config_auth_userclassauthview = 1;
|
||||
$config_auth_vlanadd = 2;
|
||||
$config_auth_vlandel = 2;
|
||||
$config_auth_vlanedit = 2;
|
||||
$config_auth_vlanview = 1;
|
||||
// default values for IP blocks
|
||||
$config_color_blocked = 'dcdcdc';
|
||||
$config_color_unused = 'ffffff';
|
||||
?>
|
|
@ -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,6 +20,9 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// build connection
|
||||
mysql_connect($config_mysql_host,$config_mysql_username,$config_mysql_password);
|
||||
|
||||
// select db
|
||||
mysql_select_db($config_mysql_dbname);
|
||||
?>
|
20
footer.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,13 +20,15 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/footer.tpl");
|
||||
|
||||
// get version for the footer-stamp
|
||||
$tp->set("config_version", $config_version);
|
||||
// start page
|
||||
// set template
|
||||
$tp = new Template("tpl/footer.tpl", $config_yapter_error);
|
||||
|
||||
// get version for the footer-stamp
|
||||
$tp->set("config_version", $config_version);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
?>
|
109
header.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,32 +20,93 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// include language file
|
||||
include('lang/' . $_SESSION['suser_lang'] . '.php');
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/header.tpl");
|
||||
// start page
|
||||
// include language file
|
||||
include('lang/en.php');
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// set template
|
||||
$tp = new Template("tpl/header.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set search box
|
||||
if (isset($_POST['search'])) {
|
||||
$search = $_POST['search'];
|
||||
$_SESSION['search'] = $search;
|
||||
} else {
|
||||
if(isset($_SESSION['search'])) {
|
||||
$search = $_SESSION['search'];
|
||||
// search box
|
||||
// new search?
|
||||
if (isset($_POST['search'])) {
|
||||
// set var
|
||||
$search = sanitize($_POST['search']);
|
||||
|
||||
// store var
|
||||
$_SESSION['search'] = $search;
|
||||
} else {
|
||||
$search = '';
|
||||
// check for stored var
|
||||
if(isset($_SESSION['search'])) {
|
||||
// set var
|
||||
$search = $_SESSION['search'];
|
||||
} else {
|
||||
// empty var
|
||||
$search = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set global template vars
|
||||
$tp->set("config_version", $config_version);
|
||||
$tp->set("search", $search);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// to tpl
|
||||
// set global template vars
|
||||
$tp->set("config_version", $config_version);
|
||||
$tp->set("suser_name", $_SESSION['suser_displayname']);
|
||||
$tp->set("search", $search);
|
||||
|
||||
// menu
|
||||
// assets
|
||||
if($_SESSION['suser_menu_assets']=='on') {
|
||||
$tp->parse("menu_assets");
|
||||
} else {
|
||||
$tp->hide("menu_assets");
|
||||
}
|
||||
// assetclasses
|
||||
if($_SESSION['suser_menu_assetclasses']=='on') {
|
||||
$tp->parse("menu_assetclasses");
|
||||
} else {
|
||||
$tp->hide("menu_assetclasses");
|
||||
}
|
||||
// assetclassgroups
|
||||
if($_SESSION['suser_menu_assetclassgroups']=='on') {
|
||||
$tp->parse("menu_assetclassgroups");
|
||||
} else {
|
||||
$tp->hide("menu_assetclassgroups");
|
||||
}
|
||||
// locations
|
||||
if($_SESSION['suser_menu_locations']=='on') {
|
||||
$tp->parse("menu_locations");
|
||||
} else {
|
||||
$tp->hide("menu_locations");
|
||||
}
|
||||
// nodes
|
||||
if($_SESSION['suser_menu_nodes']=='on') {
|
||||
$tp->parse("menu_nodes");
|
||||
} else {
|
||||
$tp->hide("menu_nodes");
|
||||
}
|
||||
// subnets
|
||||
if($_SESSION['suser_menu_subnets']=='on') {
|
||||
$tp->parse("menu_subnets");
|
||||
} else {
|
||||
$tp->hide("menu_subnets");
|
||||
}
|
||||
// users
|
||||
if($_SESSION['suser_menu_users']=='on') {
|
||||
$tp->parse("menu_users");
|
||||
} else {
|
||||
$tp->hide("menu_users");
|
||||
}
|
||||
// vlans
|
||||
if($_SESSION['suser_menu_vlans']=='on') {
|
||||
$tp->parse("menu_vlans");
|
||||
} else {
|
||||
$tp->hide("menu_vlans");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
?>
|
112
image.php
|
@ -1,16 +1,106 @@
|
|||
<?php
|
||||
// get desired color
|
||||
$color = $_GET['color'];
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2007-2009 Wietse Warendorff
|
||||
|
||||
// create base image
|
||||
$image = imagecreatetruecolor(6, 6);
|
||||
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.
|
||||
|
||||
// fill image with color
|
||||
$color = imagecolorallocate($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));
|
||||
imagefill($image, 0, 0, $color);
|
||||
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.
|
||||
|
||||
// display image
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
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");
|
||||
|
||||
// icon image
|
||||
if(isset($_GET['icon'])) {
|
||||
// get desired image
|
||||
$icon = sanitize($_GET['icon']);
|
||||
|
||||
// switch selected
|
||||
switch($icon) {
|
||||
case ("add") :
|
||||
$png = 'page_add';
|
||||
break;
|
||||
case ("back") :
|
||||
$png = 'control_rewind_blue';
|
||||
break;
|
||||
case ("cancel") :
|
||||
$png = 'control_rewind_blue';
|
||||
break;
|
||||
case ("comment") :
|
||||
$png = 'comment';
|
||||
break;
|
||||
case ("delete") :
|
||||
$png = 'page_delete';
|
||||
break;
|
||||
case ("edit") :
|
||||
$png = 'page_edit';
|
||||
break;
|
||||
case ("error") :
|
||||
$png = 'error';
|
||||
break;
|
||||
case ("help") :
|
||||
$png = 'help';
|
||||
break;
|
||||
case ("logo") :
|
||||
$png = 'logo';
|
||||
break;
|
||||
case ("next") :
|
||||
$png = 'control_fastforward_blue';
|
||||
break;
|
||||
case ("save") :
|
||||
$png = 'page_save';
|
||||
break;
|
||||
case ("search") :
|
||||
$png = 'magnifier';
|
||||
break;
|
||||
}
|
||||
|
||||
// get image
|
||||
$image = imagecreatefrompng("images/" . $png . ".png");
|
||||
|
||||
// alpha blending
|
||||
imagealphablending($image, true);
|
||||
|
||||
// save alphablending setting
|
||||
imagesavealpha($image, true);
|
||||
|
||||
// display image
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
|
||||
// colored block
|
||||
if(isset($_GET['color'])) {
|
||||
// get desired color
|
||||
$color = sanitize($_GET['color']);
|
||||
|
||||
// create base image
|
||||
$image = imagecreatetruecolor($_SESSION['suser_imagesize'], $_SESSION['suser_imagesize']);
|
||||
|
||||
// build color
|
||||
$color = imagecolorallocate($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));
|
||||
|
||||
// fill image with color
|
||||
imagefill($image, 0, 0, $color);
|
||||
|
||||
// display image
|
||||
header('Content-type: image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
}
|
||||
?>
|
BIN
images/add.gif
Before Width: | Height: | Size: 141 B |
After Width: | Height: | Size: 230 B |
BIN
images/check.gif
Before Width: | Height: | Size: 138 B |
After Width: | Height: | Size: 413 B |
Before Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 745 B |
BIN
images/del.gif
Before Width: | Height: | Size: 145 B |
BIN
images/edit.gif
Before Width: | Height: | Size: 197 B |
After Width: | Height: | Size: 666 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 615 B |
BIN
images/next.gif
Before Width: | Height: | Size: 131 B |
After Width: | Height: | Size: 739 B |
After Width: | Height: | Size: 740 B |
After Width: | Height: | Size: 807 B |
After Width: | Height: | Size: 641 B |
After Width: | Height: | Size: 774 B |
BIN
images/prev.gif
Before Width: | Height: | Size: 131 B |
BIN
images/save.gif
Before Width: | Height: | Size: 242 B |
Before Width: | Height: | Size: 211 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 702 B |
78
includes.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,64 +20,26 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
session_start();
|
||||
// session
|
||||
// start session
|
||||
session_start();
|
||||
|
||||
// check for user_id, if unnkown, redirect to login
|
||||
if(empty($_SESSION['suser_id'])) {
|
||||
// redirect
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
// check for user_id, if unnkown -> login
|
||||
if(empty($_SESSION['suser_id'])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
// headers
|
||||
// raw http headers
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
include("functions.php");
|
||||
include("yapter.php");
|
||||
|
||||
// auth items
|
||||
$authitems = array(
|
||||
'ipreg' => array(
|
||||
'name' => 'IP Reg',
|
||||
),
|
||||
'asset' => array(
|
||||
'name' => 'Asset',
|
||||
'item_id' => 'asset_id',
|
||||
'item_name' => 'asset_name',
|
||||
),
|
||||
'assetclass' => array(
|
||||
'name' => 'Assetclass',
|
||||
'item_id' => 'assetclass_id',
|
||||
'item_name' => 'assetclass_name',
|
||||
),
|
||||
'location' => array(
|
||||
'name' => 'Location',
|
||||
'item_id' => 'location_id',
|
||||
'item_name' => 'location_name',
|
||||
),
|
||||
'node' => array(
|
||||
'name' => 'Node',
|
||||
'item_id' => 'node_id',
|
||||
'item_name' => 'ip',
|
||||
),
|
||||
'subnet' => array(
|
||||
'name' => 'Subnet',
|
||||
'item_id' => 'subnet_id',
|
||||
'item_name' => 'subnet_address',
|
||||
),
|
||||
'user' => array(
|
||||
'name' => 'User',
|
||||
'item_id' => 'user_id',
|
||||
'item_name' => 'user_name',
|
||||
),
|
||||
'userclass' => array(
|
||||
'name' => 'Userclass',
|
||||
'item_id' => 'userclass_id',
|
||||
'item_name' => 'userclass_name',
|
||||
),
|
||||
'vlan' => array(
|
||||
'name' => 'VLAN',
|
||||
'item_id' => 'vlan_id',
|
||||
'item_name' => 'vlan_name',
|
||||
),
|
||||
);
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
|
||||
// load lib
|
||||
include("lib.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");
|
||||
?>
|
|
@ -1,142 +0,0 @@
|
|||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
|
||||
CREATE TABLE `asset` (
|
||||
`asset_id` int(10) NOT NULL auto_increment,
|
||||
`asset_name` varchar(100) NOT NULL default '',
|
||||
`hostname` varchar(100) NOT NULL default '',
|
||||
`assetclass_id` int(10) NOT NULL default '0',
|
||||
`asset_info` text NOT NULL,
|
||||
PRIMARY KEY (`asset_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `asset` (`asset_id`, `asset_name`, `hostname`, `assetclass_id`, `asset_info`) VALUES
|
||||
(1, 'TestPC', 'TestPC', 1, 'This is just a test PC');
|
||||
|
||||
CREATE TABLE `assetclass` (
|
||||
`assetclass_id` int(10) NOT NULL auto_increment,
|
||||
`assetclassgroup_id` int(10) NOT NULL default '0',
|
||||
`assetclass_name` varchar(100) NOT NULL default '',
|
||||
PRIMARY KEY (`assetclass_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
|
||||
|
||||
INSERT INTO `assetclass` (`assetclass_id`, `assetclassgroup_id`, `assetclass_name`) VALUES
|
||||
(1, 1, 'PC'),
|
||||
(2, 2, 'Switch');
|
||||
|
||||
CREATE TABLE `assetclassgroup` (
|
||||
`assetclassgroup_id` int(10) NOT NULL auto_increment,
|
||||
`assetclassgroup_name` varchar(100) NOT NULL default '',
|
||||
`color` varchar(6) NOT NULL,
|
||||
PRIMARY KEY (`assetclassgroup_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
|
||||
|
||||
INSERT INTO `assetclassgroup` (`assetclassgroup_id`, `assetclassgroup_name`, `color`) VALUES
|
||||
(1, 'Workstations', '000000'),
|
||||
(2, 'Network', 'FF0000');
|
||||
|
||||
CREATE TABLE `location` (
|
||||
`location_id` int(10) NOT NULL auto_increment,
|
||||
`location_name` varchar(100) NOT NULL default '',
|
||||
`parent` int(1) NOT NULL default '0',
|
||||
`location_info` text NOT NULL,
|
||||
PRIMARY KEY (`location_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `location` (`location_id`, `location_name`, `parent`, `location_info`) VALUES
|
||||
(1, 'Main Office', 0, 'Our Main Office Building');
|
||||
|
||||
CREATE TABLE `node` (
|
||||
`node_id` int(10) NOT NULL auto_increment,
|
||||
`ip` varchar(15) NOT NULL default '',
|
||||
`mac` varchar(12) NOT NULL default '',
|
||||
`dns1` varchar(100) NOT NULL default '',
|
||||
`dns2` varchar(100) NOT NULL default '',
|
||||
`subnet_id` int(10) NOT NULL default '0',
|
||||
`asset_id` int(10) NOT NULL default '0',
|
||||
`node_info` text NOT NULL,
|
||||
PRIMARY KEY (`node_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `node` (`node_id`, `ip`, `mac`, `dns1`, `dns2`, `subnet_id`, `asset_id`, `node_info`) VALUES
|
||||
(1, '192.168.0.1', '', '', '', 1, 1, '');
|
||||
|
||||
CREATE TABLE `subnet` (
|
||||
`subnet_id` int(10) NOT NULL auto_increment,
|
||||
`subnet_address` varchar(15) NOT NULL default '',
|
||||
`subnet_mask` int(2) NOT NULL default '0',
|
||||
`vlan_id` int(10) NOT NULL default '0',
|
||||
`subnet_info` text NOT NULL,
|
||||
PRIMARY KEY (`subnet_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `subnet` (`subnet_id`, `subnet_address`, `subnet_mask`, `vlan_id`, `subnet_info`) VALUES
|
||||
(1, '192.168.0.1', 24, 1, '');
|
||||
|
||||
CREATE TABLE `subnetlocation` (
|
||||
`subnetlocation_id` int(10) NOT NULL auto_increment,
|
||||
`subnet_id` int(10) NOT NULL default '0',
|
||||
`location_id` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`subnetlocation_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `subnetlocation` (`subnetlocation_id`, `subnet_id`, `location_id`) VALUES
|
||||
(1, 1, 1);
|
||||
|
||||
CREATE TABLE `user` (
|
||||
`user_id` int(10) NOT NULL auto_increment,
|
||||
`user_name` varchar(100) NOT NULL default '',
|
||||
`user_pass` varchar(32) NOT NULL default '',
|
||||
`user_level` int(1) NOT NULL default '0',
|
||||
`user_displayname` varchar(100) NOT NULL default '',
|
||||
`user_mac` varchar(25) NOT NULL default 'xxxxxxxxxxxx',
|
||||
`user_lang` varchar(3) NOT NULL default '',
|
||||
PRIMARY KEY (`user_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `user` (`user_id`, `user_name`, `user_pass`, `user_level`, `user_displayname`, `user_mac`, `user_lang`) VALUES
|
||||
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 2, 'admin', 'xxxxxxxxxxxx', 'en');
|
||||
|
||||
CREATE TABLE `userclass` (
|
||||
`userclass_id` int(10) NOT NULL auto_increment,
|
||||
`userclass_name` varchar(100) collate latin1_general_ci NOT NULL,
|
||||
PRIMARY KEY (`userclass_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `userclass` (`userclass_id`, `userclass_name`) VALUES
|
||||
(1, 'IP Reg Administrators');
|
||||
|
||||
CREATE TABLE `userclassauth` (
|
||||
`userclassauth_id` int(10) NOT NULL auto_increment,
|
||||
`ordering` int(3) NOT NULL,
|
||||
`userclass_id` int(10) NOT NULL,
|
||||
`item` varchar(100) collate latin1_general_ci NOT NULL,
|
||||
`id` int(10) NOT NULL,
|
||||
`auth` int(1) NOT NULL,
|
||||
PRIMARY KEY (`userclassauth_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;
|
||||
|
||||
|
||||
INSERT INTO `userclassauth` (`userclassauth_id`, `ordering`, `userclass_id`, `item`, `id`, `auth`) VALUES
|
||||
(1, 1, 1, 'ipreg', 0, 2);
|
||||
|
||||
CREATE TABLE `useruserclass` (
|
||||
`useruserclass_id` int(10) NOT NULL auto_increment,
|
||||
`user_id` int(10) NOT NULL,
|
||||
`userclass_id` int(10) NOT NULL,
|
||||
PRIMARY KEY (`useruserclass_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;
|
||||
|
||||
|
||||
INSERT INTO `useruserclass` (`useruserclass_id`, `user_id`, `userclass_id`) VALUES
|
||||
(1, 1, 1);
|
||||
|
||||
CREATE TABLE `vlan` (
|
||||
`vlan_id` int(10) NOT NULL auto_increment,
|
||||
`vlan_number` int(3) NOT NULL default '0',
|
||||
`vlan_name` varchar(100) NOT NULL default '',
|
||||
`vlan_info` text NOT NULL,
|
||||
PRIMARY KEY (`vlan_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
|
||||
|
||||
INSERT INTO `vlan` (`vlan_id`, `vlan_number`, `vlan_name`, `vlan_info`) VALUES
|
||||
(1, 1, 'VLAN', 'Default VLAN');
|
|
@ -1,18 +1,16 @@
|
|||
---
|
||||
--- IP Reg 0.4
|
||||
--- http://sourceforge.net/projects/ipreg
|
||||
---
|
||||
IP Reg Installation
|
||||
|
||||
Installation instructions
|
||||
1. Create database
|
||||
Create a database for IP Reg on your web server, as well as a MySQL user who has all privileges for accessing and modifying it.
|
||||
|
||||
1) Create your MYSQL-database
|
||||
2. Run import
|
||||
Import the mysql.sql file into your database, which will create the tables and some sample data.
|
||||
|
||||
2) Use install.sql to create the tables and insert the first data
|
||||
3. Edit config file
|
||||
Open config.php in a text editor and fill in your database details.
|
||||
|
||||
3) Update config.php with your settings
|
||||
4. Upload files
|
||||
Upload all files and directory's (except the install directory) to your webserver.
|
||||
|
||||
4) Copy all files to your webserver (exclude install directory)
|
||||
|
||||
5) Start your browser, log in with admin/admin
|
||||
|
||||
6) Please report your comments at http://www.newtree.nl/ipreg
|
||||
5. Start using IP Reg
|
||||
Start your browser and login to IP Reg with the default username/password: admin/admin
|
|
@ -0,0 +1,143 @@
|
|||
CREATE TABLE asset (
|
||||
asset_id int(10) NOT NULL auto_increment,
|
||||
asset_name varchar(100) NOT NULL,
|
||||
asset_hostname varchar(100) NOT NULL,
|
||||
assetclass_id int(10) NOT NULL,
|
||||
asset_info text NOT NULL,
|
||||
PRIMARY KEY (asset_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO asset (asset_name, assetclass_id) VALUES
|
||||
('My Computer', 1),
|
||||
('My Server', 2);
|
||||
|
||||
|
||||
CREATE TABLE assetclass (
|
||||
assetclass_id int(10) NOT NULL auto_increment,
|
||||
assetclassgroup_id int(10) NOT NULL,
|
||||
assetclass_name varchar(100) NOT NULL,
|
||||
PRIMARY KEY (assetclass_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
|
||||
(1, 'PC'),
|
||||
(2, 'Server');
|
||||
|
||||
|
||||
CREATE TABLE assetclassgroup (
|
||||
assetclassgroup_id int(10) NOT NULL auto_increment,
|
||||
assetclassgroup_name varchar(100) NOT NULL,
|
||||
assetclassgroup_color varchar(6) NOT NULL,
|
||||
PRIMARY KEY (assetclassgroup_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
|
||||
('Workstations', 000000);
|
||||
|
||||
|
||||
CREATE TABLE location (
|
||||
location_id int(10) NOT NULL auto_increment,
|
||||
location_name varchar(100) NOT NULL,
|
||||
location_parent int(1) NOT NULL default 0,
|
||||
location_info text NOT NULL,
|
||||
PRIMARY KEY (location_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO location (location_name, location_parent) VALUES
|
||||
('Main Office', 0);
|
||||
|
||||
|
||||
CREATE TABLE nat (
|
||||
nat_id int(10) NOT NULL auto_increment,
|
||||
nat_type int(1) NOT NULL,
|
||||
nat_ext int(10) NOT NULL,
|
||||
nat_int int(10) NOT NULL,
|
||||
PRIMARY KEY (nat_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
||||
CREATE TABLE node (
|
||||
node_id int(10) NOT NULL auto_increment,
|
||||
node_ip varchar(15) NOT NULL,
|
||||
node_mac varchar(12) NOT NULL,
|
||||
node_dns1 varchar(100) NOT NULL,
|
||||
node_dns2 varchar(100) NOT NULL,
|
||||
subnet_id int(10) NOT NULL,
|
||||
asset_id int(10) NOT NULL,
|
||||
node_info text NOT NULL,
|
||||
PRIMARY KEY (node_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
|
||||
('192.168.1.2', '001122334455', 1, 1),
|
||||
('192.168.1.1', 'aabbccddeeff', 1, 2);
|
||||
|
||||
|
||||
CREATE TABLE subnet (
|
||||
subnet_id int(10) NOT NULL auto_increment,
|
||||
subnet_address varchar(15) NOT NULL,
|
||||
subnet_mask int(2) NOT NULL,
|
||||
subnet_info text NOT NULL,
|
||||
PRIMARY KEY (subnet_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
||||
INSERT INTO subnet (subnet_address, subnet_mask) VALUES
|
||||
('192.168.0.0', 24);
|
||||
|
||||
|
||||
CREATE TABLE subnetlocation (
|
||||
subnetlocation_id int(10) NOT NULL auto_increment,
|
||||
subnet_id int(10) NOT NULL,
|
||||
location_id int(10) NOT NULL,
|
||||
PRIMARY KEY (subnetlocation_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO subnetlocation (subnet_id, location_id) VALUES
|
||||
(1, 1);
|
||||
|
||||
|
||||
CREATE TABLE subnetvlan (
|
||||
subnetvlan_id int(10) NOT NULL auto_increment,
|
||||
subnet_id int(10) NOT NULL,
|
||||
vlan_id int(10) NOT NULL,
|
||||
PRIMARY KEY (subnetvlan_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
|
||||
CREATE TABLE user (
|
||||
user_id int(10) NOT NULL auto_increment,
|
||||
user_name varchar(100) NOT NULL,
|
||||
user_pass varchar(32) NOT NULL,
|
||||
user_displayname varchar(100) NOT NULL,
|
||||
user_imagesize int(3) NOT NULL default 6,
|
||||
user_imagecount int(3) NOT NULL default 64,
|
||||
user_mac varchar(25) NOT NULL default 'xxxxxxxxxxxx',
|
||||
user_dateformat varchar(10) NOT NULL default 'd M Y H:i',
|
||||
user_dns1suffix varchar(100) NOT NULL,
|
||||
user_dns2suffix varchar(100) NOT NULL,
|
||||
user_menu_assets varchar(2) NOT NULL default 'on',
|
||||
user_menu_assetclasses varchar(2) NOT NULL default 'on',
|
||||
user_menu_assetclassgroups varchar(2) NOT NULL default 'on',
|
||||
user_menu_locations varchar(2) NOT NULL default 'on',
|
||||
user_menu_nodes varchar(2) NOT NULL default 'on',
|
||||
user_menu_subnets varchar(2) NOT NULL default 'on',
|
||||
user_menu_users varchar(2) NOT NULL default 'on',
|
||||
user_menu_vlans varchar(2) NOT NULL default 'on',
|
||||
PRIMARY KEY (user_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO user (user_name, user_pass, user_displayname, user_imagesize, user_imagecount, user_mac, user_dateformat, user_menu_assets, user_menu_assetclasses, user_menu_assetclassgroups, user_menu_locations, user_menu_nodes, user_menu_subnets, user_menu_users, user_menu_vlans) VALUES
|
||||
('admin', '21232f297a57a5a743894a0e4a801fc3', 'administrator', 6, 64, 'xxxxxxxxxxxx', 'd M Y H:i', 'on', 'on', 'on', 'on', 'on', 'on', 'on', 'on');
|
||||
|
||||
|
||||
CREATE TABLE vlan (
|
||||
vlan_id int(10) NOT NULL auto_increment,
|
||||
vlan_number int(3) NOT NULL,
|
||||
vlan_name varchar(100) NOT NULL,
|
||||
vlan_info text NOT NULL,
|
||||
PRIMARY KEY (vlan_id)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
|
||||
|
||||
INSERT INTO vlan (vlan_number, vlan_name) VALUES
|
||||
(1, 'DEFAULT_VLAN');
|
116
lang/en.php
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
$lang = array(
|
||||
'lang_ipreg' => 'IP Reg',
|
||||
|
||||
'lang_asset' => 'Asset',
|
||||
'lang_assets' => 'Assets',
|
||||
'lang_assetclass' => 'Assetclass',
|
||||
|
@ -9,12 +11,11 @@ $lang = array(
|
|||
'lang_assetclassgroups' => 'Assetclassgroups',
|
||||
'lang_location' => 'Location',
|
||||
'lang_locations' => 'Locations',
|
||||
'lang_menu' => 'Menu',
|
||||
'lang_node' => 'Node',
|
||||
'lang_nodes' => 'Nodes',
|
||||
'lang_user' => 'User',
|
||||
'lang_users' => 'Users',
|
||||
'lang_userclass' => 'Userclass',
|
||||
'lang_userclasses' => 'Userclasses',
|
||||
'lang_sublocation' => 'Sub-location',
|
||||
'lang_sublocations' => 'Sub-locations',
|
||||
'lang_subnet' => 'Subnet',
|
||||
|
@ -27,45 +28,52 @@ $lang = array(
|
|||
'lang_cancel' => 'Cancel',
|
||||
'lang_color' => 'Color',
|
||||
'lang_error' => 'Error',
|
||||
'lang_header_viewby' => 'View by',
|
||||
'lang_item' => 'Item',
|
||||
'lang_language' => 'Language',
|
||||
'lang_login' => 'Login',
|
||||
'lang_logout' => 'Logout',
|
||||
'lang_options' => 'Options',
|
||||
'lang_reset' => 'Reset',
|
||||
'lang_search' => 'Search!',
|
||||
'lang_search' => 'Search',
|
||||
'lang_statistics' => 'Statistics',
|
||||
'lang_subitem' => 'Sub-Item',
|
||||
'lang_submit' => 'Submit',
|
||||
'lang_unassigned' => 'Unassigned',
|
||||
'lang_userclassauth' => 'Authorization',
|
||||
'lang_warning' => 'Warning',
|
||||
|
||||
'lang_asset_add' => 'Add asset',
|
||||
'lang_asset_del' => 'Delete asset',
|
||||
'lang_asset_edit' => 'Modify asset',
|
||||
'lang_asset_info' => 'Asset info',
|
||||
'lang_asset_name' => 'Asset name',
|
||||
'lang_hostname' => 'Hostname',
|
||||
'lang_asset_hostname' => 'Hostname',
|
||||
|
||||
'lang_assetclass_add' => 'Add assetclass',
|
||||
'lang_assetclass_del' => 'Delete assetclass',
|
||||
'lang_assetclass_edit' => 'Mofidy assetclass',
|
||||
'lang_assetclass_name' => 'Assetclass name',
|
||||
|
||||
'lang_userclassauth_add' => 'Add authorization',
|
||||
'lang_userclassauth_del' => 'Delete authorization',
|
||||
'lang_userclassauth_edit' => 'Mofidy authorization',
|
||||
|
||||
'lang_assetclassgroup_add' => 'Add assetclassgroup',
|
||||
'lang_assetclassgroup_del' => 'Delete assetclassgroup',
|
||||
'lang_assetclassgroup_edit' => 'Modify assetclassgroup',
|
||||
'lang_assetclassgroup_name' => 'Assetclass Groupname',
|
||||
|
||||
'lang_assigniptoasset' => 'Assign IP to asset',
|
||||
'lang_assignnodetoasset' => 'Assign node to asset',
|
||||
'lang_assignnodetoasset_existing' => 'Assign node to existing asset',
|
||||
'lang_assignnodetoasset_new' => 'Assign node to new asset',
|
||||
'lang_assigniptonode' => 'Assign IP to node',
|
||||
'lang_assigniptonode_existing' => 'Assign IP to existing node',
|
||||
'lang_assigniptonode_new' => 'Assign IP to new node',
|
||||
'lang_assignlocationtosubnet' => 'Assign location to subnet',
|
||||
'lang_assignlocationtosubnet_existing' => 'Assign location to existing subnet',
|
||||
'lang_assignlocationtosubnet_new' => 'Assign location to new subnet',
|
||||
'lang_assignsubnettovlan' => 'Assign subnet to VLAN',
|
||||
'lang_assignsubnettovlan_existing' => 'Assign subnet to existing VLAN',
|
||||
'lang_assignsubnettovlan_new' => 'Assign subnet to new VLAN',
|
||||
'lang_assignvlantosubnet' => 'Assign VLAN to subnet',
|
||||
|
||||
'lang_assignvlantosubnet_existing' => 'Assign VLAN to existing subnet',
|
||||
'lang_assignvlantosubnet_new' => 'Assign VLAN to new subnet',
|
||||
|
||||
'lang_location_add' => 'Add location',
|
||||
'lang_location_del' => 'Delete location',
|
||||
'lang_location_edit' => 'Mofidy location',
|
||||
|
@ -74,51 +82,66 @@ $lang = array(
|
|||
'lang_location_parent' => 'Parent',
|
||||
'lang_sublocation_add' => 'Add Sub-location',
|
||||
|
||||
'lang_locationsubnet' => 'Location/Subnet',
|
||||
'lang_locationsubnet_edit' => 'Edit Location/Subnet',
|
||||
|
||||
'lang_node_add' => 'Add node',
|
||||
'lang_node_del' => 'Delete node',
|
||||
'lang_node_edit' => 'Modify node',
|
||||
'lang_node_info' => 'Node info',
|
||||
'lang_node_new' => 'Create new node',
|
||||
'lang_dns1' => 'DNS name',
|
||||
'lang_dns2' => 'DNS Alias',
|
||||
'lang_ip' => 'IP Address',
|
||||
'lang_mac' => 'MAC Address',
|
||||
|
||||
'lang_search_found' => 'found',
|
||||
'lang_nat' => 'NAT',
|
||||
'lang_nat_add' => 'Add NAT',
|
||||
'lang_nat_del' => 'Delete NAT',
|
||||
'lang_nat_edit' => 'Modify NAT',
|
||||
'lang_nat_rules' => 'NAT Rules',
|
||||
'lang_nat_type' => 'Type',
|
||||
'lang_nat_type_1' => 'Hide',
|
||||
'lang_nat_type_2' => 'Static',
|
||||
'lang_nat_type_3' => 'Dynamic',
|
||||
|
||||
'lang_search_results_found' => 'Total results found',
|
||||
|
||||
'lang_subnet_add' => 'Add subnet',
|
||||
'lang_subnet_subnetaddress' => 'Subnet address',
|
||||
'lang_subnet_subnetaddress_mask' => 'Subnet address/Mask',
|
||||
'lang_subnet_broadcastaddress' => 'Broadcast address',
|
||||
'lang_subnet_nodesinsubnet' => 'Nodes in subnet',
|
||||
'lang_subnet_subnetused' => 'Subnet used',
|
||||
'lang_subnet_del' => 'Delete subnet',
|
||||
'lang_subnet_edit' => 'Modify subnet',
|
||||
'lang_subnet_info' => 'Subnet info',
|
||||
'lang_subnet_mask' => 'Subnet mask',
|
||||
|
||||
'lang_subnetlocation' => 'Subnet/Location',
|
||||
'lang_subnetlocation_edit' => 'Edit Subnet/Location',
|
||||
'lang_subnetvlan' => 'Subnet/VLAN',
|
||||
'lang_subnetvlan_edit' => 'Edit Subnet/VLAN',
|
||||
|
||||
'lang_user_add' => 'Add user',
|
||||
'lang_user_del' => 'Delete user',
|
||||
'lang_user_displayname' => 'Displayname',
|
||||
'lang_user_edit' => 'Mofidy user',
|
||||
'lang_user_level' => 'Userlevel',
|
||||
'lang_user_name' => 'Username',
|
||||
'lang_user_pass' => 'Password',
|
||||
'lang_user_passnew1' => 'New password',
|
||||
'lang_user_passnew2' => 'Retype new password',
|
||||
'lang_user_passold' => 'Current password',
|
||||
|
||||
'lang_userclass_add' => 'Add userclass',
|
||||
'lang_userclass_del' => 'Delete userclass',
|
||||
'lang_userclass_edit' => 'Modify userclass',
|
||||
'lang_userclass_name' => 'Userclass name',
|
||||
'lang_user_password' => 'Password',
|
||||
|
||||
'lang_vlan_add' => 'Add VLAN',
|
||||
'lang_vlan_del' => 'Delete VLAN',
|
||||
'lang_vlan_edit' => 'Modify VLAN',
|
||||
'lang_vlan_number' => 'VLAN ID',
|
||||
'lang_vlan_info' => 'VLAN info',
|
||||
'lang_vlan_new' => 'VLAN info',
|
||||
'lang_vlan_name' => 'VLAN name',
|
||||
|
||||
'lang_vlansubnet' => 'VLAN/Subnet',
|
||||
'lang_vlansubnet_edit' => 'Edit VLAN/Subnet',
|
||||
|
||||
'lang_comments' => 'Comments',
|
||||
'lang_comments_error' => 'Error',
|
||||
'lang_comments_asset_del_nodes' => 'These nodes will also be deleted!',
|
||||
'lang_comments_ipinuse' => 'IP in use',
|
||||
'lang_comments_notallowed' => 'Not allowed',
|
||||
|
@ -126,9 +149,48 @@ $lang = array(
|
|||
'lang_comments_usernameinuse' => 'Username in use',
|
||||
|
||||
'lang_options_ipreg' => 'IP Reg options',
|
||||
'lang_options_password_edit' => 'Modify password',
|
||||
'lang_options_personal' => 'Personal options',
|
||||
'lang_options_settings_edit' => 'Modify settings',
|
||||
'lang_options_display' => 'Display options',
|
||||
'lang_options_password' => 'Change password',
|
||||
'lang_options_imagesize' => 'Imagesize',
|
||||
'lang_options_imagesize_help' => 'Size (in pixels) of colored square on subnetview',
|
||||
'lang_options_imagecount' => 'Imagecount',
|
||||
'lang_options_imagecount_help' => 'Nr of colored squares per row on subnetview',
|
||||
'lang_options_mac' => 'MAC Address',
|
||||
'lang_options_mac_help' => 'Format in which a MAC address is displayed (e.g. xx-xx-xx-xx-xx-xx)',
|
||||
'lang_options_menu_help' => 'Select items to be displayed in menu',
|
||||
'lang_options_dateformat' => 'Date format',
|
||||
'lang_options_dateformat_help' => 'Format in which dates are displayed using the php-date-format (see http://www.php.net/date for more info)',
|
||||
'lang_options_dns1suffix' => 'DNS Name suffix',
|
||||
'lang_options_dns1suffix_help' => 'Default DNS Name suffix when creating a new node',
|
||||
'lang_options_dns2suffix' => 'DNS Alias suffix',
|
||||
'lang_options_dns2suffix_help' => 'Default DNS Alias suffix when creating a new node',
|
||||
'lang_options_currentpassword' => 'Current password',
|
||||
'lang_options_currentpassword_help' => 'Enter your current password',
|
||||
'lang_options_newpassword1' => 'New password',
|
||||
'lang_options_newpassword1_help' => 'Enter your new password',
|
||||
'lang_options_newpassword2' => 'Retype new password',
|
||||
'lang_options_newpassword2_help' => 'Re-type your new password',
|
||||
|
||||
'lang_about_sfprojectpage' => 'Sourceforge Project Page',
|
||||
'lang_about_license' => 'lang_about_license',
|
||||
'lang_about_gpl' => 'GNU General Public License (GPL)',
|
||||
'lang_about_yapter' => 'Yapter Template Engine',
|
||||
'lang_about_iconset' => 'Silk icon set 1.3',
|
||||
'lang_about_ipreg_ext' => 'IP Reg, a PHP/MySQL IPAM tool',
|
||||
'lang_about_license_ext' => 'Copyright (C) 2007-2009 Wietse Warendorff<p>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.<p>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.<p> You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.',
|
||||
|
||||
'lang_about_changelog' => 'Changelog (major changes only)',
|
||||
'lang_about_changelog_v05' => 'v0.5 (dec 2009)',
|
||||
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>More user options',
|
||||
'lang_about_changelog_v04' => 'v0.4 (jun 2008)',
|
||||
'lang_about_changelog_v04_ext' => '- SQL vulnerability fixed<br>- PHP-generated images in subnet overview',
|
||||
'lang_about_changelog_v03' => 'v0.3 (dec 2007)',
|
||||
'lang_about_changelog_v03_ext' => '- Class A subnet support<br>- Multi-language support<br>- User defined options<br>- All configuration options in one file (config.php)',
|
||||
'lang_about_changelog_v02' => 'v0.2 (dec 2007)',
|
||||
'lang_about_changelog_v02_ext' => '- Fixed ordering of IP addresses<br>- Fixed info fields',
|
||||
'lang_about_changelog_v01' => 'v0.1 (dec 2007)',
|
||||
'lang_about_changelog_v01_ext' => '- First beta release',
|
||||
|
||||
);
|
||||
|
||||
?>
|
|
@ -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,21 +20,25 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// functions
|
||||
include("lib/functions.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/userpassedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// classes
|
||||
// db
|
||||
// load class
|
||||
require("lib/db.class.php");
|
||||
|
||||
// create instance
|
||||
$db = new Db();
|
||||
|
||||
// user
|
||||
// load class
|
||||
require("lib/user.class.php");
|
||||
|
||||
// create instance
|
||||
$user = new User();
|
||||
|
||||
// tpl
|
||||
// load class
|
||||
include("lib/yapter.php");
|
||||
?>
|
|
@ -0,0 +1,5 @@
|
|||
function changelink(optVal){
|
||||
if(optVal=="")
|
||||
return false;
|
||||
window.location='subnetview.php?subnet_id='+optVal;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
function changetext(id,newtext) {
|
||||
document.getElementById(id).innerHTML=newtext
|
||||
}
|
|
@ -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,33 +20,36 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("userclass", $config_auth_userclassview, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/userclass.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get userclass info
|
||||
$result = mysql_query("SELECT userclass_id, userclass_name FROM userclass ORDER BY userclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("userclass_id", $row->userclass_id);
|
||||
$tp->set("userclass_name", $row->userclass_name);
|
||||
$tp->parse("userclassrow");
|
||||
class Db {
|
||||
function db_delete($query) {
|
||||
// run query
|
||||
$sql = mysql_query($query) or die(mysql_error());
|
||||
}
|
||||
|
||||
function db_insert($query) {
|
||||
// run query
|
||||
$sql = mysql_query($query) or die(mysql_error());
|
||||
|
||||
// return result
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
function db_select($query) {
|
||||
// run query
|
||||
$sql = mysql_query($query) or die(mysql_error());
|
||||
|
||||
// loop results
|
||||
while($record = mysql_fetch_assoc($sql)) {
|
||||
$result[] = $record;
|
||||
}
|
||||
|
||||
// return array
|
||||
return $result;
|
||||
}
|
||||
|
||||
function db_update($query) {
|
||||
// run query
|
||||
$sql = mysql_query($query) or die(mysql_error());
|
||||
}
|
||||
}
|
||||
if (($i>0) ? $tp->parse("userclass") : $tp->hide("userclass"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.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
|
||||
|
@ -25,7 +25,7 @@
|
|||
// strip chars we don't need
|
||||
$mac = preg_replace("|[^a-fA-F0-9]|", "", $mac);
|
||||
|
||||
// capotolize (just because it looks better eh)
|
||||
// capitalize (just because it looks better eh)
|
||||
$mac = strtoupper($mac);
|
||||
|
||||
// and return
|
||||
|
@ -34,21 +34,23 @@
|
|||
|
||||
// rebuild mac address
|
||||
function write_mac($mac) {
|
||||
// check string length
|
||||
if (strlen($mac)!=12) {
|
||||
// if the MAC is empty, or for whatever reason incorrect, just return
|
||||
return $mac;
|
||||
} else {
|
||||
// length is ok, continue
|
||||
// strip mac to pieces
|
||||
// count to 12...
|
||||
for($i=0;$i<12;$i++) {
|
||||
// ... and strip mac to pieces
|
||||
${"mac".$i} = $mac{$i};
|
||||
}
|
||||
|
||||
// get user preference
|
||||
$user_mac = $_SESSION['suser_mac'];
|
||||
|
||||
// replace user preference with pieces
|
||||
// count to 12 again...
|
||||
for($i=0;$i<12;$i++) {
|
||||
// ... and replace user preference with pieces
|
||||
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
|
||||
}
|
||||
|
||||
|
@ -59,43 +61,34 @@
|
|||
|
||||
// redirect page
|
||||
function header_location($location) {
|
||||
// send header
|
||||
header("location: " . $location);
|
||||
|
||||
// exit to be sure
|
||||
exit;
|
||||
}
|
||||
|
||||
// authorisation check
|
||||
function auth($item, $min_auth, $item_id) {
|
||||
// get user_id
|
||||
$suser_id = $_SESSION['suser_id'];
|
||||
// sanitize input
|
||||
function sanitize($input) {
|
||||
// trim whitespaces
|
||||
$input = @trim($input);
|
||||
|
||||
// set base auth to 0
|
||||
$auth = 0;
|
||||
|
||||
// check for global rights
|
||||
$result = mysql_query("SELECT uc.auth FROM userclassauth uc, useruserclass u WHERE u.user_id='$suser_id' AND uc.userclass_id=u.userclass_id AND uc.item='ipreg' AND uc.id=0 ORDER BY uc.ordering DESC LIMIT 1") or die(mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$auth = $row->auth;
|
||||
}
|
||||
|
||||
// check specific auth for this item
|
||||
$result = mysql_query("SELECT uc.auth FROM userclassauth uc, useruserclass u WHERE u.user_id='$suser_id' AND uc.userclass_id=u.userclass_id AND uc.item='$item' AND uc.id=0 ORDER BY uc.ordering DESC LIMIT 1") or die(mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$auth = $row->auth;
|
||||
// magic quotes enabled?
|
||||
if(get_magic_quotes_gpc()) {
|
||||
// strip slashes
|
||||
$input = stripslashes($input);
|
||||
}
|
||||
|
||||
// and for a specific ID (if set)
|
||||
if($item_id>0) {
|
||||
$result = mysql_query("SELECT uc.auth FROM userclassauth uc, useruserclass u WHERE u.user_id='$suser_id' AND uc.userclass_id=u.userclass_id AND uc.item='$item' AND uc.id='$item_id' ORDER BY uc.ordering DESC LIMIT 1") or die(mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$auth = $row->auth;
|
||||
}
|
||||
}
|
||||
// convert to utf-8
|
||||
iconv("UTF-8", "UTF-8", $input);
|
||||
|
||||
if($auth<$min_auth) {
|
||||
// not allowed -> redirect
|
||||
header_location("comments.php?comments=notallowed");
|
||||
} else {
|
||||
return $auth;
|
||||
}
|
||||
// convert special chars
|
||||
$input = htmlentities($input,ENT_QUOTES,'UTF-8');
|
||||
|
||||
// make sql ready
|
||||
$input = mysql_real_escape_string($input);
|
||||
|
||||
// and return
|
||||
return $input;
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,115 @@
|
|||
<?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
|
||||
*****************************************************************************/
|
||||
|
||||
class User {
|
||||
function check_strlen($string) {
|
||||
// check length
|
||||
if(strlen($string)<1) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
function user_login($user_name, $user_pass) {
|
||||
// check user_name length
|
||||
if($this->check_strlen($user_name)==FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// check user_pass length
|
||||
if($this->check_strlen($user_pass)==FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// get user data
|
||||
// initiate class
|
||||
$db = new Db();
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
user.user_id,
|
||||
user.user_pass,
|
||||
user.user_displayname,
|
||||
user.user_imagesize,
|
||||
user.user_imagecount,
|
||||
user.user_mac,
|
||||
user.user_dateformat,
|
||||
user.user_dns1suffix,
|
||||
user.user_dns2suffix,
|
||||
user.user_menu_assets,
|
||||
user.user_menu_assetclasses,
|
||||
user.user_menu_assetclassgroups,
|
||||
user.user_menu_locations,
|
||||
user.user_menu_nodes,
|
||||
user.user_menu_subnets,
|
||||
user.user_menu_users,
|
||||
user.user_menu_vlans
|
||||
FROM
|
||||
user
|
||||
WHERE
|
||||
user.user_name='" . $user_name . "'";
|
||||
|
||||
// run query
|
||||
$users = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$user_counter = count($users);
|
||||
|
||||
// any users?
|
||||
if ($user_counter>0) {
|
||||
// compare passwords
|
||||
if(!strcmp(md5($user_pass), $users[0]['user_pass'])) {
|
||||
// all ok: user is logged in, register session data
|
||||
$_SESSION['suser_id'] = $users[0]['user_id'];
|
||||
$_SESSION['suser_displayname'] = $users[0]['user_displayname'];
|
||||
$_SESSION['suser_imagesize'] = $users[0]['user_imagesize'];
|
||||
$_SESSION['suser_imagecount'] = $users[0]['user_imagecount'];
|
||||
$_SESSION['suser_mac'] = $users[0]['user_mac'];
|
||||
$_SESSION['suser_dateformat'] = $users[0]['user_dateformat'];
|
||||
$_SESSION['suser_dns1suffix'] = $users[0]['user_dns1suffix'];
|
||||
$_SESSION['suser_dns2suffix'] = $users[0]['user_dns2suffix'];
|
||||
$_SESSION['suser_menu_assets'] = $users[0]['user_menu_assets'];
|
||||
$_SESSION['suser_menu_assetclasses'] = $users[0]['user_menu_assetclasses'];
|
||||
$_SESSION['suser_menu_assetclassgroups'] = $users[0]['user_menu_assetclassgroups'];
|
||||
$_SESSION['suser_menu_locations'] = $users[0]['user_menu_locations'];
|
||||
$_SESSION['suser_menu_nodes'] = $users[0]['user_menu_nodes'];
|
||||
$_SESSION['suser_menu_subnets'] = $users[0]['user_menu_subnets'];
|
||||
$_SESSION['suser_menu_users'] = $users[0]['user_menu_users'];
|
||||
$_SESSION['suser_menu_vlans'] = $users[0]['user_menu_vlans'];
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// no errors found, return
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function user_logout() {
|
||||
// clear and destroy session
|
||||
$_SESSION = array();
|
||||
}
|
||||
}
|
||||
?>
|
176
location.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,78 +20,108 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("location", $config_auth_locationview, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/location.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// create array with parent index and location names
|
||||
$parents = array();
|
||||
$location_names = array();
|
||||
|
||||
// get location information and insert to the arrays
|
||||
$result = mysql_query("SELECT location_id, location_name, parent FROM location") or die(mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$location_names[$row->location_id] = $row->location_name;
|
||||
$parents[$row->parent][] = $row->location_id;
|
||||
}
|
||||
|
||||
// look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
$children = array();
|
||||
foreach ($parents[$parent] as $child) {
|
||||
if (isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
return $children;
|
||||
}
|
||||
|
||||
// recursive children check to template
|
||||
function checkchildren ($array, $level) {
|
||||
global $tp;
|
||||
global $location_names;
|
||||
foreach ($array as $location_id=>$val) {
|
||||
if($val != "") {
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location_names[$location_id]);
|
||||
$tp->set("nbsp", str_repeat("- ",$level));
|
||||
$tp->parse("locationrow");
|
||||
checkchildren($val, $level+1);
|
||||
} else {
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location_names[$location_id]);
|
||||
$tp->set("nbsp", str_repeat("- ",$level));
|
||||
$tp->parse("locationrow");
|
||||
}
|
||||
}
|
||||
$tp->parse("location");
|
||||
$tp->clear("location");
|
||||
}
|
||||
|
||||
// assemble the tree
|
||||
$tree = location($parents);
|
||||
|
||||
// check for values and build template
|
||||
checkchildren($tree, 0);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/location.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
include("footer.php");
|
||||
// start location
|
||||
// look for locations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent
|
||||
FROM
|
||||
location
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("location_counter", $location_counter);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// create arrays
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_parent']][] = $location['location_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
// loop array to check
|
||||
foreach($parents[$parent] as $child) {
|
||||
if(isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// and again...
|
||||
return $children;
|
||||
}
|
||||
|
||||
// to tpl
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
// include template class
|
||||
global $tp;
|
||||
|
||||
// import location names
|
||||
global $location_names;
|
||||
|
||||
// action!
|
||||
foreach ($locations as $parent=>$child) {
|
||||
// send vars to template
|
||||
$tp->set("location_id", $parent);
|
||||
$tp->set("location_name", $location_names[$parent]);
|
||||
$tp->set("nbsp", str_repeat("- ",$level));
|
||||
$tp->parse("location_row");
|
||||
|
||||
// any children?
|
||||
if($child != "") {
|
||||
// yes, so do the loop again!
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
|
||||
// parse and clear for the next round
|
||||
$tp->parse("location_table");
|
||||
$tp->clear("location_table");
|
||||
}
|
||||
|
||||
// assemble the tree
|
||||
$tree = location($parents);
|
||||
|
||||
// check for values and build template
|
||||
checkchildren($tree, 0);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
147
locationadd.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,37 +20,120 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_parent = sanitize($_GET['location_parent']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get id
|
||||
if((isset($_GET['location_id'])) ? $location_id = $_GET['location_id'] : $location_id = "");
|
||||
// start parent
|
||||
// look for locations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent
|
||||
FROM
|
||||
location
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// create arrays
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_parent']][] = $location['location_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
// loop array to check
|
||||
foreach($parents[$parent] as $child) {
|
||||
if(isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// and again...
|
||||
return $children;
|
||||
}
|
||||
|
||||
// to tpl
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
// include template class
|
||||
global $tp;
|
||||
|
||||
// import location names
|
||||
global $location_names;
|
||||
|
||||
// import location names
|
||||
global $location_parent;
|
||||
|
||||
// action!
|
||||
foreach ($locations as $parent=>$child) {
|
||||
// send vars to template
|
||||
$tp->set("location_id", $parent);
|
||||
$tp->set("location_name", $location_names[$parent]);
|
||||
$tp->set("nbsp", str_repeat("- ",$level));
|
||||
|
||||
// set parent selected
|
||||
if($parent==$location_parent) {
|
||||
$tp->set("location_selected", "selected");
|
||||
} else {
|
||||
$tp->set("location_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("location_row");
|
||||
|
||||
// any children?
|
||||
if($child != "") {
|
||||
// yes, so do the loop again!
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
|
||||
// parse and clear for the next round
|
||||
$tp->parse("location_table");
|
||||
$tp->clear("location_table");
|
||||
}
|
||||
|
||||
// assemble the tree
|
||||
$tree = location($parents);
|
||||
|
||||
// check for values and build template
|
||||
checkchildren($tree, 0);
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("location", $config_auth_locationadd, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get location info
|
||||
$result = mysql_query("SELECT location_id, location_name FROM location ORDER BY location_name");
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->location_id==$location_id) ? $tp->set("location_selected", "selected") : $tp->set("location_selected", ""));
|
||||
$tp->set("location_id", $row->location_id);
|
||||
$tp->set("location_name", $row->location_name);
|
||||
$tp->parse("locationrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("location") : $tp->hide("location"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.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,33 +20,43 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_id = $_GET['location_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("location", $config_auth_locationdel, $location_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationdel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get location info
|
||||
$result = mysql_query("SELECT location_name FROM location WHERE location_id='$location_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $row->location_name);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// get id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
include("footer.php");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location[0]['location_name']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
192
locationedit.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,56 +20,148 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_id = $_GET['location_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("location", $config_auth_locationedit, $location_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// check for submit
|
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
|
||||
$location_id = $_POST['location_id'];
|
||||
$location_name = $_POST['location_name'];
|
||||
$parent = $_POST['parent'];
|
||||
$location_info = $_POST['location_info'];
|
||||
mysql_query("UPDATE location SET location_name='$location_name', parent='$parent', location_info='$location_info' WHERE location_id='$location_id'") or die(mysql_error());
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
header_location("locationview.php?location_id=" . $location_id);
|
||||
}
|
||||
|
||||
// get current information
|
||||
$result = mysql_query("SELECT location_name, parent, location_info FROM location WHERE location_id='$location_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$parent = $row->parent;
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $row->location_name);
|
||||
$tp->set("location_info", $row->location_info);
|
||||
|
||||
// get parent info
|
||||
$result = mysql_query("SELECT location_id, location_name FROM location ORDER BY location_name");
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->location_id==$parent) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("parent_id", $row->location_id);
|
||||
$tp->set("parent_name", $row->location_name);
|
||||
$tp->parse("parentrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("parent") : $tp->hide("parent"));
|
||||
// get id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
include("footer.php");
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent,
|
||||
location.location_info AS location_info
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
// get parent
|
||||
$location_parent = $location[0]['location_parent'];
|
||||
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location[0]['location_name']);
|
||||
$tp->set("location_info", $location[0]['location_info']);
|
||||
|
||||
// setup parent location
|
||||
// look for locations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent
|
||||
FROM
|
||||
location
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("location_counter", $location_counter);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// create arrays
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_parent']][] = $location['location_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// look for parents
|
||||
// function to look for parents and create a new array for every child
|
||||
function location($parents, $parent = 0) {
|
||||
// loop array to check
|
||||
foreach($parents[$parent] as $child) {
|
||||
if(isset($parents[$child])) {
|
||||
// element has children
|
||||
$children[$child] = location($parents, $child);
|
||||
} else {
|
||||
// no children, set NULL
|
||||
$children[$child] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// and again...
|
||||
return $children;
|
||||
}
|
||||
|
||||
// to tpl
|
||||
// recursive children check to template
|
||||
function checkchildren($locations, $level) {
|
||||
// include template class
|
||||
global $tp;
|
||||
|
||||
// import location names
|
||||
global $location_names;
|
||||
|
||||
// import current id
|
||||
global $location_id;
|
||||
|
||||
// import parent
|
||||
global $location_parent;
|
||||
|
||||
// action!
|
||||
foreach ($locations as $parent=>$child) {
|
||||
// send vars to template
|
||||
$tp->set("parentlocation_id", $parent);
|
||||
$tp->set("parentlocation_name", $location_names[$parent]);
|
||||
$tp->set("nbsp", str_repeat("- ",$level));
|
||||
|
||||
// set parent selected
|
||||
if($parent==$location_parent) {
|
||||
$tp->set("parentlocation_selected", "selected");
|
||||
} else {
|
||||
$tp->set("parentlocation_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("parentlocation_row");
|
||||
|
||||
// any children?
|
||||
if($child != "") {
|
||||
// yes, so do the loop again!
|
||||
checkchildren($child, $level+1);
|
||||
}
|
||||
}
|
||||
|
||||
// parse and clear for the next round
|
||||
$tp->parse("parentlocation_table");
|
||||
$tp->clear("parentlocation_table");
|
||||
}
|
||||
|
||||
// assemble the tree
|
||||
$tree = location($parents);
|
||||
|
||||
// check for values and build template
|
||||
checkchildren($tree, 0);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,107 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationsubnetadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location[0]['location_name']);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = " SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id NOT IN (
|
||||
SELECT
|
||||
subnet_id
|
||||
FROM
|
||||
subnetlocation
|
||||
WHERE
|
||||
location_id=" . $location_id . "
|
||||
)
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$subnet_counter = count($subnets);
|
||||
|
||||
// any locations?
|
||||
if ($subnet_counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("subnet_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,102 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationsubnetdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location[0]['location_name']);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnetlocation,
|
||||
subnet
|
||||
WHERE
|
||||
subnetlocation.location_id=" . $location_id . "
|
||||
AND subnet.subnet_id=subnetlocation.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$subnet_counter = count($subnets);
|
||||
|
||||
// any locations?
|
||||
if ($subnet_counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("subnet_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,33 +20,43 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("userclassauthadd", $config_auth_userclassauthadd, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/userclassauthadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get userclass info
|
||||
$result = mysql_query("SELECT userclass_id, userclass_name FROM userclass ORDER BY userclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("userclass_id", $row->userclass_id);
|
||||
$tp->set("userclass_name", $row->userclass_name);
|
||||
$tp->parse("userclassrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("userclass") : $tp->hide("userclass"));
|
||||
// get ip and id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationsubnetedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
include("footer.php");
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_name", $location[0]['location_name']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
272
locationview.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,93 +20,195 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$location_id = $_GET['location_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("location", $config_auth_locationview, $location_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationview.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// create breadcrumb arrays
|
||||
$parents = array();
|
||||
$location_names = array();
|
||||
$crumbs = array();
|
||||
|
||||
// get location information and insert to the arrays
|
||||
$result = mysql_query("SELECT location_id, location_name, parent FROM location") or die(mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$location_names[$row->location_id] = $row->location_name;
|
||||
$parents[$row->location_id] = $row->parent;
|
||||
}
|
||||
|
||||
// function to build array with parents
|
||||
function parent($location_id) {
|
||||
// use names index
|
||||
global $parents;
|
||||
global $crumbs;
|
||||
global $location_names;
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// fill array with this value
|
||||
$crumbs[$location_id] = $location_id;
|
||||
if (($parents[$location_id])>0) {
|
||||
// still not on top, so do it again
|
||||
parent($parents[$location_id]);
|
||||
// get id
|
||||
$location_id = sanitize($_GET['location_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/locationview.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start locationcrumb
|
||||
// get locations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent
|
||||
FROM
|
||||
location";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("location_counter", $location_counter);
|
||||
|
||||
// any loactions?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// create arrays
|
||||
$location_names[$location['location_id']] = $location['location_name'];
|
||||
$parents[$location['location_id']] = $location['location_parent'];
|
||||
}
|
||||
}
|
||||
|
||||
// build parents array
|
||||
// function to build array with parents for this location
|
||||
function parent($location_id) {
|
||||
// use names index
|
||||
global $parents;
|
||||
global $crumbs;
|
||||
global $location_names;
|
||||
|
||||
// fill array with this value
|
||||
$crumbs[$location_id] = $location_id;
|
||||
if (($parents[$location_id])>0) {
|
||||
// still not on top, so do it again
|
||||
parent($parents[$location_id]);
|
||||
}
|
||||
|
||||
// return the array
|
||||
return $location_id;
|
||||
}
|
||||
|
||||
// build parents
|
||||
parent($location_id);
|
||||
|
||||
// to tpl
|
||||
// loop in reverse order
|
||||
foreach (array_reverse($crumbs) as $key=>$val) {
|
||||
// send vars to template
|
||||
$tp->set("location_id", $val);
|
||||
$tp->set("location_name", $location_names[$val]);
|
||||
|
||||
// include seperator?
|
||||
if (($key>0) ? $tp->set("seperator", ". ") : $tp->set("seperator", ""));
|
||||
|
||||
// parse block
|
||||
$tp->parse("locationcrumb_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("locationcrumb_table");
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_info AS location_info
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id=" . $location_id;
|
||||
|
||||
// run query
|
||||
$location = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location_id);
|
||||
$tp->set("location_info", nl2br($location[0]['location_info']));
|
||||
|
||||
// setup sublocations
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS sublocation_id,
|
||||
location.location_name AS sublocation_name
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_parent=" . $location_id . "
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$sublocations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$sublocation_counter = count($sublocations);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("sublocation_counter", $sublocation_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($sublocation_counter>0) {
|
||||
// get objects
|
||||
foreach($sublocations AS $sublocation) {
|
||||
// send to tpl
|
||||
$tp->set("sublocation_id", $sublocation['sublocation_id']);
|
||||
$tp->set("sublocation_name", $sublocation['sublocation_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("sublocation_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("sublocation_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("sublocation_table");
|
||||
}
|
||||
|
||||
// setup subnets
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet,
|
||||
subnetlocation
|
||||
WHERE
|
||||
subnetlocation.location_id=" . $location_id . "
|
||||
AND subnetlocation.subnet_id=subnet.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// return the array
|
||||
return $location_id;
|
||||
}
|
||||
|
||||
// build parents
|
||||
parent($location_id);
|
||||
|
||||
// loop array in reverse order and send to template
|
||||
foreach (array_reverse($crumbs) as $key=>$val) {
|
||||
$tp->set("location_id", $val);
|
||||
$tp->set("location_name", $location_names[$val]);
|
||||
if (($key>0) ? $tp->set("seperator", ". ") : $tp->set("seperator", ""));
|
||||
$tp->parse("locationcrumbrow");
|
||||
}
|
||||
$tp->parse("locationcrumb");
|
||||
|
||||
// get location info
|
||||
$result = mysql_query("SELECT location_name, location_info FROM location WHERE location_id='$location_id'");
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("location_info", nl2br($row->location_info));
|
||||
|
||||
// search subnets for this location
|
||||
$result = mysql_query("SELECT s.subnet_id, s.subnet_address, s.subnet_mask FROM subnet s INNER JOIN subnetlocation sl ON s.subnet_id=sl.subnet_id WHERE sl.location_id='$location_id'") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
|
||||
// search sub-locations for this location
|
||||
$result = mysql_query("SELECT location_id, location_name FROM location WHERE parent='$location_id' ORDER BY location_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("sublocation_id", $row->location_id);
|
||||
$tp->set("sublocation_name", $row->location_name);
|
||||
$tp->parse("sublocationrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("sublocation") : $tp->hide("sublocation"));
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// count results
|
||||
$subnet_counter = count($subnets);
|
||||
|
||||
include("footer.php");
|
||||
// counter to tpl
|
||||
$tp->set("subnet_counter", $subnet_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($subnet_counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("subnet_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.php");
|
||||
?>
|
87
login.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,53 +20,60 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// start session with default language
|
||||
session_start();
|
||||
include('lang/en.php');
|
||||
// session
|
||||
// start session
|
||||
session_start();
|
||||
|
||||
// headers
|
||||
// raw http headers
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
include("functions.php");
|
||||
include("yapter.php");
|
||||
// includes
|
||||
include("config.php");
|
||||
include("dbconnect.php");
|
||||
|
||||
// load lib
|
||||
include("lib.php");
|
||||
|
||||
// include language file
|
||||
include('lang/en.php');
|
||||
|
||||
// check for submit
|
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
|
||||
if(isset($_POST['user_name']) && isset($_POST['user_pass']) && trim($_POST['user_name']) <> "" && trim($_POST['user_pass']) <> "") {
|
||||
$user_name = $_POST['user_name'];
|
||||
$result = mysql_query("SELECT user_id, user_pass, user_level, user_displayname, user_mac, user_lang FROM user WHERE user_name='$user_name'") or die(mysql_error());
|
||||
// try login?
|
||||
// check for submit
|
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) {
|
||||
/// get post info
|
||||
$user_name = sanitize($_POST['user_name']);
|
||||
$user_pass = sanitize($_POST['user_pass']);
|
||||
|
||||
if(mysql_num_rows($result) > 0) {
|
||||
if(!strcmp(md5($_POST['user_pass']), mysql_result($result, 0, "user_pass"))) {
|
||||
// all ok, user logged in
|
||||
$_SESSION['suser_id'] = mysql_result($result, 0, "user_id");
|
||||
$_SESSION['suser_level'] = mysql_result($result, 0, "user_level");
|
||||
$_SESSION['suser_displayname'] = mysql_result($result, 0, "user_displayname");
|
||||
$_SESSION['suser_mac'] = mysql_result($result, 0, "user_mac");
|
||||
$_SESSION['suser_lang'] = mysql_result($result, 0, "user_lang");
|
||||
|
||||
header_location("index.php");
|
||||
} else {
|
||||
// login
|
||||
$login = $user->user_login($user_name, $user_pass);
|
||||
|
||||
if($login==TRUE) {
|
||||
// redirect
|
||||
header_location("index.php");
|
||||
} else {
|
||||
// not ok, break session
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
}
|
||||
// clear mysql-result
|
||||
mysql_free_result($result);
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// start output
|
||||
// set template
|
||||
$tp = new Template("tpl/login.tpl");
|
||||
// set template
|
||||
$tp = new Template("tpl/login.tpl", $config_yapter_error);
|
||||
|
||||
// get version for the footer-stamp
|
||||
$tp->set("config_version", $config_version);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
16
logout.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,12 +20,14 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
session_start();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// clear and destroy session
|
||||
$_SESSION = array();
|
||||
session_destroy();
|
||||
|
||||
header("Location: index.php");
|
||||
// logout
|
||||
// user logout
|
||||
$user->user_logout();
|
||||
|
||||
// redirect
|
||||
header("Location: index.php");
|
||||
?>
|
|
@ -0,0 +1,111 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/natadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup node_ext
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_ip AS node_ip_ext
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
$tp->set("node_id_ext", $node_id);
|
||||
$tp->set("node_ip_ext", $node[0]['node_ip_ext']);
|
||||
|
||||
// setup node_int
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
node.node_id AS node_id_int,
|
||||
node.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset,
|
||||
node
|
||||
WHERE
|
||||
node.node_id NOT IN (
|
||||
SELECT
|
||||
nat_int
|
||||
FROM
|
||||
nat
|
||||
WHERE
|
||||
nat_ext=" . $node_id . "
|
||||
)
|
||||
AND node.node_id!=" . $node_id . "
|
||||
AND asset.asset_id=node.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// send to tpl
|
||||
$tp->set("asset_name", $node['asset_name']);
|
||||
|
||||
$tp->set("node_id_int", $node['node_id_int']);
|
||||
$tp->set("node_ip_int", $node['node_ip_int']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,105 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/natdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup node_ext
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_ip AS node_ip_ext
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
$tp->set("node_id_ext", $node_id);
|
||||
$tp->set("node_ip_ext", $node[0]['node_ip_ext']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
node.node_id AS node_id_int,
|
||||
node.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset,
|
||||
nat,
|
||||
node
|
||||
WHERE
|
||||
nat.nat_ext=" . $node_id . "
|
||||
AND node.node_id=nat.nat_int
|
||||
AND asset.asset_id=node.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// send to tpl
|
||||
$tp->set("asset_name", $node['asset_name']);
|
||||
|
||||
$tp->set("node_id_int", $node['node_id_int']);
|
||||
$tp->set("node_ip_int", $node['node_ip_int']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,33 +20,42 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$userclass_id = $_GET['userclass_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("userclass", $config_auth_userclassdel, $userclass_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/userclassdel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get assetclass info
|
||||
$result = mysql_query("SELECT userclass_id, userclass_name FROM userclass WHERE userclass_id='$userclass_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("userclass_id", $row->userclass_id);
|
||||
$tp->set("userclass_name", $row->userclass_name);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/natedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
$tp->set("node_id", $node_id);
|
||||
$tp->set("node_ip", $node[0]['node_ip']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,108 @@
|
|||
<?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 template
|
||||
$tp = new Template("tpl/node.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start node
|
||||
// setup view
|
||||
// subnet
|
||||
if(isset($_GET['subnet_id'])) {
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// build query part
|
||||
$subnet_view = "AND node.subnet_id=" . $subnet_id;
|
||||
|
||||
// to tpl
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
} else {
|
||||
// to tpl
|
||||
$tp->set("subnet_id", "");
|
||||
}
|
||||
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name,
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
asset,
|
||||
node
|
||||
WHERE
|
||||
asset.asset_id=node.asset_id
|
||||
" . $subnet_view . "
|
||||
GROUP BY
|
||||
node.node_id
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("node_counter", $node_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $node['asset_id']);
|
||||
$tp->set("asset_name", $node['asset_name']);
|
||||
|
||||
$tp->set("node_id", $node['node_id']);
|
||||
$tp->set("node_ip", $node['node_ip']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
136
nodeadd.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,52 +20,98 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check for set ip and/or subnet_id
|
||||
if ((isset($_GET['node_ip'])) ? $node_ip = sanitize($_GET['node_ip']) : $node_ip = '');
|
||||
if ((isset($_GET['subnet_id'])) ? $subnet_id = sanitize($_GET['subnet_id']) : $subnet_id = '');
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodeadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("node", $config_auth_nodeadd, 0);
|
||||
// set vars
|
||||
$tp->set("user_dns1suffix", $_SESSION['suser_dns1suffix']);
|
||||
$tp->set("user_dns2suffix", $_SESSION['suser_dns2suffix']);
|
||||
$tp->set("node_ip", $node_ip);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
|
||||
// set subnet selected
|
||||
if($subnet['subnet_id']==$subnet_id) {
|
||||
$tp->set("subnet_selected", "selected");
|
||||
} else {
|
||||
$tp->set("subnet_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodeadd.tpl");
|
||||
// setup assetclass
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclass.assetclass_id AS assetclass_id,
|
||||
assetclass.assetclass_name AS assetclass_name
|
||||
FROM
|
||||
assetclass
|
||||
ORDER BY
|
||||
assetclass.assetclass_name";
|
||||
|
||||
// run query
|
||||
$assetclasses = $db->db_select($query);
|
||||
|
||||
foreach($assetclasses AS $assetclass) {
|
||||
// send to tpl
|
||||
$tp->set("assetclass_id", $assetclass['assetclass_id']);
|
||||
$tp->set("assetclass_name", $assetclass['assetclass_name']);
|
||||
|
||||
if($assetclass['assetclass_id']==$assetclass_id) {
|
||||
$tp->set("assetclass_selected", "selected");
|
||||
} else {
|
||||
$tp->set("assetclass_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclass_table");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// check for set ip and/or subnet_id
|
||||
if ((isset($_GET['ip'])) ? $ip = $tp->set("ip", $_GET['ip']) : $tp->set("ip", ""));
|
||||
if ((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = '');
|
||||
|
||||
// set variables
|
||||
$tp->set("config_dns1suffix", $config_dns1suffix);
|
||||
$tp->set("config_dns2suffix", $config_dns2suffix);
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->subnet_id==$subnet_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
|
||||
// get assetclassgroup information
|
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("assetclass_id", $row->assetclass_id);
|
||||
$tp->set("assetclass_name", $row->assetclass_name);
|
||||
$tp->parse("assetclassrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
71
nodedel.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,34 +20,45 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$node_id = $_GET['node_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("node", $config_auth_nodedel, $node_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodedel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT ip, asset_id FROM node WHERE node_id='$node_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("node_id", $node_id);
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("ip", $row->ip);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodedel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.asset_id AS asset_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.node_id=" . $node_id;
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("node_id", $node_id);
|
||||
$tp->set("asset_id", $node[0]['asset_id']);
|
||||
$tp->set("node_ip", $node[0]['node_ip']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
186
nodeedit.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,60 +20,140 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$node_id = $_GET['node_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("node", $config_auth_nodeedit, $node_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodeedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get node info
|
||||
$result = mysql_query("SELECT asset_id, ip, mac, dns1, dns2, subnet_id, node_info FROM node WHERE node_id='$node_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$asset_id = $row->asset_id;
|
||||
$subnet_id = $row->subnet_id;
|
||||
$tp->set("node_id", $node_id);
|
||||
$tp->set("ip", $row->ip);
|
||||
$tp->set("mac", $row->mac);
|
||||
$tp->set("dns1", $row->dns1);
|
||||
$tp->set("dns2", $row->dns2);
|
||||
$tp->set("node_info", $row->node_info);
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodeedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip,
|
||||
node.node_mac AS node_mac,
|
||||
node.node_dns1 AS node_dns1,
|
||||
node.node_dns2 AS node_dns2,
|
||||
node.node_info AS node_info,
|
||||
subnet.subnet_id AS subnet_id
|
||||
FROM
|
||||
asset,
|
||||
node,
|
||||
subnet
|
||||
WHERE
|
||||
asset.asset_id=node.asset_id
|
||||
AND node.node_id=" . $node_id . "
|
||||
AND subnet.subnet_id=node.subnet_id";
|
||||
|
||||
// run query
|
||||
$node = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("node_id", $node[0]['node_id']);
|
||||
$tp->set("node_ip", $node[0]['node_ip']);
|
||||
$tp->set("node_mac", write_mac($node[0]['node_mac']));
|
||||
$tp->set("node_dns1", $node[0]['node_dns1']);
|
||||
$tp->set("node_dns2", $node[0]['node_dns2']);
|
||||
$tp->set("node_info", $node[0]['node_info']);
|
||||
|
||||
// get asset info
|
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset ORDER BY asset_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->asset_id==$asset_id) ? $tp->set("asset_selected", "selected") : $tp->set("asset_selected", ""));
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->parse("assetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name
|
||||
FROM
|
||||
asset
|
||||
ORDER BY
|
||||
asset.asset_name";
|
||||
|
||||
// run query
|
||||
$assets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$asset_counter = count($assets);
|
||||
|
||||
// any assets?
|
||||
if ($asset_counter>0) {
|
||||
// get objects
|
||||
foreach($assets AS $asset) {
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $asset['asset_id']);
|
||||
$tp->set("asset_name", $asset['asset_name']);
|
||||
|
||||
if($asset['asset_id']==$node[0]['asset_id']) {
|
||||
$tp->set("asset_selected", "selected");
|
||||
} else {
|
||||
$tp->set("asset_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("asset_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("asset_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("asset_table");
|
||||
}
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->subnet_id==$subnet_id) ? $tp->set("subnet_selected", "selected") : $tp->set("subnet_selected", ""));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$subnet_counter = count($subnets);
|
||||
|
||||
// any subnets?
|
||||
if ($subnet_counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
|
||||
if($subnet['subnet_id']==$node[0]['subnet_id']) {
|
||||
$tp->set("subnet_selected", "selected");
|
||||
} else {
|
||||
$tp->set("subnet_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("subnet_table");
|
||||
}
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
79
nodelist.php
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
/*****************************************************************************
|
||||
IP Reg, a PHP/MySQL IPAM tool
|
||||
Copyright (C) 2008 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
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$subnet_id = $_GET['subnet_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("node", $config_auth_nodeview, 0);
|
||||
$auth = auth("subnet", $config_auth_subnetview, $subnet_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodelist.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set variables
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
|
||||
// set ordering
|
||||
if (isset($_GET['order'])) {
|
||||
switch($_GET['order']) {
|
||||
case ("asset_name") : $order = "a.asset_name"; break;
|
||||
case ("hostname") : $order = "a.hostname"; break;
|
||||
case ("mac") : $order = "n.mac"; break;
|
||||
case ("dns1") : $order = "n.dns1"; break;
|
||||
case ("dns2") : $order = "n.dns2"; break;
|
||||
default : $order = "INET_ATON(n.ip)";
|
||||
}
|
||||
} else {
|
||||
$order = "INET_ATON(n.ip)";
|
||||
}
|
||||
|
||||
// get node info
|
||||
$result = mysql_query("SELECT a.asset_id, a.asset_name, a.hostname, n.node_id, n.ip, n.mac, n.dns1, n.dns2 FROM asset a, node n WHERE n.subnet_id='$subnet_id' AND a.asset_id=n.asset_id ORDER BY $order") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->set("hostname", $row->hostname);
|
||||
$tp->set("node_id", $row->node_id);
|
||||
$tp->set("ip", $row->ip);
|
||||
$tp->set("mac", write_mac($row->mac));
|
||||
$tp->set("dns1", $row->dns1);
|
||||
$tp->set("dns2", $row->dns2);
|
||||
$tp->parse("noderow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
?>
|
194
nodeview.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,42 +20,162 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$node_id = $_GET['node_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("node", $config_auth_nodeview, $node_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodeview.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get node info
|
||||
$result = mysql_query("SELECT a.asset_name, a.asset_id, n.ip, n.mac, n.dns1, n.dns2, n.node_info, s.subnet_id, s.subnet_address, s.subnet_mask FROM asset a, node n, subnet s WHERE n.node_id='$node_id' AND a.asset_id=n.asset_id AND s.subnet_id=n.subnet_id") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$tp->set("node_id", $node_id);
|
||||
$tp->set("asset_id", $row->asset_id);
|
||||
$tp->set("asset_name", $row->asset_name);
|
||||
$tp->set("ip", $row->ip);
|
||||
$tp->set("mac", write_mac($row->mac));
|
||||
$tp->set("dns1", $row->dns1);
|
||||
$tp->set("dns2", $row->dns2);
|
||||
$tp->set("node_info", nl2br($row->node_info));
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// get id
|
||||
$node_id = sanitize($_GET['node_id']);
|
||||
|
||||
include("footer.php");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/nodeview.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name,
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip,
|
||||
node.node_mac AS node_mac,
|
||||
node.node_dns1 AS node_dns1,
|
||||
node.node_dns2 AS node_dns2,
|
||||
node.node_info AS node_info,
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
asset,
|
||||
node,
|
||||
subnet
|
||||
WHERE
|
||||
asset.asset_id=node.asset_id
|
||||
AND node.node_id=" . $node_id . "
|
||||
AND subnet.subnet_id=node.subnet_id";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("node_counter", $node_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// send to tpl
|
||||
$tp->set("asset_id", $node['asset_id']);
|
||||
$tp->set("asset_name", $node['asset_name']);
|
||||
|
||||
$tp->set("node_id", $node['node_id']);
|
||||
$tp->set("node_ip", $node['node_ip']);
|
||||
$tp->set("node_mac", write_mac($node['node_mac']));
|
||||
$tp->set("node_dns1", $node['node_dns1']);
|
||||
$tp->set("node_dns2", $node['node_dns2']);
|
||||
$tp->set("node_info", nl2br($node['node_info']));
|
||||
|
||||
$tp->set("subnet_id", $node['subnet_id']);
|
||||
$tp->set("subnet_address", $node['subnet_address']);
|
||||
$tp->set("subnet_mask", $node['subnet_mask']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// setup nat
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset_ext.asset_id AS asset_id_ext,
|
||||
asset_int.asset_id AS asset_id_int,
|
||||
asset_ext.asset_name AS asset_name_ext,
|
||||
asset_int.asset_name AS asset_name_int,
|
||||
nat.nat_id AS nat_id,
|
||||
nat.nat_type AS nat_type,
|
||||
nat.nat_ext AS nat_ext,
|
||||
nat.nat_int AS nat_int,
|
||||
node_ext.node_ip AS node_ip_ext,
|
||||
node_int.node_ip AS node_ip_int
|
||||
FROM
|
||||
asset asset_ext,
|
||||
asset asset_int,
|
||||
nat,
|
||||
node node_ext,
|
||||
node node_int
|
||||
WHERE
|
||||
(nat.nat_ext=" . $node_id . "
|
||||
OR nat.nat_int=" . $node_id . ")
|
||||
AND node_ext.node_id=nat.nat_ext
|
||||
AND node_int.node_id=nat.nat_int
|
||||
AND asset_ext.asset_id=node_ext.asset_id
|
||||
AND asset_int.asset_id=node_int.asset_id
|
||||
ORDER BY
|
||||
INET_ATON(node_ext.node_ip),
|
||||
INET_ATON(node_int.node_ip)";
|
||||
|
||||
// run query
|
||||
$nats = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$nat_counter = count($nats);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("nat_counter", $nat_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($nat_counter>0) {
|
||||
// get objects
|
||||
foreach($nats AS $nat) {
|
||||
if($node_id==$nat['nat_ext']) {
|
||||
// send to tpl
|
||||
$tp->set("nat_asset_id", $nat['asset_id_int']);
|
||||
$tp->set("nat_asset_name", $nat['asset_name_int']);
|
||||
|
||||
$tp->set("nat_type", $lang['lang_nat_type_' . $nat['nat_type']]);
|
||||
|
||||
$tp->set("nat_node_id", $nat['nat_int']);
|
||||
$tp->set("nat_node_ip", $nat['node_ip_int']);
|
||||
} else if($node_id==$nat['nat_int']) {
|
||||
// send to tpl
|
||||
$tp->set("nat_asset_id", $nat['asset_id_ext']);
|
||||
$tp->set("nat_asset_name", $nat['asset_name_ext']);
|
||||
|
||||
$tp->set("nat_type", $lang['lang_nat_type_' . $nat['nat_type']]);
|
||||
|
||||
$tp->set("nat_node_id", $nat['nat_ext']);
|
||||
$tp->set("nat_node_ip", $nat['node_ip_ext']);
|
||||
}
|
||||
|
||||
// parse row
|
||||
$tp->parse("nat_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("nat_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("nat_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
?>
|
35
options.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,21 +20,24 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/options.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/options.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,111 @@
|
|||
<?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 template
|
||||
$tp = new Template("tpl/optionseditdisplay.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup options
|
||||
// set menu checkboxes
|
||||
// assets
|
||||
if($_SESSION['suser_menu_assets']=='on') {
|
||||
$user_menu_assets_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assets_checked = '';
|
||||
}
|
||||
// assetclasses
|
||||
if($_SESSION['suser_menu_assetclasses']=='on') {
|
||||
$user_menu_assetclasses_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assetclasses_checked = '';
|
||||
}
|
||||
// assetclassgroups
|
||||
if($_SESSION['suser_menu_assetclassgroups']=='on') {
|
||||
$user_menu_assetclassgroups_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_assetclassgroups_checked = '';
|
||||
}
|
||||
// locations
|
||||
if($_SESSION['suser_menu_locations']=='on') {
|
||||
$user_menu_locations_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_locations_checked = '';
|
||||
}
|
||||
// nodes
|
||||
if($_SESSION['suser_menu_nodes']=='on') {
|
||||
$user_menu_nodes_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_nodes_checked = '';
|
||||
}
|
||||
// subnets
|
||||
if($_SESSION['suser_menu_subnets']=='on') {
|
||||
$user_menu_subnets_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_subnets_checked = '';
|
||||
}
|
||||
// users
|
||||
if($_SESSION['suser_menu_users']=='on') {
|
||||
$user_menu_users_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_users_checked = '';
|
||||
}
|
||||
// vlans
|
||||
if($_SESSION['suser_menu_vlans']=='on') {
|
||||
$user_menu_vlans_checked = 'checked';
|
||||
} else {
|
||||
$user_menu_vlans_checked = '';
|
||||
}
|
||||
|
||||
// send to tpl
|
||||
$tp->set("user_id", $_SESSION['suser_id']);
|
||||
$tp->set("user_imagesize", $_SESSION['suser_imagesize']);
|
||||
$tp->set("user_imagecount", $_SESSION['suser_imagecount']);
|
||||
$tp->set("user_mac", $_SESSION['suser_mac']);
|
||||
$tp->set("user_dateformat", $_SESSION['suser_dateformat']);
|
||||
$tp->set("user_dns1suffix", $_SESSION['suser_dns1suffix']);
|
||||
$tp->set("user_dns2suffix", $_SESSION['suser_dns2suffix']);
|
||||
$tp->set("user_menu_assets_checked", $user_menu_assets_checked);
|
||||
$tp->set("user_menu_assetclasses_checked", $user_menu_assetclasses_checked);
|
||||
$tp->set("user_menu_assetclassgroups_checked", $user_menu_assetclassgroups_checked);
|
||||
$tp->set("user_menu_locations_checked", $user_menu_locations_checked);
|
||||
$tp->set("user_menu_nodes_checked", $user_menu_nodes_checked);
|
||||
$tp->set("user_menu_subnets_checked", $user_menu_subnets_checked);
|
||||
$tp->set("user_menu_users_checked", $user_menu_users_checked);
|
||||
$tp->set("user_menu_vlans_checked", $user_menu_vlans_checked);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,24 +20,24 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("userclass", $config_auth_userclassadd, 0);
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/optionseditpassword.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/userclassadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
357
search.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,21 +20,25 @@
|
|||
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/search.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/search.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get string that was searched for
|
||||
// get string that was searched for ($search is allready set in header.php)
|
||||
if (empty($search)) {
|
||||
// parse nosearch box
|
||||
$tp->parse("nosearch");
|
||||
|
||||
// hide others
|
||||
$tp->hide("asset");
|
||||
$tp->hide("location");
|
||||
$tp->hide("node");
|
||||
|
@ -42,89 +46,276 @@
|
|||
$tp->hide("vlan");
|
||||
$tp->hide("resultcount");
|
||||
} else {
|
||||
// hide nosearch box
|
||||
$tp->hide("nosearch");
|
||||
|
||||
// set needle and counter
|
||||
// set needle
|
||||
$needle = '%' . $search . '%';
|
||||
|
||||
// set counter
|
||||
$resultcounter = 0;
|
||||
|
||||
// search assets
|
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset WHERE asset_name LIKE '$needle' OR asset_info LIKE '%$needle%' ORDER BY asset_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("counter", $i+1);
|
||||
$tp->set("item_name", $lang['lang_assets']);
|
||||
$tp->set("item", "asset");
|
||||
$tp->set("id", $row->asset_id);
|
||||
$tp->set("name", $row->asset_name);
|
||||
$resultcounter++;
|
||||
$tp->parse("row");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
|
||||
$tp->clear("row");
|
||||
// setup asset
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_id AS asset_id,
|
||||
asset.asset_name AS asset_name
|
||||
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);
|
||||
|
||||
// count results
|
||||
$counter = count($assets);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("counter", $counter);
|
||||
|
||||
// search locations
|
||||
$result = mysql_query("SELECT location_id, location_name FROM location WHERE location_name LIKE '$needle' OR location_info LIKE '%$needle%' ORDER BY location_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("counter", $i+1);
|
||||
$tp->set("item_name", $lang['lang_locations']);
|
||||
$tp->set("item", "location");
|
||||
$tp->set("id", $row->location_id);
|
||||
$tp->set("name", $row->location_name);
|
||||
$resultcounter++;
|
||||
$tp->parse("row");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("location") : $tp->hide("location"));
|
||||
$tp->clear("row");
|
||||
// any assets?
|
||||
if ($counter>0) {
|
||||
// get objects
|
||||
foreach($assets AS $asset) {
|
||||
// send to tpl
|
||||
$tp->set("item_name", $lang['lang_assets']);
|
||||
$tp->set("item", "asset");
|
||||
$tp->set("id", $asset['asset_id']);
|
||||
$tp->set("name", $asset['asset_name']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("row");
|
||||
|
||||
// update counter
|
||||
$resultcounter++;
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("asset");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("asset");
|
||||
}
|
||||
|
||||
// clear row
|
||||
$tp->clear("row");
|
||||
|
||||
// search node
|
||||
$result = mysql_query("SELECT node_id, ip FROM node WHERE ip LIKE '$needle' OR mac LIKE '$needle' OR dns1 LIKE '$needle' OR dns2 LIKE '$needle' OR node_info LIKE '$needle' ORDER BY ip") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("counter", $i+1);
|
||||
$tp->set("item_name", $lang['lang_nodes']);
|
||||
$tp->set("item", "node");
|
||||
$tp->set("id", $row->node_id);
|
||||
$tp->set("name", $row->ip);
|
||||
$resultcounter++;
|
||||
$tp->parse("row");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node"));
|
||||
$tp->clear("row");
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_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);
|
||||
|
||||
// count results
|
||||
$counter = count($locations);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("counter", $counter);
|
||||
|
||||
// search subnet
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address FROM subnet WHERE subnet_address LIKE '$needle' OR subnet_info LIKE '%$needle%' ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("counter", $i+1);
|
||||
$tp->set("item_name", $lang['lang_subnets']);
|
||||
$tp->set("item", "subnet");
|
||||
$tp->set("id", $row->subnet_id);
|
||||
$tp->set("name", $row->subnet_address);
|
||||
$resultcounter++;
|
||||
$tp->parse("row");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
$tp->clear("row");
|
||||
// any locations?
|
||||
if ($counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// send to tpl
|
||||
$tp->set("item_name", $lang['lang_locations']);
|
||||
$tp->set("item", "location");
|
||||
$tp->set("id", $location['location_id']);
|
||||
$tp->set("name", $location['location_name']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("row");
|
||||
|
||||
// update counter
|
||||
$resultcounter++;
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("location");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("location");
|
||||
}
|
||||
|
||||
// clear row
|
||||
$tp->clear("row");
|
||||
|
||||
// search vlan
|
||||
$result = mysql_query("SELECT vlan_id, vlan_name FROM vlan WHERE vlan_name LIKE '$needle' OR vlan_info LIKE '%$needle%' ORDER BY vlan_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("counter", $i+1);
|
||||
$tp->set("item_name", $lang['lang_vlans']);
|
||||
$tp->set("item", "vlan");
|
||||
$tp->set("id", $row->vlan_id);
|
||||
$tp->set("name", $row->vlan_name);
|
||||
$resultcounter++;
|
||||
$tp->parse("row");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan"));
|
||||
$tp->clear("row");
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_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);
|
||||
|
||||
// count results
|
||||
$counter = count($nodes);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("counter", $counter);
|
||||
|
||||
// any nodes?
|
||||
if ($counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// send to tpl
|
||||
$tp->set("item_name", $lang['lang_nodes']);
|
||||
$tp->set("item", "node");
|
||||
$tp->set("id", $node['node_id']);
|
||||
$tp->set("name", $node['node_ip']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("row");
|
||||
|
||||
// update counter
|
||||
$resultcounter++;
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("node");
|
||||
}
|
||||
|
||||
// clear row
|
||||
$tp->clear("row");
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_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);
|
||||
|
||||
// count results
|
||||
$counter = count($subnets);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("counter", $counter);
|
||||
|
||||
// any subnets?
|
||||
if ($counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("item_name", $lang['lang_subnets']);
|
||||
$tp->set("item", "subnet");
|
||||
$tp->set("id", $subnet['subnet_id']);
|
||||
$tp->set("name", $subnet['subnet_address']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("row");
|
||||
|
||||
// update counter
|
||||
$resultcounter++;
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("subnet");
|
||||
}
|
||||
|
||||
// clear row
|
||||
$tp->clear("row");
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_name AS vlan_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);
|
||||
|
||||
// count results
|
||||
$counter = count($vlans);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("counter", $counter);
|
||||
|
||||
// any vlans?
|
||||
if ($counter>0) {
|
||||
// get objects
|
||||
foreach($vlans AS $vlan) {
|
||||
// send to tpl
|
||||
$tp->set("item_name", $lang['lang_vlans']);
|
||||
$tp->set("item", "vlan");
|
||||
$tp->set("id", $vlan['vlan_id']);
|
||||
$tp->set("name", $vlan['vlan_name']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("row");
|
||||
|
||||
// update counter
|
||||
$resultcounter++;
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("vlan");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("vlan");
|
||||
}
|
||||
|
||||
// clear row
|
||||
$tp->clear("row");
|
||||
|
||||
// to tpl
|
||||
$tp->set("resultcounter", $resultcounter);
|
||||
|
||||
// parse block
|
||||
$tp->parse("resultcount");
|
||||
}
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
1359
submit.php
98
subnet.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,34 +20,72 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("subnet", $config_auth_subnetview, 0);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnet.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("subnet_id", $row->subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->parse("subnetrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnet.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_id AS subnet_id,
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM
|
||||
subnet
|
||||
LEFT JOIN
|
||||
node
|
||||
ON
|
||||
node.subnet_id=subnet.subnet_id
|
||||
GROUP BY
|
||||
subnet.subnet_id
|
||||
ORDER BY
|
||||
INET_ATON(subnet.subnet_address)";
|
||||
|
||||
// run query
|
||||
$subnets = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$subnet_counter = count($subnets);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("subnet_counter", $subnet_counter);
|
||||
|
||||
// any subnets?
|
||||
if ($subnet_counter>0) {
|
||||
// get objects
|
||||
foreach($subnets AS $subnet) {
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet['subnet_id']);
|
||||
$tp->set("subnet_address", $subnet['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet['subnet_mask']);
|
||||
$tp->set("node_counter", $subnet['node_counter']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("subnet_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("subnet_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("subnet_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.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,24 +20,27 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("subnet", $config_auth_subnetadd, 0);
|
||||
// get id
|
||||
if((isset($_GET['vlan_id'])) ? $vlan_id = sanitize($_GET['vlan_id']) : $vlan_id = "");
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetadd.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
117
subnetdel.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,43 +20,82 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$subnet_id = $_GET['subnet_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("subnet", $config_auth_subnetdel, $subnet_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetdel.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_address, subnet_mask FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error());
|
||||
$row=mysql_fetch_object($result);
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
|
||||
// get node info
|
||||
$result = mysql_query("SELECT node_id, ip, mac, dns1, dns2, node_info FROM node WHERE subnet_id='$subnet_id' ORDER BY INET_ATON(ip)") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("node_id", $row->node_id);
|
||||
$tp->set("ip", $row->ip);
|
||||
$tp->parse("noderow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
include("footer.php");
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup node
|
||||
// build query
|
||||
$query = "SELECT
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
node
|
||||
WHERE
|
||||
node.subnet_id=" . $subnet_id . "
|
||||
ORDER BY
|
||||
INET_ATON(node.node_ip)";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// set id
|
||||
$tp->set("node_id", $node['node_id']);
|
||||
$tp->set("node_ip", $node['node_ip']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("node_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("node_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// footer
|
||||
include("footer.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,48 +20,47 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get id
|
||||
$subnet_id = $_GET['subnet_id'];
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask,
|
||||
subnet.subnet_info AS subnet_info
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
$tp->set("subnet_info", $subnet[0]['subnet_info']);
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("subnet", $config_auth_subnetedit, $subnet_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetedit.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get subnet information
|
||||
$result = mysql_query("SELECT subnet_address, subnet_mask, vlan_id, subnet_info FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$vlan_id = $row->vlan_id;
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->set("vlan_id", $vlan_id);
|
||||
$tp->set("subnet_info", $row->subnet_info);
|
||||
|
||||
// get vlan info
|
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan ORDER BY vlan_number") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
if (($row->vlan_id==$vlan_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
|
||||
$tp->set("vlan_id", $row->vlan_id);
|
||||
$tp->set("vlan_name", $row->vlan_name);
|
||||
$tp->set("vlan_number", $row->vlan_number);
|
||||
$tp->parse("vlanrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan"));
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,108 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetlocationadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// start parent
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name,
|
||||
location.location_parent AS location_parent
|
||||
FROM
|
||||
location
|
||||
WHERE
|
||||
location.location_id NOT IN (
|
||||
SELECT
|
||||
location_id
|
||||
FROM
|
||||
subnetlocation
|
||||
WHERE
|
||||
subnet_id=" . $subnet_id . "
|
||||
)
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// any locations?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location['location_id']);
|
||||
$tp->set("location_name", $location['location_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("location_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("location_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("location_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,102 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetlocationdel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id AS location_id,
|
||||
location.location_name AS location_name
|
||||
FROM
|
||||
subnetlocation,
|
||||
location
|
||||
WHERE
|
||||
subnetlocation.subnet_id=" . $subnet_id . "
|
||||
AND location.location_id=subnetlocation.location_id
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// any locations?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location['location_id']);
|
||||
$tp->set("location_name", $location['location_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("location_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("location_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("location_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,63 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetlocationedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
648
subnetview.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,202 +20,480 @@
|
|||
or contact me at wietsew@users.sourceforge.net
|
||||
*****************************************************************************/
|
||||
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// get id
|
||||
$subnet_id = $_GET['subnet_id'];
|
||||
|
||||
// check authorisation
|
||||
$auth = auth("subnet", $config_auth_subnetview, $subnet_id);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// get page
|
||||
if(isset($_GET['page'])) {
|
||||
$page = $_GET['page'];
|
||||
}
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetview.tpl");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_address, subnet_mask, vlan_id, subnet_info FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
$tp->set("subnet_info", nl2br($row->subnet_info));
|
||||
|
||||
// set needed variables
|
||||
$subnet_address = $row->subnet_address;
|
||||
$subnet_mask = $row->subnet_mask;
|
||||
$vlan_id = $row->vlan_id;
|
||||
|
||||
// split up the range
|
||||
$iprange = explode('.', $subnet_address);
|
||||
$iprange1 = $iprange[0];
|
||||
$iprange2 = $iprange[1];
|
||||
$iprange3 = $iprange[2];
|
||||
$iprange4 = $iprange[3];
|
||||
|
||||
// create array for these addresses
|
||||
$subnet = array();
|
||||
if ($subnet_mask>=24) {
|
||||
// Class C
|
||||
// calculate hosts
|
||||
$hostcount = pow(2,(32-$subnet_mask));
|
||||
// start page
|
||||
// includes
|
||||
include("includes.php");
|
||||
|
||||
// fill array with addresses we want to see
|
||||
for($i=0;$i<$hostcount;$i++) {
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i);
|
||||
$subnet[$ip] = array();
|
||||
// get id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// get page
|
||||
if(isset($_GET['page'])) {
|
||||
$page = sanitize($_GET['page']);
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i-1);
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// no pagination needed
|
||||
$tp->set("pagination", ' ');
|
||||
} else if ($subnet_mask>=16) {
|
||||
// Class B
|
||||
// which part do we want to see?
|
||||
if((empty($page)) ? $page=$subnet_address : $page=$page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[2];
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetview.tpl", $config_yapter_error);
|
||||
|
||||
// fill array with addresses we want to see
|
||||
for($i=0;$i<256;$i++) {
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $page2 . '.' . $i;
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . ($iprange3+$i-1) . '.255';
|
||||
|
||||
// create pagination
|
||||
$pagination = 'Page: ' . $iprange1 . '.' . $iprange2 . '. ';
|
||||
$pagination .= '<select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">';
|
||||
for($i=$iprange3;$i<(pow(2,(32-$subnet_mask))/256);$i++) {
|
||||
if(($i==$page2) ? $selected='selected' : $selected='');
|
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $iprange1 . '.' . $iprange2 . '.' . $i . '.0"' . $selected . '>' . $i . '.0</option>';
|
||||
}
|
||||
$pagination .= '</select>';
|
||||
$tp->set("pagination", $pagination);
|
||||
} else {
|
||||
// Class A
|
||||
// which part do we want to see?
|
||||
if((empty($page)) ? $page=$subnet_address : $page=$page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[1];
|
||||
$page3 = $page[2];
|
||||
|
||||
// fill array with addresses we want to see
|
||||
for($i=0;$i<256;$i++) {
|
||||
$ip = $iprange1 . '.' . $page2 . '.' . $page3 . '.' . $i;
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . ($iprange+$i-1) . '.255.255';
|
||||
|
||||
// create pagination
|
||||
$pagination = 'Page: ';
|
||||
// selectbox 1
|
||||
$pagination .= '<select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">';
|
||||
for($i=$iprange2;$i<(pow(2,(24-$subnet_mask))/256);$i++) {
|
||||
if(($i==$page2) ? $selected='selected' : $selected='');
|
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $iprange1 . '.' . $i . '.' . $page3 . '.0"' . $selected . '>' . $iprange1 . '.' . $i . '</option>';
|
||||
}
|
||||
$pagination .= '</select><select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">';
|
||||
// selectbox 2
|
||||
for($i=0;$i<256;$i++) {
|
||||
if(($i==$page3) ? $selected='selected' : $selected='');
|
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $iprange1 . '.' . $page2 . '.' . $i . '.0"' . $selected . '>' . $i . '.0</option>';
|
||||
}
|
||||
$pagination .= '</select>';
|
||||
$tp->set("pagination", $pagination);
|
||||
}
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// get nodes for this subnet and implement the values into the array
|
||||
$result = mysql_query("SELECT a.asset_name, acg.color, n.node_id, n.ip FROM asset a, assetclass ac, assetclassgroup acg, node n WHERE n.ip IN ('".implode("','",array_keys($subnet))."') AND n.subnet_id='$subnet_id' AND a.asset_id=n.asset_id AND ac.assetclass_id=a.assetclass_id AND acg.assetclassgroup_id=ac.assetclassgroup_id") or die(mysql_error());
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$subnet[$row['ip']] = $row;
|
||||
}
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask,
|
||||
subnet.subnet_info AS subnet_info,
|
||||
COUNT(node.subnet_id) AS node_counter
|
||||
FROM
|
||||
subnet
|
||||
LEFT JOIN
|
||||
node
|
||||
ON
|
||||
node.subnet_id=subnet.subnet_id
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id . "
|
||||
GROUP BY
|
||||
subnet.subnet_id";
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
// set needed variables
|
||||
$subnet_address = $subnet[0]['subnet_address'];
|
||||
$subnet_mask = $subnet[0]['subnet_mask'];
|
||||
|
||||
// set counters
|
||||
$host_counter = pow(2,(32-$subnet_mask));
|
||||
$node_counter = $subnet[0]['node_counter'];
|
||||
$subnet_usedpercentage = round((($node_counter/($host_counter-2))*100),1);
|
||||
|
||||
// send to tpl
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet_address);
|
||||
$tp->set("subnet_mask", $subnet_mask);
|
||||
$tp->set("subnet_info", nl2br($subnet[0]['subnet_info']));
|
||||
$tp->set("node_counter", $node_counter);
|
||||
$tp->set("subnet_usedpercentage", $subnet_usedpercentage);
|
||||
$tp->set("config_color_unused", $config_color_unused);
|
||||
$tp->set("host_counter", $host_counter-2);
|
||||
$tp->set("free_counter", (($host_counter-2)-$node_counter));
|
||||
|
||||
// replace subnet address (if in array)
|
||||
if(array_key_exists($subnet_address, $subnet)) {
|
||||
$subnet[$subnet_address]=array("subnet_address");
|
||||
}
|
||||
// setup subnet
|
||||
// split up the range
|
||||
$iprange = explode('.', $subnet_address);
|
||||
$iprange1 = $iprange[0];
|
||||
$iprange2 = $iprange[1];
|
||||
$iprange3 = $iprange[2];
|
||||
$iprange4 = $iprange[3];
|
||||
|
||||
// create empty subnet-array
|
||||
$subnet = array();
|
||||
|
||||
// determine range (Class A/B/C)
|
||||
if ($subnet_mask>=24) {
|
||||
// Class C
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0;$i<$host_counter;$i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i);
|
||||
|
||||
// fill subnet-array
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i-1);
|
||||
|
||||
// to tpl
|
||||
$tp->set("iprange1", $iprange1);
|
||||
$tp->set("iprange2", $iprange2);
|
||||
$tp->set("iprange3", $iprange3);
|
||||
$tp->set("iprange4", $iprange4);
|
||||
$tp->set("subnetmask1", 255);
|
||||
$tp->set("subnetmask2", 255);
|
||||
$tp->set("subnetmask3", 255);
|
||||
$tp->set("subnetmask4", 256-$host_counter);
|
||||
|
||||
// no pagination needed
|
||||
$tp->parse("noselect");
|
||||
$tp->hide("one_select");
|
||||
$tp->hide("two_select");
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = $host_counter;
|
||||
} else if ($subnet_mask>=16) {
|
||||
// Class B
|
||||
// which part do we want to see?
|
||||
if((empty($page)) ? $page=$subnet_address : $page=$page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[2];
|
||||
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0;$i<256;$i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $page2 . '.' . $i;
|
||||
|
||||
// fill subnet-array
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . ($iprange3+$i-1) . '.255';
|
||||
|
||||
// to tpl
|
||||
$tp->set("iprange1", $iprange1);
|
||||
$tp->set("iprange2", $iprange2);
|
||||
|
||||
// loop addresses in range3
|
||||
for($i=$iprange3;$i<(pow(2,(32-$subnet_mask))/256);$i++) {
|
||||
// send to tpl
|
||||
$tp->set("iprange3", $i);
|
||||
$tp->set("iprange4", 0);
|
||||
|
||||
// set select box
|
||||
if($i==$page2) {
|
||||
$tp->set("row_selected", "selected");
|
||||
|
||||
} else {
|
||||
$tp->set("row_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("one_select_row");
|
||||
}
|
||||
|
||||
$tp->set("subnetmask1", 255);
|
||||
$tp->set("subnetmask2", 255);
|
||||
$tp->set("subnetmask3", 256-($host_counter/256));
|
||||
$tp->set("subnetmask4", 0);
|
||||
|
||||
// one select box
|
||||
$tp->hide("noselect");
|
||||
$tp->parse("one_select");
|
||||
$tp->hide("two_select");
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = 256;
|
||||
} else {
|
||||
// Class A
|
||||
// which part do we want to see?
|
||||
if((empty($page)) ? $page=$subnet_address : $page=$page);
|
||||
$page = explode('.', $page);
|
||||
$page2 = $page[1];
|
||||
$page3 = $page[2];
|
||||
|
||||
// fill subnet-array with addresses we want to see
|
||||
for($i=0;$i<256;$i++) {
|
||||
// build ip
|
||||
$ip = $iprange1 . '.' . $page2 . '.' . $page3 . '.' . $i;
|
||||
|
||||
// fill subnet-array
|
||||
$subnet[$ip] = array();
|
||||
}
|
||||
|
||||
// calculate broadcast address
|
||||
$broadcast_address = $iprange1 . '.' . ($iprange2+$i-1) . '.255.255';
|
||||
|
||||
// to tpl
|
||||
$tp->set("iprange1", $iprange1);
|
||||
$tp->set("iprange2", $iprange2);
|
||||
|
||||
// loop addresses in range 2
|
||||
for($i=$iprange2;$i<(pow(2,(24-$subnet_mask))/256);$i++) {
|
||||
// send to tpl
|
||||
$tp->set("iprange1", $iprange1);
|
||||
$tp->set("iprange2", $i);
|
||||
$tp->set("iprange3", $page3);
|
||||
$tp->set("iprange4", $iprange4);
|
||||
|
||||
// set select box
|
||||
if($i==$page2) {
|
||||
$tp->set("row1_selected", "selected");
|
||||
|
||||
} else {
|
||||
$tp->set("row1_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("two_select_row1");
|
||||
}
|
||||
|
||||
// loop addresses in range 3
|
||||
for($i=0;$i<256;$i++) {
|
||||
// send to tpl
|
||||
$tp->set("iprange1", $iprange1);
|
||||
$tp->set("iprange2", $page2);
|
||||
$tp->set("iprange3", $i);
|
||||
$tp->set("iprange4", $iprange4);
|
||||
|
||||
// set select box
|
||||
if($i==$page3) {
|
||||
$tp->set("row2_selected", "selected");
|
||||
|
||||
} else {
|
||||
$tp->set("row2_selected", "");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("two_select_row2");
|
||||
}
|
||||
|
||||
$tp->set("subnetmask1", 255);
|
||||
$tp->set("subnetmask2", 256-($host_counter/65536));
|
||||
$tp->set("subnetmask3", 0);
|
||||
$tp->set("subnetmask4", 0);
|
||||
|
||||
// one select box
|
||||
$tp->hide("noselect");
|
||||
$tp->hide("one_select");
|
||||
$tp->parse("two_select");
|
||||
|
||||
// set displayed nodes
|
||||
$nodes_displayed = 256;
|
||||
}
|
||||
|
||||
// replace broadcast address (if in array)
|
||||
if(array_key_exists($broadcast_address, $subnet)) {
|
||||
$subnet[$broadcast_address]=array("broadcast_address");
|
||||
}
|
||||
// get nodes for this subnetview and implement the values into the array
|
||||
// build query
|
||||
$query = "SELECT
|
||||
asset.asset_name AS asset_name,
|
||||
assetclassgroup.assetclassgroup_color AS assetclassgroup_color,
|
||||
node.node_id AS node_id,
|
||||
node.node_ip AS node_ip
|
||||
FROM
|
||||
asset,
|
||||
assetclass,
|
||||
assetclassgroup,
|
||||
node
|
||||
WHERE
|
||||
node.node_ip IN ('".implode("','",array_keys($subnet))."')
|
||||
AND node.subnet_id='$subnet_id'
|
||||
AND asset.asset_id=node.asset_id
|
||||
AND assetclass.assetclass_id=asset.assetclass_id
|
||||
AND assetclassgroup.assetclassgroup_id=assetclass.assetclassgroup_id";
|
||||
|
||||
// run query
|
||||
$nodes = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$node_counter = count($nodes);
|
||||
|
||||
// any nodes?
|
||||
if ($node_counter>0) {
|
||||
// get objects
|
||||
foreach($nodes AS $node) {
|
||||
// add node-values to ip in subnet-array
|
||||
$subnet[$node['node_ip']] = $node;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// loop array and send to template
|
||||
$i=1;
|
||||
foreach($subnet as $ip => $node) {
|
||||
if(($i%64==0) ? $tr="</tr><tr>" : $tr="");
|
||||
if(empty($node)) {
|
||||
$tp->set("url", 'assigniptonode.php?subnet_id=' . $subnet_id . '&ip='. $ip);
|
||||
$tp->set("remotetext", $ip);
|
||||
$tp->set("color", $config_color_unused);
|
||||
} else if ($node[0]=="subnet_address") {
|
||||
$tp->set("url", "");
|
||||
$tp->set("remotetext", $ip . ' ' . $lang['lang_subnet_subnetaddress']);
|
||||
$tp->set("color", $config_color_blocked);
|
||||
} else if ($node[0]=="broadcast_address") {
|
||||
$tp->set("url", "");
|
||||
$tp->set("remotetext", $ip . ' ' . $lang['lang_subnet_broadcastaddress']);
|
||||
$tp->set("color", $config_color_blocked);
|
||||
// replace ip's in subnet-array (if necessary)
|
||||
// check for subnet address
|
||||
if(array_key_exists($subnet_address, $subnet)) {
|
||||
// replace
|
||||
$subnet[$subnet_address] = array("subnet_address");
|
||||
}
|
||||
|
||||
// check for broadcast address
|
||||
if(array_key_exists($broadcast_address, $subnet)) {
|
||||
// replace
|
||||
$subnet[$broadcast_address] = array("broadcast_address");
|
||||
}
|
||||
|
||||
// loop subnet-array and send to template
|
||||
// start counter
|
||||
$i=1;
|
||||
|
||||
// loop subnet-array
|
||||
foreach($subnet AS $node_ip => $node) {
|
||||
// make new line?
|
||||
if(($i%$_SESSION['suser_imagecount']==0 && $i!=$nodes_displayed) ? $tr="</tr><tr>" : $tr="");
|
||||
|
||||
// check node
|
||||
if(empty($node)) {
|
||||
// empty node to tpl
|
||||
$tp->set("url", 'assigniptonode.php?subnet_id=' . $subnet_id . '&node_ip='. $node_ip);
|
||||
$tp->set("remotetext", $node_ip);
|
||||
$tp->set("assetclassgroup_color", $config_color_unused);
|
||||
} else if ($node[0]=="subnet_address") {
|
||||
// subnet address to tpl
|
||||
$tp->set("url", "");
|
||||
$tp->set("remotetext", $node_ip . ' ' . $lang['lang_subnet_subnetaddress']);
|
||||
$tp->set("assetclassgroup_color", $config_color_blocked);
|
||||
} else if ($node[0]=="broadcast_address") {
|
||||
// broadcast address to tpl
|
||||
$tp->set("url", "");
|
||||
$tp->set("remotetext", $node_ip . ' ' . $lang['lang_subnet_broadcastaddress']);
|
||||
$tp->set("assetclassgroup_color", $config_color_blocked);
|
||||
} else {
|
||||
// node to tpl
|
||||
$tp->set("url", 'nodeview.php?node_id=' . $node['node_id']);
|
||||
$tp->set("remotetext", $node_ip . ' ' . $node['asset_name']);
|
||||
$tp->set("assetclassgroup_color", $node['assetclassgroup_color']);
|
||||
}
|
||||
|
||||
// set other vars
|
||||
$tp->set("tr", $tr);
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_row");
|
||||
|
||||
// update counter
|
||||
$i++;
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("node_table");
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_name AS vlan_name,
|
||||
vlan.vlan_number AS vlan_number
|
||||
FROM
|
||||
subnetvlan,
|
||||
vlan
|
||||
WHERE
|
||||
subnetvlan.subnet_id=" . $subnet_id . "
|
||||
AND vlan.vlan_id=subnetvlan.vlan_id
|
||||
ORDER BY
|
||||
vlan.vlan_name";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$vlan_counter = count($vlans);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("vlan_counter", $vlan_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($vlan_counter>0) {
|
||||
// get objects
|
||||
foreach($vlans AS $vlan) {
|
||||
// send to tpl
|
||||
$tp->set("vlan_id", $vlan['vlan_id']);
|
||||
$tp->set("vlan_name", $vlan['vlan_name']);
|
||||
$tp->set("vlan_number", $vlan['vlan_number']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("vlan_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("vlan_table");
|
||||
} else {
|
||||
$tp->set("url", 'nodeview.php?node_id=' . $node['node_id']);
|
||||
$tp->set("remotetext", $ip . ' ' . $node['asset_name']);
|
||||
$tp->set("color", $node['color']);
|
||||
// parse block
|
||||
$tp->hide("vlan_table");
|
||||
}
|
||||
$tp->set("tr", $tr);
|
||||
$tp->parse("iprow");
|
||||
$i++;
|
||||
}
|
||||
$tp->parse("subnet");
|
||||
|
||||
|
||||
// get vlan info
|
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan WHERE vlan_id='$vlan_id'") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("vlan_id", $row->vlan_id);
|
||||
$tp->set("vlan_name", $row->vlan_name);
|
||||
$tp->parse("vlanrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan"));
|
||||
|
||||
// get location info
|
||||
$result = mysql_query("SELECT l.location_id, l.location_name FROM location l INNER JOIN subnetlocation sl ON l.location_id=sl.location_id WHERE sl.subnet_id='$subnet_id'") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("location_id", $row->location_id);
|
||||
$tp->set("location_name", $row->location_name);
|
||||
$tp->parse("locationrow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("location") : $tp->hide("location"));
|
||||
|
||||
// get assetclassgroup info
|
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name, color FROM assetclassgroup ORDER BY assetclassgroup_name") or die(mysql_error());
|
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) {
|
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
|
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
|
||||
$tp->set("color", $row->color);
|
||||
$tp->parse("assetclassgrouprow");
|
||||
}
|
||||
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup"));
|
||||
// setup location
|
||||
// build query
|
||||
$query = "SELECT
|
||||
location.location_id,
|
||||
location.location_name
|
||||
FROM
|
||||
location
|
||||
LEFT JOIN
|
||||
subnetlocation
|
||||
ON
|
||||
subnetlocation.location_id=location.location_id
|
||||
WHERE
|
||||
subnetlocation.subnet_id=". $subnet_id . "
|
||||
ORDER BY
|
||||
location.location_name";
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
// run query
|
||||
$locations = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$location_counter = count($locations);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("location_counter", $location_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($location_counter>0) {
|
||||
// get objects
|
||||
foreach($locations AS $location) {
|
||||
// send to tpl
|
||||
$tp->set("location_id", $location['location_id']);
|
||||
$tp->set("location_name", $location['location_name']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("location_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("location_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("location_table");
|
||||
}
|
||||
|
||||
include("footer.php");
|
||||
// setup assetclassgroup
|
||||
// build query
|
||||
$query = "SELECT
|
||||
assetclassgroup.assetclassgroup_id,
|
||||
assetclassgroup.assetclassgroup_name,
|
||||
assetclassgroup.assetclassgroup_color,
|
||||
(SELECT
|
||||
COUNT(node.node_id)
|
||||
FROM
|
||||
asset,
|
||||
assetclass,
|
||||
node
|
||||
WHERE
|
||||
asset.assetclass_id=assetclass.assetclass_id
|
||||
AND assetclass.assetclassgroup_id=assetclassgroup.assetclassgroup_id
|
||||
AND node.asset_id=asset.asset_id
|
||||
AND node.subnet_id=" . $subnet_id . ") AS node_counter
|
||||
FROM
|
||||
assetclassgroup
|
||||
GROUP BY
|
||||
assetclassgroup.assetclassgroup_id
|
||||
ORDER BY
|
||||
assetclassgroup.assetclassgroup_name";
|
||||
|
||||
// run query
|
||||
$assetclassgroups = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$assetclassgroup_counter = count($assetclassgroups);
|
||||
|
||||
// counter to tpl
|
||||
$tp->set("assetclassgroup_counter", $assetclassgroup_counter);
|
||||
|
||||
// any nodes?
|
||||
if ($assetclassgroup_counter>0) {
|
||||
// get objects
|
||||
foreach($assetclassgroups AS $assetclassgroup) {
|
||||
// send to tpl
|
||||
$tp->set("assetclassgroup_id", $assetclassgroup['assetclassgroup_id']);
|
||||
$tp->set("assetclassgroup_name", $assetclassgroup['assetclassgroup_name']);
|
||||
$tp->set("assetclassgroup_color", $assetclassgroup['assetclassgroup_color']);
|
||||
|
||||
$tp->set("assetclassgroup_node_counter", $assetclassgroup['node_counter']);
|
||||
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_row");
|
||||
}
|
||||
// parse block
|
||||
$tp->parse("assetclassgroup_table");
|
||||
} else {
|
||||
// parse block
|
||||
$tp->hide("assetclassgroup_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,109 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetvlanadd.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = " SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_number AS vlan_number,
|
||||
vlan.vlan_name AS vlan_name
|
||||
FROM
|
||||
vlan
|
||||
WHERE
|
||||
vlan.vlan_id NOT IN (
|
||||
SELECT
|
||||
vlan_id
|
||||
FROM
|
||||
subnetvlan
|
||||
WHERE
|
||||
subnet_id=" . $subnet_id . "
|
||||
)
|
||||
ORDER BY
|
||||
vlan.vlan_number";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$vlan_counter = count($vlans);
|
||||
|
||||
// any vlans?
|
||||
if ($vlan_counter>0) {
|
||||
// get objects
|
||||
foreach($vlans AS $vlan) {
|
||||
// send to tpl
|
||||
$tp->set("vlan_id", $vlan['vlan_id']);
|
||||
$tp->set("vlan_number", $vlan['vlan_number']);
|
||||
$tp->set("vlan_name", $vlan['vlan_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("vlan_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("vlan_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("vlan_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,104 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetvlandel.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// setup vlan
|
||||
// build query
|
||||
$query = "SELECT
|
||||
vlan.vlan_id AS vlan_id,
|
||||
vlan.vlan_number AS vlan_number,
|
||||
vlan.vlan_name AS vlan_name
|
||||
FROM
|
||||
subnetvlan,
|
||||
vlan
|
||||
WHERE
|
||||
subnetvlan.subnet_id=" . $subnet_id . "
|
||||
AND vlan.vlan_id=subnetvlan.vlan_id
|
||||
ORDER BY
|
||||
vlan.vlan_number";
|
||||
|
||||
// run query
|
||||
$vlans = $db->db_select($query);
|
||||
|
||||
// count results
|
||||
$vlan_counter = count($vlans);
|
||||
|
||||
// any vlans?
|
||||
if ($vlan_counter>0) {
|
||||
// get objects
|
||||
foreach($vlans AS $vlan) {
|
||||
// send to tpl
|
||||
$tp->set("vlan_id", $vlan['vlan_id']);
|
||||
$tp->set("vlan_number", $vlan['vlan_number']);
|
||||
$tp->set("vlan_name", $vlan['vlan_name']);
|
||||
|
||||
// parse row
|
||||
$tp->parse("vlan_row");
|
||||
}
|
||||
|
||||
// parse block
|
||||
$tp->parse("vlan_table");
|
||||
} else {
|
||||
// hide block
|
||||
$tp->hide("vlan_table");
|
||||
}
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
|
@ -0,0 +1,63 @@
|
|||
<?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");
|
||||
|
||||
// get ip and id
|
||||
$subnet_id = sanitize($_GET['subnet_id']);
|
||||
|
||||
// start output
|
||||
include("header.php");
|
||||
|
||||
// set template
|
||||
$tp = new Template("tpl/subnetvlanedit.tpl", $config_yapter_error);
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// setup subnet
|
||||
// build query
|
||||
$query = "SELECT
|
||||
subnet.subnet_address AS subnet_address,
|
||||
subnet.subnet_mask AS subnet_mask
|
||||
FROM
|
||||
subnet
|
||||
WHERE
|
||||
subnet.subnet_id=" . $subnet_id;
|
||||
|
||||
// run query
|
||||
$subnet = $db->db_select($query);
|
||||
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
$tp->set("subnet_address", $subnet[0]['subnet_address']);
|
||||
$tp->set("subnet_mask", $subnet[0]['subnet_mask']);
|
||||
|
||||
// end page
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
// end output
|
||||
include("footer.php");
|
||||
?>
|
127
tpl/about.tpl
|
@ -1,73 +1,118 @@
|
|||
<table border="0">
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td>
|
||||
<b>IP Reg {config_version}</b>
|
||||
<td class="header">
|
||||
{lang_about}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table border="0">
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td>
|
||||
Sourceforge Project Page:
|
||||
<td class="header">
|
||||
{lang_ipreg} {config_version}
|
||||
</td>
|
||||
<td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{lang_about_sfprojectpage}
|
||||
</td>
|
||||
<td class="value">
|
||||
<a href="http://sourceforge.net/projects/ipreg">http://sourceforge.net/projects/ipreg</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
License:
|
||||
<td class="label">
|
||||
{lang_about_license}
|
||||
</td>
|
||||
<td>
|
||||
<a href="gpl-3.0.txt">GNU General Public License (GPL)</a>
|
||||
<td class="value">
|
||||
<a href="gpl-3.0.txt">{lang_about_gpl}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td width="200">
|
||||
Yapter Template Engine
|
||||
<td class="label">
|
||||
{lang_about_yapter}
|
||||
</td>
|
||||
<td>
|
||||
<td class="value">
|
||||
<a href="http://yapter.sourceforge.net/">http://yapter.sourceforge.net</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
OWeb2 Images
|
||||
<td class="label">
|
||||
{lang_about_iconset}
|
||||
</td>
|
||||
<td>
|
||||
<a href="http://www.oweb2.com/free-web20-icons-pack/">http://www.oweb2.com/free-web20-icons-pack</a>
|
||||
<td class="value">
|
||||
<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table border="0">
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td>
|
||||
IP Reg, a PHP/MySQL IPAM tool<br>
|
||||
Copyright (C) 2008 Wietse Warendorff<p>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify<br>
|
||||
it under the terms of the GNU General Public License as published by<br>
|
||||
the Free Software Foundation, either version 3 of the License, or<br>
|
||||
(at your option) any later version.<p>
|
||||
|
||||
This program is distributed in the hope that it will be useful,<br>
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
|
||||
GNU General Public License for more details.<p>
|
||||
|
||||
You should have received a copy of the GNU General Public License<br>
|
||||
along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
<td class="header">
|
||||
{lang_about_ipreg_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{lang_about_license_ext}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{lang_about_changelog}
|
||||
</td>
|
||||
<td class="header_right">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{lang_about_changelog_v05}
|
||||
</td>
|
||||
<td class="value">
|
||||
{lang_about_changelog_v05_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<td class="label">
|
||||
{lang_about_changelog_v04}
|
||||
</td>
|
||||
<td class="value">
|
||||
{lang_about_changelog_v04_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<td class="label">
|
||||
{lang_about_changelog_v03}
|
||||
</td>
|
||||
<td class="value">
|
||||
{lang_about_changelog_v03_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{lang_about_changelog_v02}
|
||||
</td>
|
||||
<td class="value">
|
||||
{lang_about_changelog_v02_ext}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
{lang_about_changelog_v01}
|
||||
</td>
|
||||
<td class="value">
|
||||
{lang_about_changelog_v01_ext}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -1,35 +1,49 @@
|
|||
<table border="0" width="100%">
|
||||
<table class="title">
|
||||
<tr>
|
||||
<td>
|
||||
<b>{lang_assets}:</b>
|
||||
<td class="header">
|
||||
{lang_assets} ({asset_counter})
|
||||
</td>
|
||||
<td align="right">
|
||||
<a href="assetadd.php"><img src="images/add.gif" border="0" title="{lang_asset_add}"></a>
|
||||
<a href="assetadd.php"><img src="image.php?icon=add" alt="{lang_asset_add}"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
||||
[BLOCK table AS asset]
|
||||
<table border="0">
|
||||
[BLOCK letter_table AS letter_table]
|
||||
<table class="submenu">
|
||||
<tr>
|
||||
<td width="250">
|
||||
<b>{lang_asset_name}</b>
|
||||
</td>
|
||||
[BLOCK letter_row]
|
||||
<td>
|
||||
<b>{lang_assetclass_name}</b>
|
||||
<a href="asset.php?asset_letter={asset_letter}">{asset_letter}</a>
|
||||
</td>
|
||||
[END letter_row]
|
||||
</tr>
|
||||
</table>
|
||||
[END letter_table]
|
||||
|
||||
<p>
|
||||
|
||||
[BLOCK asset_table AS asset_table]
|
||||
<table class="info">
|
||||
<tr>
|
||||
<td class="header">
|
||||
{lang_asset_name}
|
||||
</td>
|
||||
<td class="header">
|
||||
{lang_assetclass_name}
|
||||
</td>
|
||||
</tr>
|
||||
[BLOCK assetrow]
|
||||
[BLOCK asset_row]
|
||||
<tr>
|
||||
<td>
|
||||
<td class="label">
|
||||
<a href="assetview.php?asset_id={asset_id}">{asset_name}</a>
|
||||
</td>
|
||||
<td>
|
||||
<td class="value">
|
||||
<a href="assetclassview.php?assetclass_id={assetclass_id}">{assetclass_name}</a>
|
||||
</td>
|
||||
</tr>
|
||||
[END assetrow]
|
||||
[END asset_row]
|
||||
</table>
|
||||
[END table]
|
||||
[END asset_table]
|