28 Commits
v0.4 ... v0.9

Author SHA1 Message Date
42a964c4b8 Added symbol for options 2023-03-01 15:52:04 +01:00
f0d187b4c3 More restrictions due to authorization system 2023-03-01 15:12:09 +01:00
0b2da1f00f Added missing imagelinks in views 2023-03-01 10:10:36 +01:00
ac074eb944 Bumped version to 0.9 2023-03-01 10:02:42 +01:00
db26ffa611 Features LDAP, Rights, Cables, Menu improvements and bug fixing 2023-02-28 19:21:42 +01:00
26e9c89405 Assettype field for active/passive network-components 2023-02-24 15:20:25 +01:00
42e327776c Interface count for asset 2023-02-24 14:46:24 +01:00
6c9a169600 Some more small fixes in user admin code 2023-02-24 14:21:28 +01:00
02b3cfd23f Fix bugs in location code 2023-02-24 13:39:05 +01:00
0696a16030 Merge branch 'pdo' 2023-02-24 12:59:23 +01:00
e74bde2d14 Subsequent fixes after major changes for PDO 2023-02-24 12:16:25 +01:00
b144555e46 Added LDAP auth 2023-02-24 09:29:18 +01:00
7d6450706f Fix password change code 2023-02-23 12:30:11 +01:00
cb7f8ef649 Updated databasescript for new hashing algorithm 2023-02-23 10:56:00 +01:00
08c6d42b3c Implemented better password hashing algorithm 2023-02-23 10:50:48 +01:00
c13c7494bf Preselect subnet in options if defined 2023-02-22 10:55:49 +01:00
7c300e0a8f Changed database access to PDO using prepared statements 2023-02-22 10:50:24 +01:00
a4ecd1bff7 Fix PHP warnings and notices 2023-02-18 08:34:32 +01:00
be9610cd98 Fix styles and scripts in header 2023-02-18 07:49:25 +01:00
c500face92 Bumped version to 0.8 2023-02-17 19:35:43 +01:00
37f4bd4185 Code formatting improved and some bugfixng 2023-02-17 19:09:10 +01:00
808ae831bf Added some indices to database and more SQL simplification 2023-02-15 14:25:45 +01:00
6df7a3f6a8 SQL Statements simplified and some bugfixing 2023-02-15 12:44:29 +01:00
ed33c0553d Example data swapped out for optional import 2023-02-14 14:34:58 +01:00
23b73a387b Added improvements for empty database 2023-02-14 13:48:28 +01:00
cf27c1377c Added minor install instructions 2023-02-13 18:04:01 +01:00
ee582988e6 Moved towards smarty templates, support php7, switched to mysqli,
finalized language support and fixed some more bugs
2023-02-13 16:41:38 +01:00
76ccecca7f Changes adopted from version 0.5 2023-02-13 10:42:09 +01:00
270 changed files with 11889 additions and 8482 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*~
tpl_c/*.php
config.php

View File

@@ -1,44 +1,16 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// start output
include("header.php"); include("header.php");
// set template $smarty->display("about.tpl");
$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"); include("footer.php");
?> ?>

View File

@@ -1,54 +1,47 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// check authorisation
$auth = auth("asset", $config_auth_assetview, 0);
// start output
include("header.php"); include("header.php");
// set template
$tp = new Template("tpl/asset.tpl");
// set language variables // create letter links
$tp->setvars($lang); $sql = "SELECT DISTINCT SUBSTRING(UPPER(asset_name),1,1) AS asset_letter
FROM asset
ORDER BY asset_letter";
$sth = $dbh->query($sql);
// get asset info $alphabet = $sth->fetchAll();
$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()); $smarty->assign("alphabet", $alphabet);
for ($i=0;$row=mysql_fetch_object($result);$i++) {
$tp->set("asset_id", $row->asset_id); // total asset count
$tp->set("asset_name", $row->asset_name); $sth = $dbh->query("SELECT COUNT(*) FROM asset");
$tp->set("assetclass_id", $row->assetclass_id); $smarty->assign("assetcount", $sth->fetchColumn());
$tp->set("assetclass_name", $row->assetclass_name);
$tp->parse("assetrow"); // assets for current letter
if (isset($_GET['asset_letter'])) {
$asset_letter = sanitize($_GET['asset_letter']);
} else {
$asset_letter = $alphabet[0]['asset_letter'];
} }
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
// output $sql = "SELECT a.asset_id, IF(LENGTH(a.asset_name)>0, a.asset_name, '...') AS asset_name,
$tp->parse(); a.asset_info, c.assetclass_id, c.assetclass_name
$tp->spit(); FROM asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
WHERE SUBSTRING(a.asset_name,1,1)=?
ORDER BY a.asset_name";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_letter]);
$smarty->assign("assets", $sth->fetchAll());
$smarty->display("asset.tpl");
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,56 +1,36 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id if((isset($_GET['assetclass_id'])) ? $assetclass_id = sanitize($_GET['assetclass_id']) : $assetclass_id = "");
if((isset($_GET['assetclass_id'])) ? $assetclass_id = $_GET['assetclass_id'] : $assetclass_id = "");
// check authorisation
$auth = auth("asset", $config_auth_assetadd, 0);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclass_id, assetclass_name
$tp = new Template("tpl/assetadd.tpl"); FROM assetclass
ORDER BY assetclass_name";
$sth = $dbh->query($sql);
// set language variables $types = db_load_enum('asset','asset_type');
$tp->setvars($lang);
// get assetclassgroup information $smarty->assign("type_ids", $types);
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error()); $smarty->assign("type_names", $types);
for ($i=0;$row=mysql_fetch_object($result);$i++) { $smarty->assign("type_selected", $types[0]);
if (($row->assetclass_id==$assetclass_id) ? $tp->set("assetclass_selected", "selected") : $tp->set("assetclass_selected", ""));
$tp->set("assetclass_id", $row->assetclass_id); $assetclass_options = array();
$tp->set("assetclass_name", $row->assetclass_name); foreach ($sth->fetchAll(PDO::FETCH_NUM) as $rec) {
$tp->parse("assetclassrow"); $assetclass_options[$rec[0]] = $rec[1];
} }
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
// output $smarty->assign("assetclass_options", $assetclass_options);
$tp->parse(); $smarty->display("assetadd.tpl");
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,52 +1,23 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// check authorisation
$auth = auth("assetclass", $config_auth_assetclassview, 0);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT a.assetclass_id, a.assetclass_name, g.assetclassgroup_id,
$tp = new Template("tpl/assetclass.tpl"); g.assetclassgroup_name, g.assetclassgroup_color
FROM assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
ORDER BY a.assetclass_name";
$sth = $dbh->query($sql);
$smarty->assign("assetclasses", $sth->fetchAll(PDO::FETCH_ASSOC));
// set language variables $smarty->display("assetclass.tpl");
$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();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,56 +1,20 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']) : $assetclassgroup_id = "");
if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = $_GET['assetclassgroup_id'] : $assetclassgroup_id = "");
// check authorisation
$auth = auth("assetclass", $config_auth_assetclassadd, $assetclass_id);
// start output
include("header.php"); include("header.php");
// set template $smarty->assign("assetclassgroup_options", db_get_options_assetclassgroup());
$tp = new Template("tpl/assetclassadd.tpl"); $smarty->display("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"); include("footer.php");
?> ?>

View File

@@ -1,52 +1,26 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $assetclass_id = sanitize($_GET['assetclass_id']);
$assetclass_id = $_GET['assetclass_id'];
// check authorisation
$auth = auth("assetclass", $config_auth_assetclassdel, $assetclass_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclass_id AS id, assetclass_name AS name
$tp = new Template("tpl/assetclassdel.tpl"); FROM assetclass
WHERE assetclass_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclass_id]);
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
// set language variables $smarty->display("assetclassdel.tpl");
$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();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,64 +1,29 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $assetclass_id = sanitize($_GET['assetclass_id']);
$assetclass_id = $_GET['assetclass_id'];
// check authorisation
$auth = auth("assetclass", $config_auth_assetclassedit, $assetclass_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclass_id AS id, assetclass_name AS name,
$tp = new Template("tpl/assetclassedit.tpl"); assetclassgroup_id AS group_id
FROM assetclass
WHERE assetclass_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclass_id]);
// set language variables $smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
$tp->setvars($lang);
// get assetclass information $smarty->assign("assetclassgroup_options", db_get_options_assetclass());
$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 assetclassgroup information $smarty->display("assetclassedit.tpl");
$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"));
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,53 +1,23 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// check authorisation
$auth = auth("assetclassgroup", $config_auth_assetclassgroupview, 0);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name,
$tp = new Template("tpl/assetclassgroup.tpl"); assetclassgroup_color AS color, assetclassgroup_description AS description
FROM assetclassgroup
ORDER BY assetclassgroup_name";
$sth = $dbh->query($sql);
$smarty->assign('assetclassgroups', $sth->fetchAll(PDO::FETCH_ASSOC));
// set language variables $smarty->display("assetclassgroup.tpl");
$tp->setvars($lang);
// 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"); include("footer.php");
?> ?>

View File

@@ -1,43 +1,18 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// check authorisation $smarty->assign("scripts", 'jscolor.js');
$auth = auth("assetclassgroup", $config_auth_assetclassgroupadd, 0);
// start output
include("header.php"); include("header.php");
// set template $smarty->display("assetclassgroupadd.tpl");
$tp = new Template("tpl/assetclassgroupadd.tpl");
// set language variables
$tp->setvars($lang);
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,52 +1,26 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
$assetclassgroup_id = $_GET['assetclassgroup_id'];
// check authorisation
$auth = auth("assetclassgroup", $config_auth_assetclassgroupdel, $assetclassgroup_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name
$tp = new Template("tpl/assetclassgroupdel.tpl"); FROM assetclassgroup
WHERE assetclassgroup_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclassgroup_id]);
$smarty->assign("assetclassgroup", $sth->fetch(PDO::FETCH_OBJ));
// set language variables $smarty->display("assetclassgroupdel.tpl");
$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();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,53 +1,30 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
$assetclassgroup_id = $_GET['assetclassgroup_id'];
// check authorisation $smarty->assign("scripts", 'jscolor.js');
$auth = auth("assetclassgroup", $config_auth_assetclassgroupedit, $assetclassgroup_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclassgroup_id AS id, assetclassgroup_name AS name,
$tp = new Template("tpl/assetclassgroupedit.tpl"); assetclassgroup_color AS color,
assetclassgroup_description AS description
FROM assetclassgroup
WHERE assetclassgroup_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclassgroup_id]);
// set language variables $smarty->assign("assetclassgroup", $sth->fetch(PDO::FETCH_OBJ));
$tp->setvars($lang);
// get assetclass information $smarty->display("assetclassgroupedit.tpl");
$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);
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,61 +1,37 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
$assetclassgroup_id = $_GET['assetclassgroup_id'];
// check authorisation
$auth = auth("assetclassgroup", $config_auth_assetclassgroupview, $assetclassgroup_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT assetclassgroup_id AS id,
$tp = new Template("tpl/assetclassgroupview.tpl"); assetclassgroup_name AS name,
assetclassgroup_color AS color,
assetclassgroup_description AS description
FROM assetclassgroup
WHERE assetclassgroup_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclassgroup_id]);
$smarty->assign("assetclassgroup", $sth->fetch(PDO::FETCH_OBJ));
// set language variables $sql = "SELECT assetclass_id, assetclass_name
$tp->setvars($lang); FROM assetclass
WHERE assetclassgroup_id=?
ORDER BY assetclass_name";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclassgroup_id]);
$smarty->assign("assetclasses", $sth->fetchAll(PDO::FETCH_ASSOC));
// get assetclassgroup info $smarty->display("assetclassgroupview.tpl");
$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"));
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,63 +1,36 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $assetclass_id = sanitize($_GET['assetclass_id']);
$assetclass_id = $_GET['assetclass_id'];
// check authorisation
$auth = auth("assetclass", $config_auth_assetclassview, $assetclass_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT a.assetclass_id, a.assetclass_name, g.assetclassgroup_id,
$tp = new Template("tpl/assetclassview.tpl"); g.assetclassgroup_name, g.assetclassgroup_color
FROM assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
WHERE a.assetclass_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclass_id]);
$smarty->assign("assetclass", $sth->fetch(PDO::FETCH_OBJ));
// set language variables $sql = "SELECT asset_id, asset_name,
$tp->setvars($lang); CONCAT(LEFT(asset_info, 80), IF(CHAR_LENGTH(asset_info)>80,'...','')) AS asset_info
FROM asset
WHERE assetclass_id=?
ORDER BY asset_name";
$sth = $dbh->prepare($sql);
$sth->execute([$assetclass_id]);
$smarty->assign("assets", $sth->fetchAll(PDO::FETCH_ASSOC));
// get assetclassgroup info $smarty->display("assetclassview.tpl");
$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 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"));
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,61 +1,31 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $asset_id = sanitize($_GET['asset_id']);
$asset_id = $_GET['asset_id'];
// check authorisation
$auth = auth("asset", $config_auth_assetdel, $asset_id);
// start output
include("header.php"); include("header.php");
// set template // asset to delete
$tp = new Template("tpl/assetdel.tpl"); $sth = $dbh->prepare("SELECT asset_name FROM asset WHERE asset_id=?");
$sth->execute([$asset_id]);
$smarty->assign("asset_id", $asset_id);
$smarty->assign("asset_name", $sth->fetchColumn());
// set language variables // nodes to delete
$tp->setvars($lang); $sql = "SELECT node_id, node_ip FROM node WHERE asset_id=? ORDER BY INET_ATON(node_ip)";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$smarty->assign("nodes", $sth->fetchAll(PDO::FETCH_ASSOC));
// get asset info $smarty->display("assetdel.tpl");
$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();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,65 +1,33 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $asset_id = sanitize($_GET['asset_id']);
$asset_id = $_GET['asset_id'];
// check authorisation
$auth = auth("asset", $config_auth_assetedit, $asset_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT asset_id, asset_name, asset_hostname, asset_info, asset_intf,
$tp = new Template("tpl/assetedit.tpl"); assetclass_id, asset_type
FROM asset
WHERE asset_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$smarty->assign("asset", $sth->fetch(PDO::FETCH_OBJ));
// set language variables // Type selection
$tp->setvars($lang); $smarty->assign("type_ids", ['active', 'passive']);
$smarty->assign("type_names", ['Active', 'Passive']);
// get asset information $smarty->assign("assetclass_options", db_get_options_assetclass());
$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 $smarty->display("assetedit.tpl");
$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"); include("footer.php");
?> ?>

View File

@@ -1,73 +1,36 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// get id $asset_id = sanitize($_GET['asset_id']);
$asset_id = $_GET['asset_id'];
// check authorisation
auth("asset", $config_auth_assetview, $asset_id);
// start output
include("header.php"); include("header.php");
// set template $sql = "SELECT a.asset_id, a.asset_name, a.asset_hostname, a.asset_info,
$tp = new Template("tpl/assetview.tpl"); a.asset_intf, a.asset_type, c.assetclass_id, c.assetclass_name
FROM asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
WHERE a.asset_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$asset = $sth->fetch(PDO::FETCH_OBJ);
$smarty->assign("asset", $asset);
// set language variables $sql = "SELECT node_id, node_ip, LEFT(node_info, 40) as node_info
$tp->setvars($lang); FROM node
WHERE asset_id=?
ORDER BY INET_ATON(node_ip)";
$sth = $dbh->prepare($sql);
$sth->execute([$asset_id]);
$smarty->assign("nodes", $sth->fetchAll(PDO::FETCH_ASSOC));
// get asset info $smarty->display("assetview.tpl");
$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"); include("footer.php");
?> ?>

View File

@@ -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");
?>

View File

@@ -1,54 +1,29 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// start output $node_ip = sanitize($_GET['node_ip']);
$subnet_id = sanitize($_GET['subnet_id']);
include("header.php"); include("header.php");
// get ip and id $sql = "SELECT subnet_id AS id, subnet_address AS address, subnet_mask AS mask
$ip = $_GET['ip']; FROM subnet
$subnet_id = $_GET['subnet_id']; WHERE subnet_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$subnet_id]);
// set template $smarty->assign("subnet", $sth->fetch(PDO::FETCH_OBJ));
$tp = new Template("tpl/assigniptonode.tpl"); $smarty->assign("node_ip", $node_ip);
// set language variables $smarty->display("assigniptonode.tpl");
$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);
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -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");
?>

28
assignnodetoasset.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
SPDX-License-Identifier: GPL-3.0-or-later
*****************************************************************************/
include("includes.php");
$asset_id = sanitize($_GET['asset_id']);
$node_ip = sanitize($_GET['node_ip']);
$subnet_id = sanitize($_GET['subnet_id']);
include("header.php");
$smarty->assign("node_ip", $node_ip);
$smarty->assign("asset_id", $asset_id);
$smarty->assign("subnet_id", $subnet_id);
$smarty->assign("asset_options", db_get_options_asset());
$smarty->assign("subnet_options", db_get_options_subnet());
$smarty->display("assignnodetoasset.tpl");
include("footer.php");
?>

View File

@@ -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");
?>

161
cable.php Normal file
View File

@@ -0,0 +1,161 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
SPDX-License-Identifier: GPL-3.0-or-later
*****************************************************************************/
include("includes.php");
if ($_SESSION['suser_role_admin'] == 0) {
header_location('comments.php?comments=accessdenied');
}
if (isset($_REQUEST['id'])) {
$id = (int) $_REQUEST['id'] or $id = 0;
}
$ctypes = array('copper' => 'Copper', 'fibre' => 'Fibre',
'laser' => 'Laserlink', 'radio' => 'Radiolink');
// ========== ACTIONS START ===================================================
switch ($submit = form_get_action()) {
case NULL: break;
case 'add': $action = ACT_ADD; break;
case 'view': $action = ACT_VIEW; break;
case 'edit': $action = ACT_EDIT; break;
case 'del': $action = ACT_DELETE; break;
case 'insert':
$description = sanitize($_POST['description']);
$color = sanitize($_POST['color']);
$info = sanitize($_POST['info']);
$sql = "INSERT INTO cable
(cable_description, cable_color, cable_info)
VALUES
(:description, :color, :info)";
$sth = $dbh->prepare($sql);
$sth->bindValue(':description', $description, PDO::PARAM_STR);
$sth->bindValue(':color', $color, PDO::PARAM_STR);
$sth->bindValue(':info', $info, PDO::PARAM_STR);
$sth->execute();
$id = $dbh->lastInsertId();
$action = ACT_VIEW;
break;
case 'update':
$description = sanitize($_POST['description']);
$color = sanitize($_POST['color']);
$length = sanitize($_POST['length']);
$type = sanitize($_POST['cable_type']);
$info = sanitize($_POST['info']);
$sql = "UPDATE cable
SET cable_description=:desc,
cable_color=:color,
cable_length=:length,
cable_type=:type,
cable_info=:info
WHERE cable_id=:id";
$sth = $dbh->prepare($sql);
$sth->bindValue(':id', $id, PDO::PARAM_INT);
$sth->bindValue(':desc', $description, PDO::PARAM_STR);
$sth->bindValue(':length', $length, PDO::PARAM_INT);
$sth->bindValue(':color', $color, PDO::PARAM_STR);
$sth->bindValue(':type', $type, PDO::PARAM_STR);
$sth->bindValue(':info', $info, PDO::PARAM_STR);
$sth->execute();
$action = ACT_VIEW;
break;
case 'delete':
$sth = $dbh->prepare("DELETE FROM cable WHERE cable_id=?");
$sth->execute([$id]);
$action = ACT_DEFAULT;
break;
default:
$g_error->Add(submit_error($submit));
$valid = FALSE;
}
// ========== ACTIONS END =====================================================
$smarty->assign("scripts", 'jscolor.js');
include("header.php");
// ========== PAGE CONTENT ====================================================
if ($action == ACT_DEFAULT):
// ========== VARIANT: default behavior =======================================
$sql = "SELECT cable_id AS id, cable_description AS description,
cable_from_id, cable_to_id, cable_length, cable_links,
cable_type, cable_color,
CONCAT(LEFT(cable_info, 60), IF(CHAR_LENGTH(cable_info)>60,'...','')) AS info
FROM cable
ORDER BY cable_description";
$sth = $dbh->query($sql);
$smarty->assign("cables", $sth->fetchAll());
$smarty->display("cable.tpl");
elseif ($action == ACT_ADD):
// ========== VARIANT: add record =============================================
$smarty->assign('type_options', $ctypes);
$smarty->display('cableadd.tpl');
elseif ($action == ACT_VIEW):
// ========== VARIANT: view single record =====================================
$sql = "SELECT cable_id AS id, cable_description AS description,
cable_from_id, cable_to_id, cable_length, cable_links,
cable_type, cable_color AS color, cable_info AS info
FROM cable
WHERE cable_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$id]);
$smarty->assign('cable', $sth->fetch(PDO::FETCH_OBJ));
$smarty->display('cableview.tpl');
elseif ($action == ACT_EDIT):
// ========== VARIANT: edit single record =====================================
$sql = "SELECT cable_id AS id, cable_description AS description,
cable_from_id, cable_to_id, cable_length, cable_links,
cable_type, cable_color AS color, cable_info AS info
FROM cable
WHERE cable_id=?";
$sth = $dbh->prepare($sql);
$sth->execute([$id]);
$smarty->assign('cable', $sth->fetch(PDO::FETCH_OBJ));
$smarty->assign('type_options', $ctypes);
$smarty->display('cableedit.tpl');
elseif ($action == ACT_DELETE):
// ========== VARIANT: delete record ==========================================
$sth = $dbh->prepare("SELECT cable_description FROM cable WHERE cable_id=?");
$sth->execute([$id]);
$smarty->assign('id', $id);
$smarty->assign('description', $sth->fetchColumn());
$smarty->display('cabledel.tpl');
else:
// ========== ERROR UNKNOWN VARIANT ===========================================
echo "<p>Unknown function call: Please report to system development!</p>\n";
endif; // $action == ...
// ========== END OF VARIANTS =================================================
$smarty->display('footer.tpl');
?>

View File

@@ -1,46 +1,22 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// start output
include("header.php"); include("header.php");
// set template
$tp = new Template("tpl/comments.tpl");
// set language variables $comments = sanitize($_GET['comments']);
$tp->setvars($lang);
// get error $smarty->assign("comments", $lang['lang_comments_' . $comments]);
$comments = $_GET['comments'];
// set veriables $smarty->display("comments.tpl");
$tp->set("comments", $lang['lang_comments_' . $comments]);
// output
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,89 +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
*****************************************************************************/
// version
$config_version = 'v0.4b';
// 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';
// domain suffix for dns input fields
$config_dns1suffix = '.domain.com';
$config_dns2suffix = '.domain.com';
// 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;
?>

36
config.php-sample Normal file
View File

@@ -0,0 +1,36 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
SPDX-License-Identifier: GPL-3.0-or-later
*****************************************************************************/
// db connection
$config_mysql_host = 'localhost';
$config_mysql_username = 'ipreg';
$config_mysql_password = 'changeme!';
$config_mysql_dbname = 'ipreg';
// default values for IP blocks
$config_color_blocked = 'dcdcdc';
$config_color_unused = 'ffffff';
$config_color_dynamic = 'e0e0e0';
// language
$config_lang_default = 'en';
// auth
$config_auth_ldap = false;
$config_ldap_host = array('localhost', 'otherhost.example.com');
$config_ldap_port = 389;
$config_ldap_v3 = true;
$config_ldap_base_dn = 'ou=organizationalunit,dc=example,dc=com';
$config_ldap_login_attr = 'uid';
// ldap search user
$config_ldap_bind_dn = 'cn=dummy,ou=organizationalunit,dc=example,dc=com';
$config_ldap_bind_pass = 'secret';
?>

View File

@@ -1,25 +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
*****************************************************************************/
mysql_connect($config_mysql_host,$config_mysql_username,$config_mysql_password);
mysql_select_db($config_mysql_dbname);
?>

View File

@@ -1,32 +1,13 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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
*****************************************************************************/ *****************************************************************************/
// set template $smarty->assign("config_version", $config_version);
$tp = new Template("tpl/footer.tpl");
// get version for the footer-stamp $smarty->display("footer.tpl");
$tp->set("config_version", $config_version);
// output
$tp->parse();
$tp->spit();
?> ?>

View File

@@ -1,101 +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
*****************************************************************************/
// strip mac address to 12 char string
function strip_mac($mac) {
// strip chars we don't need
$mac = preg_replace("|[^a-fA-F0-9]|", "", $mac);
// capotolize (just because it looks better eh)
$mac = strtoupper($mac);
// and return
return ($mac);
}
// rebuild mac address
function write_mac($mac) {
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
for($i=0;$i<12;$i++) {
${"mac".$i} = $mac{$i};
}
// get user preference
$user_mac = $_SESSION['suser_mac'];
// replace user preference with pieces
for($i=0;$i<12;$i++) {
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
}
// and return
return $user_mac;
}
}
// redirect page
function header_location($location) {
header("location: " . $location);
exit;
}
// authorisation check
function auth($item, $min_auth, $item_id) {
// get user_id
$suser_id = $_SESSION['suser_id'];
// 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;
}
// 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;
}
}
if($auth<$min_auth) {
// not allowed -> redirect
header_location("comments.php?comments=notallowed");
} else {
return $auth;
}
}
?>

View File

@@ -1,37 +1,18 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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
*****************************************************************************/ *****************************************************************************/
// include language file include('lang/' . $_SESSION['suser_language'] . '.php');
include('lang/' . $_SESSION['suser_lang'] . '.php'); $smarty->assign($lang);
// set template // search box
$tp = new Template("tpl/header.tpl");
// set language variables
$tp->setvars($lang);
// set search box
if (isset($_POST['search'])) { if (isset($_POST['search'])) {
$search = $_POST['search']; $search = sanitize($_POST['search']);
$_SESSION['search'] = $search; $_SESSION['search'] = $search;
} else { } else {
if (isset($_SESSION['search'])) { if (isset($_SESSION['search'])) {
@@ -41,11 +22,40 @@
} }
} }
// set global template vars $smarty->assign("config_version", $config_version);
$tp->set("config_version", $config_version); $smarty->assign("suser_name", $_SESSION['suser_displayname']);
$tp->set("search", $search); $smarty->assign("search", $search);
// output // menu
$tp->parse(); $menu = array();
$tp->spit(); if ($_SESSION['suser_menu_assets']) {
$menu[] = '<a href="asset.php">' . $lang['lang_assets'] . "</a>\n";
}
if ($_SESSION['suser_menu_assetclasses']) {
$menu[] = '<a href="assetclass.php">' . $lang['lang_assetclasses'] . "</a>\n";
}
if ($_SESSION['suser_menu_assetclassgroups']) {
$menu[] = '<a href="assetclassgroup.php">' . $lang['lang_assetclassgroups'] . "</a>\n";
}
if ($_SESSION['suser_menu_locations']) {
$menu[] = '<a href="location.php">' . $lang['lang_locations'] . "</a>\n";
}
if ($_SESSION['suser_menu_nodes']) {
$menu[] = '<a href="node.php">' . $lang['lang_nodes'] . "</a>\n";
}
if ($_SESSION['suser_menu_subnets']) {
$menu[] = '<a href="subnet.php">' . $lang['lang_subnets'] . "</a>\n";
}
if ($_SESSION['suser_menu_vlans']) {
$menu[] = '<a href="vlan.php">' . $lang['lang_vlans'] . "</a>\n";
}
if ($_SESSION['suser_menu_cables']) {
$menu[] = '<a href="cable.php">' . $lang['lang_cables'] . "</a>\n";
}
if ($_SESSION['suser_menu_zones']) {
$menu[] = '<a href="zone.php">' . $lang['lang_zones'] . "</a>\n";
}
$smarty->assign("menu", implode(' | ', $menu));
$smarty->display("header.tpl");
?> ?>

View File

@@ -1,16 +1,81 @@
<?php <?php
// get desired color /*****************************************************************************
$color = $_GET['color']; IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
// create base image SPDX-License-Identifier: GPL-3.0-or-later
$image = imagecreatetruecolor(6, 6); *****************************************************************************/
// fill image with color include("includes.php");
$color = imagecolorallocate($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));
imagefill($image, 0, 0, $color); if(isset($_GET['icon'])) {
$icon = sanitize($_GET['icon']);
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 ("shred") :
$png = 'bin';
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;
}
$image = imagecreatefrompng("images/" . $png . ".png");
imagealphablending($image, true);
imagesavealpha($image, true);
// display image
header('Content-type: image/png'); header('Content-type: image/png');
imagepng($image); imagepng($image);
imagedestroy($image); imagedestroy($image);
}
if(isset($_GET['color'])) {
$color = sanitize($_GET['color']);
$image = imagecreatetruecolor($_SESSION['suser_imagesize'], $_SESSION['suser_imagesize']);
$color = imagecolorallocate($image, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)), hexdec(substr($color,4,2)));
imagefill($image, 0, 0, $color);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
}
?> ?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 B

BIN
images/admin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

BIN
images/arrow_left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

BIN
images/arrow_right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

BIN
images/asset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

BIN
images/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

BIN
images/bin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

BIN
images/breadcrumb.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

BIN
images/brick.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

BIN
images/bricks.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

BIN
images/building.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 B

BIN
images/building_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

BIN
images/building_delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

BIN
images/building_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

BIN
images/cancel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

BIN
images/comment.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

BIN
images/disconnect.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

BIN
images/error.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

BIN
images/exclamation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

BIN
images/information.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

BIN
images/link.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 B

BIN
images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/magnifier.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

BIN
images/manage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

BIN
images/minus.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

BIN
images/network-ethernet.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/network-ethernet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

BIN
images/note.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

BIN
images/page.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

BIN
images/page_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

BIN
images/page_delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

BIN
images/page_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

BIN
images/page_red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

BIN
images/page_save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

BIN
images/plugin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

BIN
images/plus.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

BIN
images/report.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

BIN
images/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

BIN
images/shield.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/shield.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

BIN
images/table.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

BIN
images/table_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

BIN
images/table_delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

BIN
images/table_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

BIN
images/table_go.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

BIN
images/table_save.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

BIN
images/tag-blue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B

BIN
images/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

BIN
images/user_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

BIN
images/user_delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

BIN
images/user_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

BIN
images/user_female.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

View File

@@ -1,83 +1,31 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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
*****************************************************************************/ *****************************************************************************/
session_name('ipreg');
session_start(); session_start();
// check for user_id, if unnkown -> login // check for user_id, if unnkown, redirect to login
if (empty($_SESSION['suser_id'])) { if (empty($_SESSION['suser_id'])) {
$_SESSION['prelogin'] = $_SERVER['REQUEST_URI'];
header("Location: login.php"); header("Location: login.php");
exit; exit;
} }
// includes
include("config.php"); include("config.php");
include("dbconnect.php");
include("functions.php");
include("yapter.php");
// auth items // connect to database
$authitems = array( $dbh = new PDO("mysql:host=$config_mysql_host;dbname=$config_mysql_dbname;charset=utf8", $config_mysql_username, $config_mysql_password);
'ipreg' => array( $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
'name' => 'IP Reg', $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
),
'asset' => array( include("lib.php");
'name' => 'Asset',
'item_id' => 'asset_id', $language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
'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',
),
);
?> ?>

View File

@@ -1,65 +1,43 @@
<?php <?php
/***************************************************************************** /*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2008 Wietse Warendorff Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)
Copyright (C) 2011-2023 Thomas Hooge
This program is free software: you can redistribute it and/or modify SPDX-License-Identifier: GPL-3.0-or-later
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"); include("includes.php");
// start output
include("header.php"); include("header.php");
// set template // Statistics
$tp = new Template("tpl/index.tpl");
// set language variables // asset
$tp->setvars($lang); $sth = $dbh->query("SELECT COUNT(asset_id) AS asset_counter FROM asset");
$smarty->assign("asset_counter", $sth->fetchColumn());
// calculate assets // location
$query = mysql_query("SELECT asset_id FROM asset") or die(mysql_error()); $sth = $dbh->query("SELECT COUNT(location_id) AS location_counter FROM location");
$assetcount = mysql_num_rows($query); $smarty->assign("location_counter", $sth->fetchColumn());
$tp->set('assetcount', $assetcount);
// calculate locations // node
$query = mysql_query("SELECT location_id FROM location") or die(mysql_error()); $sth = $dbh->query("SELECT COUNT(node_id) AS node_counter FROM node");
$locationcount = mysql_num_rows($query); $smarty->assign("node_counter", $sth->fetchColumn());
$tp->set('locationcount', $locationcount);
// calculate nodes // subnet
$query = mysql_query("SELECT node_id FROM node") or die(mysql_error()); $sth = $dbh->query("SELECT COUNT(subnet_id) AS subnet_counter FROM subnet");
$nodecount = mysql_num_rows($query); $smarty->assign("subnet_counter", $sth->fetchColumn());
$tp->set('nodecount', $nodecount);
// calculate subnets // vlan
$query = mysql_query("SELECT subnet_id FROM subnet") or die(mysql_error()); $sth = $dbh->query("SELECT COUNT(vlan_id) AS vlan_counter FROM vlan");
$subnetcount = mysql_num_rows($query); $smarty->assign("vlan_counter", $sth->fetchColumn());
$tp->set('subnetcount', $subnetcount);
// calculate vlans // zone
$query = mysql_query("SELECT vlan_id FROM vlan") or die(mysql_error()); $sth = $dbh->query("SELECT COUNT(zone_id) AS zone_counter FROM zone");
$vlancount = mysql_num_rows($query); $smarty->assign("zone_counter", $sth->fetchColumn());
$tp->set('vlancount', $vlancount);
// output $smarty->display("index.tpl");
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -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');

View File

@@ -1,18 +1,57 @@
--- IP Reg Installation
--- IP Reg 0.4
--- http://sourceforge.net/projects/ipreg
---
Installation instructions 1. Install requirements
Minimum PHP version is 7.4, we are using arrow functions introduced
in that version.
IP Reg version 0.6 and up depends on smarty template engine.
In Debian install it with: "apt-get install smarty3".
The PHP-GD module is also required: "apt-get install php-gd".
1) Create your MYSQL-database
2) Use install.sql to create the tables and insert the first data 2. 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.
3) Update config.php with your settings CREATE DATABASE ipreg;
4) Copy all files to your webserver (exclude install directory) Create database-user for application with minimum necessary rights.
5) Start your browser, log in with admin/admin CREATE USER 'ipreg'@'localhost' IDENTIFIED BY '********';
GRANT SELECT, INSERT, UPDATE, DELETE ON ipreg.* TO 'ipreg'@'localhost';
6) Please report your comments at http://www.newtree.nl/ipreg
3. Run database import
Import the mysql.sql file into your database, which will create the tables
mysql ipreg < mysql.sql
Optional import some sample data
mysql ipreg < mysql_sample.sql
4. Upload files
Upload all files and directories (except the install directory) to your
webserver.
5. Create and edit config file
Rename sample configfile config.php-sample:
mv config.php-sample config.php
Open config.php in a text editor and fill in your database details.
6. Check file access rights for security
Only directory tpl_c should be writeble by webserver.
Configfile should be readable by webserver but not writeable.
chmod 640 config.php
chgrp www-data config.php
chown www-data tpl_c
7. Start using IP Reg
Start your browser and login to IP Reg with the default username/password:
admin/admin

185
install/mysql.sql Normal file
View File

@@ -0,0 +1,185 @@
CREATE TABLE asset (
asset_id int(10) NOT NULL AUTO_INCREMENT,
asset_name varchar(100) NOT NULL,
asset_hostname varchar(100) DEFAULT NULL,
assetclass_id int(10) NOT NULL,
asset_info text DEFAULT NULL,
asset_intf smallint(5) UNSIGNED NOT NULL DEFAULT 1,
asset_location int(10) DEFAULT NULL,
asset_type enum ('active','passive') NOT NULL DEFAULT 'active',
PRIMARY KEY (asset_id),
INDEX ix_asset_name (asset_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
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),
INDEX ix_assetclass_name (assetclass_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE assetclassgroup (
assetclassgroup_id int(10) NOT NULL AUTO_INCREMENT,
assetclassgroup_name varchar(100) NOT NULL,
assetclassgroup_color char(6) NOT NULL DEFAULT '000000',
assetclassgroup_description varchar(100) DEFAULT NULL,
PRIMARY KEY (assetclassgroup_id),
INDEX ix_assetclassgroup_name (assetclassgroup_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- WIP
CREATE TABLE cable (
cable_id int(10) NOT NULL AUTO_INCREMENT,
cable_description varchar(100) NOT NULL,
cable_from_id int(10) DEFAULT NULL,
cable_to_id int(10) DEFAULT NULL,
cable_length smallint(5) UNSIGNED DEFAULT NULL,
cable_links smallint(5) UNSIGNED DEFAULT 1,
cable_type enum('copper','fibre','laser','radio') DEFAULT NULL,
cable_color char(6) NOT NULL DEFAULT '000000',
cable_info text DEFAULT NULL,
PRIMARY KEY (cable_id),
UNIQUE INDEX ix_cable_description (cable_description)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- WIP
CREATE TABLE cablevlan (
cablevlan_id int(10) NOT NULL AUTO_INCREMENT,
cable_id int(10) NOT NULL,
vlan_id int(10) NOT NULL,
PRIMARY KEY (cablevlan_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- WIP
-- Reference to external systems
CREATE TABLE extlink (
extlink_id int(10) NOT NULL AUTO_INCREMENT,
asset_id int(10) NOT NULL,
extlink_type enum('cdb','zabbix', 'topdesk') NOT NULL DEFAULT 'cdb',
extlink_refid int(10) DEFAULT NULL,
extlink_uid varchar(65) DEFAULT NULL,
PRIMARY KEY (extlink_id),
INDEX ix_extlink_asset_id (asset_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE location (
location_id int(10) NOT NULL AUTO_INCREMENT,
location_name varchar(100) NOT NULL,
location_parent int(10) NOT NULL DEFAULT 0,
location_info text DEFAULT NULL,
location_type enum('location', 'building','room','rack') NOT NULL DEFAULT 'location',
location_sort smallint(6) NOT NULL DEFAULT 0,
PRIMARY KEY (location_id),
INDEX ix_location_sort (location_sort),
INDEX ix_location_name (location_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
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,
nat_ext_port smallint(5) UNSIGNED DEFAULT NULL,
nat_int_port smallint(5) UNSIGNED DEFAULT NULL,
nat_description varchar(100) DEFAULT NULL,
PRIMARY KEY (nat_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE node (
node_id int(10) NOT NULL AUTO_INCREMENT,
node_ip varchar(45) NOT NULL,
node_mac varchar(12) NOT NULL,
node_dns1 varchar(100) DEFAULT NULL,
node_dns2 varchar(100) DEFAULT NULL,
subnet_id int(10) NOT NULL,
asset_id int(10) NOT NULL,
zone_id int(10) DEFAULT NULL,
node_info text DEFAULT NULL,
node_type enum('v4','v6') NOT NULL DEFAULT 'v4',
PRIMARY KEY (node_id),
INDEX ix_ip (node_ip),
INDEX ix_mac (node_mac)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE subnet (
subnet_id int(10) NOT NULL AUTO_INCREMENT,
subnet_address varchar(45) NOT NULL,
subnet_mask int(2) NOT NULL,
subnet_dhcp_start varchar(15) DEFAULT NULL,
subnet_dhcp_end varchar(15) DEFAULT NULL,
subnet_info text DEFAULT NULL,
protocol_version tinyint(1) NOT NULL DEFAULT 4,
ntp_server varchar(45) DEFAULT NULL,
PRIMARY KEY (subnet_id),
UNIQUE INDEX ix_subnet (subnet_address, subnet_mask)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
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;
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_realm enum ('local','ldap') NOT NULL DEFAULT 'local',
user_name varchar(100) NOT NULL,
user_pass binary(60) NOT NULL,
user_displayname varchar(100) NOT NULL,
user_language char(2) NOT NULL DEFAULT 'en',
user_imagesize int(3) NOT NULL DEFAULT 6,
user_imagecount int(3) NOT NULL DEFAULT 64,
user_mac varchar(25) NOT NULL DEFAULT 'xx:xx:xx:xx:xx:xx',
user_dateformat varchar(10) NOT NULL DEFAULT 'd M Y H:i',
user_dns1suffix varchar(100) DEFAULT NULL,
user_dns2suffix varchar(100) DEFAULT NULL,
user_tooltips varchar(2) NOT NULL DEFAULT 'on',
user_menu set('asset','cable','class','group','location','nat','node',
'subnet','vlan','zone') NOT NULL DEFAULT 'asset,class,group,location,node,subnet,vlan',
user_role set('add','edit','delete','manage','admin') DEFAULT NULL,
user_flags set('deleted','locked'),
PRIMARY KEY (user_id),
UNIQUE INDEX ix_username (user_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO user (user_name, user_pass, user_displayname, user_role) VALUES
('admin', '$2y$10$HTs0lSaFrfr.q4Gmy5zWfeDg3jhYZkqEGZEnDkMiHZ641nso38mt6', 'Administrator', 'admin');
CREATE TABLE vlan (
vlan_id int(10) NOT NULL AUTO_INCREMENT,
vlan_number int(3) NOT NULL,
vlan_name varchar(100) NOT NULL,
vlan_color char(6) NOT NULL DEFAULT '000000',
vlan_info text DEFAULT NULL,
PRIMARY KEY (vlan_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE zone (
zone_id int(10) NOT NULL AUTO_INCREMENT,
zone_soa varchar(40) NOT NULL,
zone_hostmaster varchar(40) NOT NULL,
zone_origin varchar(40) NOT NULL,
zone_ttl_default varchar(10) NOT NULL DEFAULT '3D',
zone_refresh varchar(10) NOT NULL DEFAULT '8H',
zone_retry varchar(10) NOT NULL DEFAULT '2H',
zone_expire varchar(10) NOT NULL DEFAULT '4W',
zone_ttl varchar(10) NOT NULL DEFAULT '1D',
zone_serial int(10) unsigned NOT NULL,
zone_ns1 varchar(20) NOT NULL,
zone_ns2 varchar(20) DEFAULT NULL,
zone_ns3 varchar(20) DEFAULT NULL,
zone_mx1 varchar(20) DEFAULT NULL,
zone_mx2 varchar(20) DEFAULT NULL,
zone_info text DEFAULT NULL,
PRIMARY KEY (zone_id),
UNIQUE INDEX ix_zone_origin (zone_origin)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

60
install/mysql_sample.sql Normal file
View File

@@ -0,0 +1,60 @@
INSERT INTO asset (asset_name, assetclass_id) VALUES
('Computer', 1),
('Server', 3),
('Printer', 4),
('Firewall', 6);
INSERT INTO assetclass (assetclassgroup_id, assetclass_name) VALUES
(1, 'Desktop'),
(1, 'Notebook'),
(2, 'Server'),
(3, 'Printer'),
(4, 'Switch'),
(4, 'Firewall'),
(5, 'Scanner');
INSERT INTO assetclassgroup (assetclassgroup_name, assetclassgroup_color) VALUES
('Personal Computer', '000000'),
('Servers', '0000CC'),
('Periphery', '00CC00'),
('Network', 'CCCC00'),
('Miscellaneous', 'CC0000');
INSERT INTO location (location_name, location_parent) VALUES
('Main Office', 0),
('Branch Office A', 1),
('Branch Office B', 1);
INSERT INTO node (node_ip, node_mac, subnet_id, asset_id) VALUES
('192.168.0.10', '001122334455', 1, 1),
('192.168.0.11', 'aabbccddeeff', 1, 2),
('192.168.0.12', '775544881199', 1, 3),
('192.168.0.1', '667755441122', 1, 4),
('192.168.1.1', '667755441123', 2, 4),
('192.168.10.1', '667755441124', 3, 4),
('192.168.20.1', '667755441125', 4, 4);
INSERT INTO subnet (subnet_address, subnet_mask) VALUES
('192.168.0.0', 24),
('192.168.1.0', 24),
('192.168.10.0', 24),
('192.168.20.0', 24);
INSERT INTO subnetlocation (subnet_id, location_id) VALUES
(1, 1),
(2, 1),
(3, 2),
(4, 3);
INSERT INTO subnetvlan (subnet_id, vlan_id) VALUES
(1, 1);
INSERT INTO user (user_name, user_pass, user_displayname) VALUES
('alice', '$2y$10$CTq04qodeKZBgeuShC3E..cEzfh.SDlaoOEUWcCXXHPDvXJ51nGdq', 'Alice'),
('bob', '$2y$10$hl4NN4lOyuz7KN0ZjLHbOuCqGi08GVaTvl/RiMcL1mbFqGmtzDN76', 'Bob');
INSERT INTO vlan (vlan_number, vlan_name) VALUES
(1, 'DEFAULT_VLAN');
INSERT INTO zone (zone_soa, zone_origin, zone_hostmaster, zone_serial, zone_ns1) VALUES
('ns1.example.com.', 'example.com.', 'hostmaster.example.com.', '2023021301', 'ns1.example.com');

24
install/upgrade.txt Normal file
View File

@@ -0,0 +1,24 @@
IP Reg Upgrading
This version has still not reached version 1.0 (feature complete).
As such, there may be changes at any time.
There is no database upgrade logic so the database structure has
to be compared manually.
1. Check and upgrade database schema
Compare current database schema with the contents of the database
creation script "mysql.sql".
Create missing objects in your current database.
2. Install new version
Install the new application in a new location.
Copy the configuration file "config.php" to new installation.
Compare the configuration to the sample config.
There may be additional settings that you want to customize.
3. Switch to new version
Rename the old and new directory.
4. Done
If everything works fine you could remove the old directory.

Some files were not shown because too many files have changed in this diff Show More