9 Commits
v0.4 ... v0.8

251 changed files with 11543 additions and 8468 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, include("includes.php");
but WITHOUT ANY WARRANTY; without even the implied warranty of include("header.php");
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 $smarty->display("about.tpl");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("footer.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes
include("includes.php");
// start output
include("header.php");
// set template
$tp = new Template("tpl/about.tpl");
// set language variables
$tp->setvars($lang);
// set vars
$tp->set("config_version", $config_version);
// output
$tp->parse();
$tp->spit();
// end output
include("footer.php");
?> ?>

View File

@@ -1,54 +1,55 @@
<?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, include("includes.php");
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 include("header.php");
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 // create letter links
include("includes.php"); $query = "SELECT
SUBSTRING(UPPER(asset.asset_name),1,1) AS asset_letter
FROM
asset
GROUP BY
asset_letter
ORDER BY
asset_letter";
// check authorisation $alphabet = $db->db_select($query);
$auth = auth("asset", $config_auth_assetview, 0); $smarty->assign("alphabet", $alphabet);
// start output // setup current letter
include("header.php"); if(isset($_GET['asset_letter'])) {
$asset_letter = sanitize($_GET['asset_letter']);
} else {
$asset_letter = $alphabet[0]['asset_letter'];
}
// set template $query = "SELECT
$tp = new Template("tpl/asset.tpl"); a.asset_id,
IF(LENGTH(a.asset_name)>0, a.asset_name, '...') AS asset_name,
a.asset_info,
c.assetclass_id,
c.assetclass_name
FROM
asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
WHERE
SUBSTRING(a.asset_name,1,1) = '" . $asset_letter . "'
ORDER BY
a.asset_name";
// set language variables $assets = $db->db_select($query);
$tp->setvars($lang);
// get asset info $smarty->assign("assets", $assets);
$result = mysql_query("SELECT a.asset_id, a.asset_name, a.assetclass_id, ac.assetclass_name FROM asset a, assetclass ac WHERE ac.assetclass_id=a.assetclass_id ORDER BY a.asset_name") or die(mysql_error());
for ($i=0;$row=mysql_fetch_object($result);$i++) {
$tp->set("asset_id", $row->asset_id);
$tp->set("asset_name", $row->asset_name);
$tp->set("assetclass_id", $row->assetclass_id);
$tp->set("assetclass_name", $row->assetclass_name);
$tp->parse("assetrow");
}
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
// output $smarty->display("asset.tpl");
$tp->parse();
$tp->spit();
include("footer.php"); include("footer.php");
?> ?>

View File

@@ -1,56 +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, include("includes.php");
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 if((isset($_GET['assetclass_id'])) ? $assetclass_id = sanitize($_GET['assetclass_id']) : $assetclass_id = "");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); assetclass_id,
assetclass_name
FROM
assetclass
ORDER BY
assetclass_name";
// get id $assetclasses = $db->db_select($query);
if((isset($_GET['assetclass_id'])) ? $assetclass_id = $_GET['assetclass_id'] : $assetclass_id = ""); foreach ($assetclasses as $assetclass) {
$assetclass_options[$assetclass['assetclass_id']] = $assetclass['assetclass_name'];
}
// check authorisation $smarty->assign("assetclass_options", $assetclass_options);
$auth = auth("asset", $config_auth_assetadd, 0); $smarty->display("assetadd.tpl");
// start output include("footer.php");
include("header.php");
// set template
$tp = new Template("tpl/assetadd.tpl");
// set language variables
$tp->setvars($lang);
// get assetclassgroup information
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
for ($i=0;$row=mysql_fetch_object($result);$i++) {
if (($row->assetclass_id==$assetclass_id) ? $tp->set("assetclass_selected", "selected") : $tp->set("assetclass_selected", ""));
$tp->set("assetclass_id", $row->assetclass_id);
$tp->set("assetclass_name", $row->assetclass_name);
$tp->parse("assetclassrow");
}
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,52 +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, include("includes.php");
but WITHOUT ANY WARRANTY; without even the implied warranty of include("header.php");
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 $query = "SELECT
along with this program. If not, see <http://www.gnu.org/licenses/>. a.assetclass_id,
a.assetclass_name,
g.assetclassgroup_id,
g.assetclassgroup_name,
g.assetclassgroup_color
FROM
assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
ORDER BY
a.assetclass_name";
For more information, visit http://sourceforge.net/projects/ipreg, $assetclasses = $db->db_select($query);
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $smarty->assign("assetclasses", $assetclasses);
include("includes.php"); $smarty->display("assetclass.tpl");
// check authorisation include("footer.php");
$auth = auth("assetclass", $config_auth_assetclassview, 0);
// start output
include("header.php");
// set template
$tp = new Template("tpl/assetclass.tpl");
// set language variables
$tp->setvars($lang);
// get assetclass info
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
for ($i=0;$row=mysql_fetch_object($result);$i++) {
$tp->set("assetclass_id", $row->assetclass_id);
$tp->set("assetclass_name", $row->assetclass_name);
$tp->parse("assetclassrow");
}
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
// output
$tp->parse();
$tp->spit();
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, include("includes.php");
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 if((isset($_GET['assetclassgroup_id'])) ? $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']) : $assetclassgroup_id = "");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $smarty->assign("assetclassgroup_options", $db->options_assetclassgroup());
include("includes.php"); $smarty->display("assetclassadd.tpl");
// get id include("footer.php");
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");
// set template
$tp = new Template("tpl/assetclassadd.tpl");
// set language variables
$tp->setvars($lang);
// get assetclassgroup information
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_name") or die(mysql_error());
for ($i=0;$row=mysql_fetch_object($result);$i++) {
if (($row->assetclassgroup_id==$assetclassgroup_id) ? $tp->set("assetclassgroup_selected", "selected") : $tp->set("assetclassgroup_selected", ""));
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
$tp->parse("assetclassgrouprow");
}
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup"));
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,52 +1,32 @@
<?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, include("includes.php");
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 $assetclass_id = sanitize($_GET['assetclass_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); assetclass_id,
assetclass_name
FROM
assetclass
WHERE
assetclass_id=" . $assetclass_id;
// get id $assetclass = $db->db_select($query);
$assetclass_id = $_GET['assetclass_id'];
// check authorisation $smarty->assign("assetclass_id", $assetclass[0]['assetclass_id']);
$auth = auth("assetclass", $config_auth_assetclassdel, $assetclass_id); $smarty->assign("assetclass_name", $assetclass[0]['assetclass_name']);
// start output $smarty->display("assetclassdel.tpl");
include("header.php");
// set template include("footer.php");
$tp = new Template("tpl/assetclassdel.tpl");
// set language variables
$tp->setvars($lang);
// get assetclass info
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass WHERE assetclass_id='$assetclass_id'") or die(mysql_error());
$row=mysql_fetch_object($result);
$tp->set("assetclass_id", $row->assetclass_id);
$tp->set("assetclass_name", $row->assetclass_name);
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,64 +1,35 @@
<?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, include("includes.php");
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 $assetclass_id = sanitize($_GET['assetclass_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>. include("header.php");
For more information, visit http://sourceforge.net/projects/ipreg, $query = "SELECT
or contact me at wietsew@users.sourceforge.net assetclass_id,
*****************************************************************************/ assetclass_name,
assetclassgroup_id
FROM
assetclass
WHERE
assetclass_id=" . $assetclass_id;
// includes $assetclass = $db->db_select($query);
include("includes.php");
// get id $smarty->assign("assetclass_id", $assetclass[0]['assetclass_id']);
$assetclass_id = $_GET['assetclass_id']; $smarty->assign("assetclass_name", $assetclass[0]['assetclass_name']);
$smarty->assign("assetclassgroup_id", $assetclass[0]['assetclassgroup_id']);
// check authorisation $smarty->assign("assetclassgroup_options", $db->options_assetclassgroup());
$auth = auth("assetclass", $config_auth_assetclassedit, $assetclass_id);
// start output $smarty->display("assetclassedit.tpl");
include("header.php");
// set template include("footer.php");
$tp = new Template("tpl/assetclassedit.tpl");
// set language variables
$tp->setvars($lang);
// get assetclass information
$result = mysql_query("SELECT assetclass_name, assetclassgroup_id FROM assetclass WHERE assetclass_id='$assetclass_id'") or die(mysql_error());
$row=mysql_fetch_object($result);
$assetclassgroup_id = $row->assetclassgroup_id;
$tp->set("assetclass_id", $assetclass_id);
$tp->set("assetclass_name", $row->assetclass_name);
$tp->set("assetclassgroup_id", $assetclassgroup_id);
// get assetclassgroup information
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_name") or die(mysql_error());
for ($i=0;$row=mysql_fetch_object($result);$i++) {
if (($row->assetclassgroup_id==$assetclassgroup_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
$tp->set("assetclassgroup_id", $row->assetclassgroup_id);
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
$tp->parse("assetclassgrouprow");
}
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup"));
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,53 +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, include("includes.php");
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 include("header.php");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, $query = "SELECT
or contact me at wietsew@users.sourceforge.net assetclassgroup_id,
*****************************************************************************/ assetclassgroup_name,
assetclassgroup_color
FROM
assetclassgroup
ORDER BY
assetclassgroup_name";
// includes $assetclassgroups = $db->db_select($query);
include("includes.php");
// check authorisation $smarty->assign("assetclassgroups", $assetclassgroups);
$auth = auth("assetclassgroup", $config_auth_assetclassgroupview, 0); $smarty->display("assetclassgroup.tpl");
// start output include("footer.php");
include("header.php");
// set template
$tp = new Template("tpl/assetclassgroup.tpl");
// set language variables
$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");
?> ?>

View File

@@ -1,43 +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, include("includes.php");
but WITHOUT ANY WARRANTY; without even the implied warranty of include("header.php");
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 $smarty->display("assetclassgroupadd.tpl");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("footer.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes
include("includes.php");
// check authorisation
$auth = auth("assetclassgroup", $config_auth_assetclassgroupadd, 0);
// start output
include("header.php");
// set template
$tp = new Template("tpl/assetclassgroupadd.tpl");
// set language variables
$tp->setvars($lang);
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,52 +1,34 @@
<?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, include("includes.php");
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 $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $smarty->assign($lang);
include("includes.php");
// get id $query = "SELECT
$assetclassgroup_id = $_GET['assetclassgroup_id']; assetclassgroup_id,
assetclassgroup_name
FROM
assetclassgroup
WHERE
assetclassgroup_id=" . $assetclassgroup_id;
// check authorisation $assetclassgroup = $db->db_select($query);
$auth = auth("assetclassgroup", $config_auth_assetclassgroupdel, $assetclassgroup_id);
// start output $smarty->assign("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
include("header.php"); $smarty->assign("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
// set template $smarty->display("assetclassgroupdel.tpl");
$tp = new Template("tpl/assetclassgroupdel.tpl");
// set language variables include("footer.php");
$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");
?> ?>

View File

@@ -1,53 +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, include("includes.php");
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 $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, $smarty->assign("scripts", 'jscolor.js');
or contact me at wietsew@users.sourceforge.net include("header.php");
*****************************************************************************/
// includes $smarty->assign($lang);
include("includes.php");
// get id $query = "SELECT
$assetclassgroup_id = $_GET['assetclassgroup_id']; assetclassgroup_id,
assetclassgroup_name,
assetclassgroup_color
FROM
assetclassgroup
WHERE
assetclassgroup_id=" . $assetclassgroup_id;
// check authorisation $assetclassgroup = $db->db_select($query);
$auth = auth("assetclassgroup", $config_auth_assetclassgroupedit, $assetclassgroup_id);
// start output $smarty->assign("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
include("header.php"); $smarty->assign("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
$smarty->assign("assetclassgroup_color", $assetclassgroup[0]['assetclassgroup_color']);
// set template $smarty->display("assetclassgroupedit.tpl");
$tp = new Template("tpl/assetclassgroupedit.tpl");
// set language variables include("footer.php");
$tp->setvars($lang);
// get assetclass information
$result = mysql_query("SELECT assetclassgroup_name, color FROM assetclassgroup WHERE assetclassgroup_id='$assetclassgroup_id'") or die(mysql_error());
$row=mysql_fetch_object($result);
$tp->set("assetclassgroup_id", $assetclassgroup_id);
$tp->set("assetclassgroup_name", $row->assetclassgroup_name);
$tp->set("color", $row->color);
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,61 +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, include("includes.php");
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 $assetclassgroup_id = sanitize($_GET['assetclassgroup_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); assetclassgroup_id,
assetclassgroup_name,
assetclassgroup_color
FROM
assetclassgroup
WHERE
assetclassgroup_id=" . $assetclassgroup_id;
// get id $assetclassgroup = $db->db_select($query);
$assetclassgroup_id = $_GET['assetclassgroup_id'];
// check authorisation $smarty->assign("assetclassgroup_id", $assetclassgroup[0]['assetclassgroup_id']);
$auth = auth("assetclassgroup", $config_auth_assetclassgroupview, $assetclassgroup_id); $smarty->assign("assetclassgroup_name", $assetclassgroup[0]['assetclassgroup_name']);
$smarty->assign("assetclassgroup_color", $assetclassgroup[0]['assetclassgroup_color']);
// start output $query = "SELECT
include("header.php"); assetclass_id,
assetclass_name
FROM
assetclass
WHERE
assetclassgroup_id=" . $assetclassgroup_id . "
ORDER BY
assetclass_name";
// set template $assetclasses = $db->db_select($query);
$tp = new Template("tpl/assetclassgroupview.tpl"); $smarty->assign("assetclasses", $assetclasses);
// set language variables $smarty->display("assetclassgroupview.tpl");
$tp->setvars($lang);
// get assetclassgroup info include("footer.php");
$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");
?> ?>

View File

@@ -1,63 +1,51 @@
<?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, include("includes.php");
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 $assetclass_id = sanitize($_GET['assetclass_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); a.assetclass_id, a.assetclass_name,
g.assetclassgroup_id, g.assetclassgroup_name, g.assetclassgroup_color
FROM
assetclass AS a LEFT OUTER JOIN assetclassgroup AS g USING (assetclassgroup_id)
WHERE
a.assetclass_id=" . $assetclass_id;
// get id $assetclass = $db->db_select($query);
$assetclass_id = $_GET['assetclass_id'];
// check authorisation $smarty->assign("assetclass_id", $assetclass[0]['assetclass_id']);
$auth = auth("assetclass", $config_auth_assetclassview, $assetclass_id); $smarty->assign("assetclass_name", $assetclass[0]['assetclass_name']);
$smarty->assign("assetclass_selected", "");
// start output $smarty->assign("assetclassgroup_id", $assetclass[0]['assetclassgroup_id']);
include("header.php"); $smarty->assign("assetclassgroup_name", $assetclass[0]['assetclassgroup_name']);
$smarty->assign("assetclassgroup_color", $assetclass[0]['assetclassgroup_color']);
// set template $query = "SELECT
$tp = new Template("tpl/assetclassview.tpl"); asset_id,
asset_name,
CONCAT(LEFT(asset_info, 80), IF(CHAR_LENGTH(asset_info)>80,'...','')) AS asset_info
FROM
asset
WHERE
assetclass_id='" . $assetclass_id . "'
ORDER BY
asset_name";
// set language variables $assets = $db->db_select($query);
$tp->setvars($lang); $smarty->assign("assets", $assets);
// 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 include("footer.php");
$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");
?> ?>

View File

@@ -1,61 +1,44 @@
<?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, include("includes.php");
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 $asset_id = sanitize($_GET['asset_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); asset_name
FROM
asset
WHERE
asset_id=" . $asset_id;
// get id $asset = $db->db_select($query);
$asset_id = $_GET['asset_id'];
// check authorisation $smarty->assign("asset_id", $asset_id);
$auth = auth("asset", $config_auth_assetdel, $asset_id); $smarty->assign("asset_name", $asset[0]['asset_name']);
// start output $query = "SELECT
include("header.php"); node_id,
node_ip
FROM
node
WHERE
asset_id=" . $asset_id . "
ORDER BY
INET_ATON(node_ip)";
// set template $nodes = $db->db_select($query);
$tp = new Template("tpl/assetdel.tpl"); $smarty->assign("nodes", $nodes);
// set language variables $smarty->display("assetdel.tpl");
$tp->setvars($lang);
// get asset info include("footer.php");
$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");
?> ?>

View File

@@ -1,65 +1,35 @@
<?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, include("includes.php");
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 $asset_id = sanitize($_GET['asset_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); asset_id,
asset_name,
asset_hostname,
asset_info,
assetclass_id
FROM
asset
WHERE
asset_id=" . $asset_id;
// get id $asset = $db->db_select($query);
$asset_id = $_GET['asset_id']; $smarty->assign("asset", $asset[0]);
// check authorisation $smarty->assign("assetclass_options", $db->options_assetclass());
$auth = auth("asset", $config_auth_assetedit, $asset_id);
// start output $smarty->display("assetedit.tpl");
include("header.php");
// set template include("footer.php");
$tp = new Template("tpl/assetedit.tpl");
// set language variables
$tp->setvars($lang);
// get asset information
$result = mysql_query("SELECT asset_name, hostname, assetclass_id, asset_info FROM asset WHERE asset_id='$asset_id'") or die(mysql_error());
$row = mysql_fetch_object($result);
$assetclass_id = $row->assetclass_id;
$tp->set("asset_id", $asset_id);
$tp->set("asset_name", $row->asset_name);
$tp->set("hostname", $row->hostname);
$tp->set("asset_info", $row->asset_info);
// get assetclass information
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error());
for ($i=0;$row=mysql_fetch_object($result);$i++) {
if (($row->assetclass_id==$assetclass_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
$tp->set("assetclass_id", $row->assetclass_id);
$tp->set("assetclass_name", $row->assetclass_name);
$tp->parse("assetclassrow");
}
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

View File

@@ -1,73 +1,54 @@
<?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, include("includes.php");
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 $asset_id = sanitize($_GET['asset_id']);
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); a.asset_name,
a.asset_hostname,
a.asset_info,
c.assetclass_id,
c.assetclass_name
FROM
asset AS a LEFT OUTER JOIN assetclass AS c USING (assetclass_id)
WHERE
a.asset_id=" . $asset_id;
// get id $asset = $db->db_select($query);
$asset_id = $_GET['asset_id'];
// check authorisation $smarty->assign("asset_id", $asset_id);
auth("asset", $config_auth_assetview, $asset_id); $smarty->assign("asset_name", $asset[0]['asset_name']);
$smarty->assign("asset_hostname", $asset[0]['asset_hostname']);
$smarty->assign("asset_info", nl2br($asset[0]['asset_info']));
// start output $smarty->assign("assetclass_id", $asset[0]['assetclass_id']);
include("header.php"); $smarty->assign("assetclass_name", $asset[0]['assetclass_name']);
// set template $query = "SELECT
$tp = new Template("tpl/assetview.tpl"); node_id,
node_ip,
LEFT(node_info, 40) as node_info
FROM
node
WHERE
asset_id=" . $asset_id . "
ORDER BY
INET_ATON(node_ip)";
// set language variables $nodes = $db->db_select($query);
$tp->setvars($lang); $smarty->assign("nodes", $nodes);
// 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 include("footer.php");
$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");
?> ?>

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,35 @@
<?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, include("includes.php");
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 $node_ip = sanitize($_GET['node_ip']);
along with this program. If not, see <http://www.gnu.org/licenses/>. $subnet_id = sanitize($_GET['subnet_id']);
For more information, visit http://sourceforge.net/projects/ipreg, include("header.php");
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// includes $query = "SELECT
include("includes.php"); subnet_address,
subnet_mask
FROM
subnet
WHERE
subnet_id=" . $subnet_id;
// start output $subnet = $db->db_select($query);
include("header.php");
// get ip and id $smarty->assign("subnet_id", $subnet_id);
$ip = $_GET['ip']; $smarty->assign("subnet_address", $subnet[0]['subnet_address']);
$subnet_id = $_GET['subnet_id']; $smarty->assign("subnet_mask", $subnet[0]['subnet_mask']);
$smarty->assign("node_ip", $node_ip);
// set template $smarty->display("assigniptonode.tpl");
$tp = new Template("tpl/assigniptonode.tpl");
// set language variables include("footer.php");
$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");
?> ?>

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

49
assignnodetoasset.php Normal file
View File

@@ -0,0 +1,49 @@
<?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);
$query = "SELECT
asset_id,
asset_name
FROM
asset
ORDER BY
asset_name";
$assets = $db->db_select($query);
foreach ($assets as $asset) {
$asset_options[$asset['asset_id']] = $asset['asset_name'];
}
$smarty->assign("asset_options", $asset_options);
$query = "SELECT subnet_id,
CONCAT_WS('/', subnet_address, subnet_mask) AS subnet_name
FROM subnet
ORDER BY INET_ATON(subnet_address)";
$subnets = $db->db_select($query);
foreach ($subnets as $subnet) {
$subnet_options[$subnet['subnet_id']] = $subnet['subnet_name'];
}
$smarty->assign("subnet_options", $subnet_options);
$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");
?>

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, include("includes.php");
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 include("header.php");
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 $comments = sanitize($_GET['comments']);
include("includes.php");
// start output $smarty->assign("comments", $lang['lang_comments_' . $comments]);
include("header.php");
// set template $smarty->display("comments.tpl");
$tp = new Template("tpl/comments.tpl");
// set language variables include("footer.php");
$tp->setvars($lang);
// get error
$comments = $_GET['comments'];
// set veriables
$tp->set("comments", $lang['lang_comments_' . $comments]);
// output
$tp->parse();
$tp->spit();
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;
?>

24
config.php-sample Normal file
View File

@@ -0,0 +1,24 @@
<?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';
?>

View File

@@ -1,25 +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, $dblink = mysqli_connect($config_mysql_host,$config_mysql_username,$config_mysql_password);
but WITHOUT ANY WARRANTY; without even the implied warranty of mysqli_select_db($dblink, $config_mysql_dbname);
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, $smarty->assign("config_version", $config_version);
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 $smarty->display("footer.tpl");
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
$tp = new Template("tpl/footer.tpl");
// get version for the footer-stamp
$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,51 +1,41 @@
<?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, include('lang/' . $_SESSION['suser_language'] . '.php');
but WITHOUT ANY WARRANTY; without even the implied warranty of $smarty->assign($lang);
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 // search box
along with this program. If not, see <http://www.gnu.org/licenses/>. if (isset($_POST['search'])) {
$search = sanitize($_POST['search']);
For more information, visit http://sourceforge.net/projects/ipreg, $_SESSION['search'] = $search;
or contact me at wietsew@users.sourceforge.net } else {
*****************************************************************************/ if (isset($_SESSION['search'])) {
$search = $_SESSION['search'];
// include language file
include('lang/' . $_SESSION['suser_lang'] . '.php');
// set template
$tp = new Template("tpl/header.tpl");
// set language variables
$tp->setvars($lang);
// set search box
if (isset($_POST['search'])) {
$search = $_POST['search'];
$_SESSION['search'] = $search;
} else { } else {
if(isset($_SESSION['search'])) { $search = '';
$search = $_SESSION['search'];
} else {
$search = '';
}
} }
}
// 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(); $smarty->assign("menu_assets", $_SESSION['suser_menu_assets']=='on');
$tp->spit(); $smarty->assign("menu_assetclasses", $_SESSION['suser_menu_assetclasses']=='on');
$smarty->assign("menu_assetclassgroups", $_SESSION['suser_menu_assetclassgroups']=='on');
$smarty->assign("menu_locations", $_SESSION['suser_menu_locations']=='on');
$smarty->assign("menu_nodes", $_SESSION['suser_menu_nodes']=='on');
$smarty->assign("menu_subnets", $_SESSION['suser_menu_subnets']=='on');
$smarty->assign("menu_users", $_SESSION['suser_menu_users']=='on');
$smarty->assign("menu_vlans", $_SESSION['suser_menu_vlans']=='on');
$smarty->assign("menu_zones", $_SESSION['suser_menu_zones']=='on');
$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/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/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/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

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

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/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/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/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/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/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/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,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, session_name('ipreg');
but WITHOUT ANY WARRANTY; without even the implied warranty of session_start();
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 // check for user_id, if unnkown, redirect to login
along with this program. If not, see <http://www.gnu.org/licenses/>. if(empty($_SESSION['suser_id'])) {
header("Location: login.php");
exit;
}
For more information, visit http://sourceforge.net/projects/ipreg, include("config.php");
or contact me at wietsew@users.sourceforge.net include("dbconnect.php");
*****************************************************************************/
session_start(); include("lib.php");
// check for user_id, if unnkown -> login $language = lang_getfrombrowser($config_lang, $config_lang_default, null, false);
if(empty($_SESSION['suser_id'])) {
header("Location: login.php");
exit;
}
// includes
include("config.php");
include("dbconnect.php");
include("functions.php");
include("yapter.php");
// auth items
$authitems = array(
'ipreg' => array(
'name' => 'IP Reg',
),
'asset' => array(
'name' => 'Asset',
'item_id' => 'asset_id',
'item_name' => 'asset_name',
),
'assetclass' => array(
'name' => 'Assetclass',
'item_id' => 'assetclass_id',
'item_name' => 'assetclass_name',
),
'location' => array(
'name' => 'Location',
'item_id' => 'location_id',
'item_name' => 'location_name',
),
'node' => array(
'name' => 'Node',
'item_id' => 'node_id',
'item_name' => 'ip',
),
'subnet' => array(
'name' => 'Subnet',
'item_id' => 'subnet_id',
'item_name' => 'subnet_address',
),
'user' => array(
'name' => 'User',
'item_id' => 'user_id',
'item_name' => 'user_name',
),
'userclass' => array(
'name' => 'Userclass',
'item_id' => 'userclass_id',
'item_name' => 'userclass_name',
),
'vlan' => array(
'name' => 'VLAN',
'item_id' => 'vlan_id',
'item_name' => 'vlan_name',
),
);
?> ?>

100
index.php
View File

@@ -1,65 +1,69 @@
<?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, include("includes.php");
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 include("header.php");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, // asset
or contact me at wietsew@users.sourceforge.net $query = "SELECT
*****************************************************************************/ COUNT(asset_id) AS asset_counter
FROM
asset";
// includes $assets = $db->db_select($query);
include("includes.php"); $smarty->assign("asset_counter", $assets[0]['asset_counter']);
// start output // location
include("header.php"); $query = "SELECT
COUNT(location_id) AS location_counter
FROM
location";
// set template $locations = $db->db_select($query);
$tp = new Template("tpl/index.tpl"); $smarty->assign("location_counter", $locations[0]['location_counter']);
// set language variables // node
$tp->setvars($lang); $query = "SELECT
COUNT(node_id) AS node_counter
FROM
node";
// calculate assets $nodes = $db->db_select($query);
$query = mysql_query("SELECT asset_id FROM asset") or die(mysql_error()); $smarty->assign("node_counter", $nodes[0]['node_counter']);
$assetcount = mysql_num_rows($query);
$tp->set('assetcount', $assetcount);
// calculate locations // subnet
$query = mysql_query("SELECT location_id FROM location") or die(mysql_error()); $query = "SELECT
$locationcount = mysql_num_rows($query); COUNT(subnet_id) AS subnet_counter
$tp->set('locationcount', $locationcount); FROM
subnet";
$subnets = $db->db_select($query);
$smarty->assign("subnet_counter", $subnets[0]['subnet_counter']);
// calculate nodes // vlan
$query = mysql_query("SELECT node_id FROM node") or die(mysql_error()); $query = "SELECT
$nodecount = mysql_num_rows($query); COUNT(vlan_id) AS vlan_counter
$tp->set('nodecount', $nodecount); FROM
vlan";
// calculate subnets $vlans = $db->db_select($query);
$query = mysql_query("SELECT subnet_id FROM subnet") or die(mysql_error()); $smarty->assign("vlan_counter", $vlans[0]['vlan_counter']);
$subnetcount = mysql_num_rows($query);
$tp->set('subnetcount', $subnetcount);
// calculate vlans // zone
$query = mysql_query("SELECT vlan_id FROM vlan") or die(mysql_error()); $query = "SELECT
$vlancount = mysql_num_rows($query); COUNT(zone_id) AS zone_counter
$tp->set('vlancount', $vlancount); FROM
zone";
$zones = $db->db_select($query);
$smarty->assign("zone_counter", $zones[0]['zone_counter']);
// 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,55 @@
--- IP Reg Installation
--- IP Reg 0.4
--- http://sourceforge.net/projects/ipreg
---
Installation instructions 1. Install requirements
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

141
install/mysql.sql Normal file
View File

@@ -0,0 +1,141 @@
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,
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 varchar(6) NOT NULL DEFAULT '000000',
PRIMARY KEY (assetclassgroup_id),
INDEX ix_assetclassgroup_name (assetclassgroup_name)
) 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_sort int(11) 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,
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)
) 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)
) 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_name varchar(100) NOT NULL,
user_pass varchar(32) 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_menu_assets varchar(2) NOT NULL DEFAULT 'on',
user_menu_assetclasses varchar(2) NOT NULL DEFAULT 'on',
user_menu_assetclassgroups varchar(2) NOT NULL DEFAULT 'on',
user_menu_locations varchar(2) NOT NULL DEFAULT 'on',
user_menu_nodes varchar(2) NOT NULL DEFAULT 'on',
user_menu_subnets varchar(2) NOT NULL DEFAULT 'on',
user_menu_users varchar(2) NOT NULL DEFAULT 'on',
user_menu_vlans varchar(2) NOT NULL DEFAULT 'on',
user_menu_zones varchar(2) NOT NULL DEFAULT 'on',
user_tooltips varchar(2) NOT NULL DEFAULT 'on',
PRIMARY KEY (user_id),
UNIQUE INDEX ix_username (user_name)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO user (user_name, user_pass, user_displayname) VALUES
('admin', '21232f297a57a5a743894a0e4a801fc3', 'administrator');
CREATE TABLE vlan (
vlan_id int(10) NOT NULL AUTO_INCREMENT,
vlan_number int(3) NOT NULL,
vlan_name varchar(100) NOT NULL,
vlan_info text 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) CHARACTER SET utf8 NOT NULL,
zone_hostmaster varchar(40) CHARACTER SET utf8 NOT NULL,
zone_origin varchar(40) CHARACTER SET utf8 NOT NULL,
zone_ttl_default varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '3D',
zone_refresh varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '8H',
zone_retry varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '2H',
zone_expire varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '4W',
zone_ttl varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '1D',
zone_serial int(10) unsigned NOT NULL,
zone_ns1 varchar(20) CHARACTER SET utf8 NOT NULL,
zone_ns2 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_ns3 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_mx1 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_mx2 varchar(20) CHARACTER SET utf8 DEFAULT NULL,
zone_info text CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (zone_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

56
install/mysql_sample.sql Normal file
View File

@@ -0,0 +1,56 @@
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 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');

229
lang/de.php Normal file
View File

@@ -0,0 +1,229 @@
<?php
$lang = array(
'lang_ipreg' => 'IP Reg',
'lang_asset' => 'Objekt',
'lang_assets' => 'Objekte',
'lang_assetclass' => 'Objektklasse',
'lang_assetclasses' => 'Objektklassen',
'lang_assetclassgroup' => 'Objektklassengruppe',
'lang_assetclassgroups' => 'Objektklassengruppen',
'lang_location' => 'Standort',
'lang_locations' => 'Standorte',
'lang_menu' => 'Menü',
'lang_node' => 'Knoten',
'lang_nodes' => 'Knoten',
'lang_user' => 'Benutzer',
'lang_users' => 'Benutzer',
'lang_zone' => 'Zone',
'lang_zones' => 'Zonen',
'lang_sublocation' => 'Unterstandort',
'lang_sublocations' => 'Unterstandorte',
'lang_subnet' => 'Subnetz',
'lang_subnets' => 'Subnetze',
'lang_tooltips' => 'Tooltips',
'lang_vlan' => 'VLAN',
'lang_vlans' => 'VLANs',
'lang_about' => 'Über',
'lang_all' => 'Allw',
'lang_cancel' => 'Abbruch',
'lang_color' => 'Farbe',
'lang_error' => 'Fehler',
'lang_item' => 'Gegenstand',
'lang_language' => 'Sprache',
'lang_login' => 'Anmelden',
'lang_logout' => 'Abmelden',
'lang_options' => 'Optionen',
'lang_option_none' => '(kein)',
'lang_reset' => 'Zur&uuml;cksetzen',
'lang_search' => 'Suche',
'lang_statistics' => 'Statistik',
'lang_subitem' => 'Sub-Item',
'lang_submit' => 'Absenden',
'lang_unassigned' => 'Nicht zugeordnet',
'lang_warning' => 'Warnung',
'lang_asset_add' => 'Objekt hinzufügen',
'lang_asset_del' => 'Objekt löschen',
'lang_asset_edit' => 'Objekt ändern',
'lang_asset_info' => 'Objektinfo',
'lang_asset_name' => 'Objektname',
'lang_asset_hostname' => 'Hostname',
'lang_asset_none' => 'Es sind keine Objekte vorhanden',
'lang_assetclass_add' => 'Objektklasse hinzufügen',
'lang_assetclass_del' => 'Objektklasse löschen',
'lang_assetclass_edit' => 'Objektklasse ändern',
'lang_assetclass_name' => 'Objektklassenname',
'lang_assetclass_none' => 'Es sind keine Objektklassen vorhanden',
'lang_assetclassgroup_add' => 'Objektklassengruppe hinzufügen',
'lang_assetclassgroup_del' => 'Objektklassengruppe löschen',
'lang_assetclassgroup_edit' => 'Objektklassengruppe ändern',
'lang_assetclassgroup_name' => 'Objektklassengruppenname',
'lang_assetclassgroup_none' => 'Es sind keine Objektklassengruppen vorhanden',
'lang_assignnodetoasset' => 'Knoten zu Objekt hinzufügen',
'lang_assignnodetoasset_existing' => 'Knoten zu existierendem Objekt hinzufügen',
'lang_assignnodetoasset_new' => 'Knoten zu neuem Objekt hinzufügen',
'lang_assigniptonode' => 'IP zu Knoten hinzufügen',
'lang_assigniptonode_existing' => 'IP zu existierendem Knoten hinzufügen',
'lang_assigniptonode_new' => 'IP zu neuem Knoten hinzufügen',
'lang_assignlocationtosubnet' => 'Standort zu Subnetz hinzufügen',
'lang_assignlocationtosubnet_existing' => 'Assign location to existing subnet',
'lang_assignlocationtosubnet_new' => 'Assign location to new subnet',
'lang_assignsubnettovlan' => 'Assign subnet to VLAN',
'lang_assignsubnettovlan_existing' => 'Assign subnet to existing VLAN',
'lang_assignsubnettovlan_new' => 'Assign subnet to new VLAN',
'lang_assignvlantosubnet' => 'Assign VLAN to subnet',
'lang_assignvlantosubnet_existing' => 'Assign VLAN to existing subnet',
'lang_assignvlantosubnet_new' => 'Assign VLAN to new subnet',
'lang_location_add' => 'Standort hinzufügen',
'lang_location_del' => 'Standort löschen',
'lang_location_edit' => 'Standort ändern',
'lang_location_info' => 'Standortinfo',
'lang_location_name' => 'Standortname',
'lang_location_parent' => 'Übergeordneter Standort',
'lang_sublocation_add' => 'Unterstandort hinzufügen',
'lang_location_none' => 'Es sind keine Standorte vorhanden',
'lang_locationsubnet' => 'Standort/Subnetz',
'lang_locationsubnet_edit' => 'Standort/Subnetz bearbeiten',
'lang_node_add' => 'Knoten hinzufügen',
'lang_node_del' => 'Knoten löschen',
'lang_node_edit' => 'Knoten ändern',
'lang_node_info' => 'Knoteninfo',
'lang_node_none' => 'Es sind keine Knoten vorhanden',
'lang_dns1' => 'DNS-Name',
'lang_dns2' => 'DNS-Alias',
'lang_ip' => 'IP-Adresse',
'lang_mac' => 'MAC-Adresse',
'lang_proto_vers' => 'Protokollversion',
'lang_nat' => 'NAT',
'lang_nat_add' => 'NAT hinzufügen',
'lang_nat_del' => 'NAT löschen',
'lang_nat_edit' => 'NAT ändern',
'lang_nat_rules' => 'NAT Regeln',
'lang_nat_type' => 'Typ',
'lang_nat_type_1' => 'Verbergen',
'lang_nat_type_2' => 'Statisch',
'lang_nat_type_3' => 'Dynamisch',
'lang_search_results_found' => 'Anzahl der gefundenen Ergebnisse: ',
'lang_subnet_add' => 'Subnetz hinzufügen',
'lang_subnet_subnetaddress' => 'Subnetzadresse',
'lang_subnet_subnetaddress_mask' => 'Subnetzadresse/Maske',
'lang_subnet_broadcastaddress' => 'Broadcastadresse',
'lang_subnet_nodesinsubnet' => 'Nodes im Subnetz',
'lang_subnet_subnetused' => 'Subnetz benutzt',
'lang_subnet_del' => 'Subnetz löschen',
'lang_subnet_edit' => 'Subnetz ändern',
'lang_subnet_info' => 'Subnetzinfo',
'lang_subnet_mask' => 'Subnetzmaske',
'lang_subnet_dhcp' => 'DHCP ausschließen',
'lang_subnet_dhcpstart' => 'DHCP Anfang',
'lang_subnet_dhcpend' => 'DHCP Ende',
'lang_subnet_ntp_server' => 'NTP-Server',
'lang_subnet_none' => 'Es sind keine Subnetze vorhanden',
'lang_subnetlocation' => 'Subnetz/Ort',
'lang_subnetlocation_edit' => 'Subnetz/Ort bearbeiten',
'lang_subnetvlan' => 'Subnetz/VLAN',
'lang_subnetvlan_edit' => 'Subnetz/VLAN bearbeiten',
'lang_user_add' => 'Benutzer hinzufügen',
'lang_user_del' => 'Benutzer löschen',
'lang_user_displayname' => 'Anzeigename',
'lang_user_edit' => 'Benutzer bearbeiten',
'lang_user_name' => 'Benutzername',
'lang_user_password' => 'Kennwort',
'lang_user_language' => 'Sprache',
'lang_zone_add' => 'Zone hinzufügen',
'lang_zone_del' => 'Zone löschen',
'lang_zone_edit' => 'Zone bearbeiten',
'lang_zone_none' => 'Es sind keine Zonen vorhanden',
'lang_vlan_add' => 'VLAN hinzufügen',
'lang_vlan_del' => 'VLAN löschen',
'lang_vlan_edit' => 'VLAN ändern',
'lang_vlan_number' => 'VLAN ID',
'lang_vlan_info' => 'VLAN Info',
'lang_vlan_new' => 'VLAN Info',
'lang_vlan_name' => 'VLAN Name',
'lang_vlan_none' => 'Es sind keine VLANs vorhanden',
'lang_vlansubnet' => 'VLAN/Subnetz',
'lang_vlansubnet_edit' => 'VLAN/Subnetz bearbeiten',
'lang_comments' => 'Kommentare',
'lang_comments_error' => 'Fehler',
'lang_comments_asset_del_nodes' => 'Diese Knoten werden ebenfalls gelöscht!',
'lang_comments_ipinuse' => 'IP wird bereits verwendet',
'lang_comments_notallowed' => 'Nicht erlaubt',
'lang_comments_search_nosearch' => 'Es gibt nichts zu suchen!',
'lang_comments_usernameinuse' => 'Benutzername wird bereits verwendet',
'lang_comments_invalidpass' => 'Das Kennwort ist falsch',
'lang_comments_invalidnewpass' => 'Das neue Kennwort wurde nicht korrekt eingegeben',
'lang_options_ipreg' => 'IP Reg Optionen',
'lang_options_display' => 'Anzeigeeinstellungen',
'lang_options_password' => 'Kennwort ändern',
'lang_options_imagesize' => 'Bildgröße',
'lang_options_imagesize_help' => 'Größe (in Pixel) der farbigen Quadrate in der Subnetzanzeige',
'lang_options_imagecount' => 'Bildanzahl',
'lang_options_imagecount_help' => 'Anzahl der farbigen Quadrate je Zeile in der Subnetzanzeige',
'lang_options_mac' => 'MAC-Adresse',
'lang_options_mac_help' => 'Format in der eine MAC-Adresse dargestellt wird (z.B. xx-xx-xx-xx-xx-xx)',
'lang_options_menu_help' => 'Select items to be displayed in menu',
'lang_options_dateformat' => 'Datumsformat',
'lang_options_dateformat_help' => 'Format in which dates are displayed using the php-date-format (see http://www.php.net/date for more info)',
'lang_options_dns1suffix' => 'DNS Name suffix',
'lang_options_dns1suffix_help' => 'Default DNS Name suffix für neue Knoten',
'lang_options_dns2suffix' => 'DNS Alias suffix',
'lang_options_dns2suffix_help' => 'Default DNS Alias suffix für neue Knoten',
'lang_options_currentpassword' => 'Aktuelles Kennwort',
'lang_options_currentpassword_help' => 'Bitte geben Sie hier Ihr bisheriges Kennwort ein',
'lang_options_newpassword1' => 'Neues Kennwort',
'lang_options_newpassword1_help' => 'Bitte geben Sie hier Ihr neues Kennwort ein',
'lang_options_newpassword2' => 'Neues Kennwort (Wiederholung)',
'lang_options_newpassword2_help' => 'Bitte geben Sie hier nochmals Ihr neues Kennwort ein',
'lang_options_tooltips_help' => 'Tooltips anzeigen',
'lang_options_language_help' => 'Sprache für diesen Benutzer',
'lang_about_projectpage' => 'Aktuelle Projektseite',
'lang_about_sfprojectpage' => 'Sourceforge Projektseite',
'lang_about_license' => 'Lizenz',
'lang_about_gpl' => 'GNU General Public License (GPL)',
'lang_about_smarty' => 'Smarty Template Engine',
'lang_about_iconset' => 'Silk icon set 1.3',
'lang_about_ipreg_ext' => 'IP Reg, a PHP/MySQL IPAM tool',
'lang_about_license_ext' => 'Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)<br>Copyright (C) 2011-2023 Thomas Hooge<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<p> You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.',
'lang_about_changelog' => 'Changelog (major changes only)',
'lang_about_changelog_v08' => 'v0.8 (feb 2023)',
'lang_about_changelog_v08_ext' => '- Some small improvements and bugfixing<br>- Code simplification as preparation for big refactoring',
'lang_about_changelog_v07' => 'v0.7 (oct 2018)',
'lang_about_changelog_v07_ext' => '- Added support for PHP7, switched to mysqli',
'lang_about_changelog_v06' => 'v0.6 (may 2011)',
'lang_about_changelog_v06_ext' => '- Moved towards smarty template engine<br />- language support finalized<br>- added german language<br>- some small bug fixes',
'lang_about_changelog_v05' => 'v0.5 (dec 2009)',
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>- More user options',
'lang_about_changelog_v04' => 'v0.4 (jun 2008)',
'lang_about_changelog_v04_ext' => '- SQL vulnerability fixed<br>- PHP-generated images in subnet overview',
'lang_about_changelog_v03' => 'v0.3 (dec 2007)',
'lang_about_changelog_v03_ext' => '- Class A subnet support<br>- Multi-language support<br>- User defined options<br>- All configuration options in one file (config.php)',
'lang_about_changelog_v02' => 'v0.2 (dec 2007)',
'lang_about_changelog_v02_ext' => '- Fixed ordering of IP addresses<br>- Fixed info fields',
'lang_about_changelog_v01' => 'v0.1 (dec 2007)',
'lang_about_changelog_v01_ext' => '- First beta release',
);
?>

View File

@@ -1,134 +1,229 @@
<?php <?php
$lang = array( $lang = array(
'lang_asset' => 'Asset', 'lang_ipreg' => 'IP Reg',
'lang_assets' => 'Assets',
'lang_assetclass' => 'Assetclass',
'lang_assetclasses' => 'Assetclasses',
'lang_assetclassgroup' => 'Assetclassgroup',
'lang_assetclassgroups' => 'Assetclassgroups',
'lang_location' => 'Location',
'lang_locations' => 'Locations',
'lang_node' => 'Node',
'lang_nodes' => 'Nodes',
'lang_user' => 'User',
'lang_users' => 'Users',
'lang_userclass' => 'Userclass',
'lang_userclasses' => 'Userclasses',
'lang_sublocation' => 'Sub-location',
'lang_sublocations' => 'Sub-locations',
'lang_subnet' => 'Subnet',
'lang_subnets' => 'Subnets',
'lang_vlan' => 'VLAN',
'lang_vlans' => 'VLANs',
'lang_about' => 'About', 'lang_asset' => 'Asset',
'lang_all' => 'All', 'lang_assets' => 'Assets',
'lang_cancel' => 'Cancel', 'lang_assetclass' => 'Assetclass',
'lang_color' => 'Color', 'lang_assetclasses' => 'Assetclasses',
'lang_error' => 'Error', 'lang_assetclassgroup' => 'Assetclassgroup',
'lang_header_viewby' => 'View by', 'lang_assetclassgroups' => 'Assetclassgroups',
'lang_item' => 'Item', 'lang_location' => 'Location',
'lang_language' => 'Language', 'lang_locations' => 'Locations',
'lang_login' => 'Login', 'lang_menu' => 'Menu',
'lang_logout' => 'Logout', 'lang_node' => 'Node',
'lang_options' => 'Options', 'lang_nodes' => 'Nodes',
'lang_reset' => 'Reset', 'lang_user' => 'User',
'lang_search' => 'Search!', 'lang_users' => 'Users',
'lang_statistics' => 'Statistics', 'lang_zone' => 'Zone',
'lang_subitem' => 'Sub-Item', 'lang_zones' => 'Zones',
'lang_submit' => 'Submit', 'lang_sublocation' => 'Sub-location',
'lang_unassigned' => 'Unassigned', 'lang_sublocations' => 'Sub-locations',
'lang_userclassauth' => 'Authorization', 'lang_subnet' => 'Subnet',
'lang_subnets' => 'Subnets',
'lang_tooltips' => 'Tooltips',
'lang_vlan' => 'VLAN',
'lang_vlans' => 'VLANs',
'lang_asset_add' => 'Add asset', 'lang_about' => 'About',
'lang_asset_del' => 'Delete asset', 'lang_all' => 'All',
'lang_asset_edit' => 'Modify asset', 'lang_cancel' => 'Cancel',
'lang_asset_info' => 'Asset info', 'lang_color' => 'Color',
'lang_asset_name' => 'Asset name', 'lang_error' => 'Error',
'lang_hostname' => 'Hostname', 'lang_item' => 'Item',
'lang_language' => 'Language',
'lang_login' => 'Login',
'lang_logout' => 'Logout',
'lang_options' => 'Options',
'lang_option_none' => '(none)',
'lang_reset' => 'Reset',
'lang_search' => 'Search',
'lang_statistics' => 'Statistics',
'lang_subitem' => 'Sub-Item',
'lang_submit' => 'Submit',
'lang_unassigned' => 'Unassigned',
'lang_warning' => 'Warning',
'lang_assetclass_add' => 'Add assetclass', 'lang_asset_add' => 'Add asset',
'lang_assetclass_del' => 'Delete assetclass', 'lang_asset_del' => 'Delete asset',
'lang_assetclass_edit' => 'Mofidy assetclass', 'lang_asset_edit' => 'Modify asset',
'lang_assetclass_name' => 'Assetclass name', 'lang_asset_info' => 'Asset info',
'lang_asset_name' => 'Asset name',
'lang_asset_hostname' => 'Hostname',
'lang_asset_none' => 'There are no assets defined',
'lang_userclassauth_add' => 'Add authorization', 'lang_assetclass_add' => 'Add assetclass',
'lang_userclassauth_del' => 'Delete authorization', 'lang_assetclass_del' => 'Delete assetclass',
'lang_userclassauth_edit' => 'Mofidy authorization', 'lang_assetclass_edit' => 'Mofidy assetclass',
'lang_assetclass_name' => 'Assetclass name',
'lang_assetclass_none' => 'There are no assetclasses defined',
'lang_assetclassgroup_add' => 'Add assetclassgroup', 'lang_assetclassgroup_add' => 'Add assetclassgroup',
'lang_assetclassgroup_del' => 'Delete assetclassgroup', 'lang_assetclassgroup_del' => 'Delete assetclassgroup',
'lang_assetclassgroup_edit' => 'Modify assetclassgroup', 'lang_assetclassgroup_edit' => 'Modify assetclassgroup',
'lang_assetclassgroup_name' => 'Assetclass Groupname', 'lang_assetclassgroup_name' => 'Assetclass Groupname',
'lang_assetclassgroup_none' => 'There are no assetclassegroups defined',
'lang_assigniptoasset' => 'Assign IP to asset', 'lang_assignnodetoasset' => 'Assign node to asset',
'lang_assignlocationtosubnet' => 'Assign location to subnet', 'lang_assignnodetoasset_existing' => 'Assign node to existing asset',
'lang_assignvlantosubnet' => 'Assign VLAN to subnet', 'lang_assignnodetoasset_new' => 'Assign node to new asset',
'lang_assigniptonode' => 'Assign IP to node',
'lang_assigniptonode_existing' => 'Assign IP to existing node',
'lang_assigniptonode_new' => 'Assign IP to new node',
'lang_assignlocationtosubnet' => 'Assign location to subnet',
'lang_assignlocationtosubnet_existing' => 'Assign location to existing subnet',
'lang_assignlocationtosubnet_new' => 'Assign location to new subnet',
'lang_assignsubnettovlan' => 'Assign subnet to VLAN',
'lang_assignsubnettovlan_existing' => 'Assign subnet to existing VLAN',
'lang_assignsubnettovlan_new' => 'Assign subnet to new VLAN',
'lang_assignvlantosubnet' => 'Assign VLAN to subnet',
'lang_assignvlantosubnet_existing' => 'Assign VLAN to existing subnet',
'lang_assignvlantosubnet_new' => 'Assign VLAN to new subnet',
'lang_location_add' => 'Add location', 'lang_location_add' => 'Add location',
'lang_location_del' => 'Delete location', 'lang_location_del' => 'Delete location',
'lang_location_edit' => 'Mofidy location', 'lang_location_edit' => 'Mofidy location',
'lang_location_info' => 'Location info', 'lang_location_info' => 'Location info',
'lang_location_name' => 'Location name', 'lang_location_name' => 'Location name',
'lang_location_parent' => 'Parent', 'lang_location_parent' => 'Parent',
'lang_sublocation_add' => 'Add Sub-location', 'lang_sublocation_add' => 'Add Sub-location',
'lang_location_none' => 'There are no locations defined',
'lang_node_add' => 'Add node', 'lang_locationsubnet' => 'Location/Subnet',
'lang_node_del' => 'Delete node', 'lang_locationsubnet_edit' => 'Edit Location/Subnet',
'lang_node_edit' => 'Modify node',
'lang_node_info' => 'Node info',
'lang_node_new' => 'Create new node',
'lang_dns1' => 'DNS name',
'lang_dns2' => 'DNS Alias',
'lang_ip' => 'IP Address',
'lang_mac' => 'MAC Address',
'lang_search_found' => 'found', 'lang_node_add' => 'Add node',
'lang_search_results_found' => 'Total results found', 'lang_node_del' => 'Delete node',
'lang_node_edit' => 'Modify node',
'lang_node_info' => 'Node info',
'lang_node_none' => 'There are no nodes defined',
'lang_dns1' => 'DNS name',
'lang_dns2' => 'DNS Alias',
'lang_ip' => 'IP Address',
'lang_mac' => 'MAC Address',
'lang_proto_vers' => 'Protocol version',
'lang_subnet_add' => 'Add subnet', 'lang_nat' => 'NAT',
'lang_subnet_subnetaddress' => 'Subnet address', 'lang_nat_add' => 'Add NAT',
'lang_subnet_broadcastaddress' => 'Broadcast address', 'lang_nat_del' => 'Delete NAT',
'lang_subnet_del' => 'Delete subnet', 'lang_nat_edit' => 'Modify NAT',
'lang_subnet_edit' => 'Modify subnet', 'lang_nat_rules' => 'NAT Rules',
'lang_subnet_info' => 'Subnet info', 'lang_nat_type' => 'Type',
'lang_subnet_mask' => 'Subnet mask', 'lang_nat_type_1' => 'Hide',
'lang_nat_type_2' => 'Static',
'lang_nat_type_3' => 'Dynamic',
'lang_user_add' => 'Add user', 'lang_search_results_found' => 'Total results found',
'lang_user_del' => 'Delete user',
'lang_user_displayname' => 'Displayname',
'lang_user_edit' => 'Mofidy user',
'lang_user_level' => 'Userlevel',
'lang_user_name' => 'Username',
'lang_user_pass' => 'Password',
'lang_user_passnew1' => 'New password',
'lang_user_passnew2' => 'Retype new password',
'lang_user_passold' => 'Current password',
'lang_userclass_add' => 'Add userclass', 'lang_subnet_add' => 'Add subnet',
'lang_userclass_del' => 'Delete userclass', 'lang_subnet_subnetaddress' => 'Subnet address',
'lang_userclass_edit' => 'Modify userclass', 'lang_subnet_subnetaddress_mask' => 'Subnet address/Mask',
'lang_userclass_name' => 'Userclass name', 'lang_subnet_broadcastaddress' => 'Broadcast address',
'lang_subnet_nodesinsubnet' => 'Nodes in subnet',
'lang_subnet_subnetused' => 'Subnet used',
'lang_subnet_del' => 'Delete subnet',
'lang_subnet_edit' => 'Modify subnet',
'lang_subnet_info' => 'Subnet info',
'lang_subnet_mask' => 'Subnet mask',
'lang_subnet_dhcp' => 'Exclude DHCP',
'lang_subnet_dhcpstart' => 'DHCP Start',
'lang_subnet_dhcpend' => 'DHCP End',
'lang_subnet_ntp_server' => 'NTP Server',
'lang_subnet_none' => 'There are no subnets defined',
'lang_vlan_add' => 'Add VLAN', 'lang_subnetlocation' => 'Subnet/Location',
'lang_vlan_del' => 'Delete VLAN', 'lang_subnetlocation_edit' => 'Edit Subnet/Location',
'lang_vlan_edit' => 'Modify VLAN', 'lang_subnetvlan' => 'Subnet/VLAN',
'lang_vlan_number' => 'VLAN ID', 'lang_subnetvlan_edit' => 'Edit Subnet/VLAN',
'lang_vlan_info' => 'VLAN info',
'lang_vlan_name' => 'VLAN name',
'lang_comments' => 'Comments', 'lang_user_add' => 'Add user',
'lang_comments_asset_del_nodes' => 'These nodes will also be deleted!', 'lang_user_del' => 'Delete user',
'lang_comments_ipinuse' => 'IP in use', 'lang_user_displayname' => 'Displayname',
'lang_comments_notallowed' => 'Not allowed', 'lang_user_edit' => 'Mofidy user',
'lang_comments_search_nosearch' => 'Nothing to search for!', 'lang_user_name' => 'Username',
'lang_comments_usernameinuse' => 'Username in use', 'lang_user_password' => 'Password',
'lang_zone_add' => 'Add zone',
'lang_zone_del' => 'Delete zone',
'lang_zone_edit' => 'Mofidy zone',
'lang_zone_none' => 'There are no zones defined',
'lang_vlan_add' => 'Add VLAN',
'lang_vlan_del' => 'Delete VLAN',
'lang_vlan_edit' => 'Modify VLAN',
'lang_vlan_number' => 'VLAN ID',
'lang_vlan_info' => 'VLAN info',
'lang_vlan_new' => 'VLAN info',
'lang_vlan_name' => 'VLAN name',
'lang_vlan_none' => 'There are no VLANs defined',
'lang_user_language' => 'Language',
'lang_vlansubnet' => 'VLAN/Subnet',
'lang_vlansubnet_edit' => 'Edit VLAN/Subnet',
'lang_comments' => 'Comments',
'lang_comments_error' => 'Error',
'lang_comments_asset_del_nodes' => 'These nodes will also be deleted!',
'lang_comments_ipinuse' => 'IP in use',
'lang_comments_notallowed' => 'Not allowed',
'lang_comments_search_nosearch' => 'Nothing to search for!',
'lang_comments_usernameinuse' => 'Username in use',
'lang_comments_invalidpass' => 'Invalid password',
'lang_comments_invalidnewpass' => 'Invalid new password',
'lang_options_ipreg' => 'IP Reg options',
'lang_options_display' => 'Display options',
'lang_options_password' => 'Change password',
'lang_options_imagesize' => 'Imagesize',
'lang_options_imagesize_help' => 'Size (in pixels) of colored square on subnetview',
'lang_options_imagecount' => 'Imagecount',
'lang_options_imagecount_help' => 'Nr of colored squares per row on subnetview',
'lang_options_mac' => 'MAC Address',
'lang_options_mac_help' => 'Format in which a MAC address is displayed (e.g. xx-xx-xx-xx-xx-xx)',
'lang_options_menu_help' => 'Select items to be displayed in menu',
'lang_options_dateformat' => 'Date format',
'lang_options_dateformat_help' => 'Format in which dates are displayed using the php-date-format (see http://www.php.net/date for more info)',
'lang_options_dns1suffix' => 'DNS Name suffix',
'lang_options_dns1suffix_help' => 'Default DNS Name suffix when creating a new node',
'lang_options_dns2suffix' => 'DNS Alias suffix',
'lang_options_dns2suffix_help' => 'Default DNS Alias suffix when creating a new node',
'lang_options_currentpassword' => 'Current password',
'lang_options_currentpassword_help' => 'Enter your current password',
'lang_options_newpassword1' => 'New password',
'lang_options_newpassword1_help' => 'Enter your new password',
'lang_options_newpassword2' => 'Retype new password',
'lang_options_newpassword2_help' => 'Re-type your new password',
'lang_options_tooltips_help' => 'Show tooltips',
'lang_options_language_help' => 'Language for this user',
'lang_about_projectpage' => 'Current Project Page',
'lang_about_sfprojectpage' => 'Sourceforge Project Page',
'lang_about_license' => 'License',
'lang_about_gpl' => 'GNU General Public License (GPL)',
'lang_about_smarty' => 'Smarty Template Engine',
'lang_about_iconset' => 'Silk icon set 1.3',
'lang_about_ipreg_ext' => 'IP Reg, a PHP/MySQL IPAM tool',
'lang_about_license_ext' => 'Copyright (C) 2007-2009 Wietse Warendorff (up to v0.5)<br>Copyright (C) 2011-2023 Thomas Hooge<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<p> You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.',
'lang_about_changelog' => 'Changelog (major changes only)',
'lang_about_changelog_v08' => 'v0.8 (feb 2023)',
'lang_about_changelog_v08_ext' => '- Some small improvements and bugfixing<br>- Code simplification as preparation for big refactoring',
'lang_about_changelog_v07' => 'v0.7 (oct 2018)',
'lang_about_changelog_v07_ext' => '- Added support for PHP7, switched to mysqli',
'lang_about_changelog_v06' => 'v0.6 (may 2011)',
'lang_about_changelog_v06_ext' => '- Moved towards smarty template engine<br />- language support finalized<br>- added german language<br>- some small bug fixes',
'lang_about_changelog_v05' => 'v0.5 (dec 2009)',
'lang_about_changelog_v05_ext' => '- Complete code rewrite<br>- Input sanitation<br>- Background image<br>- Added multiple counters<br>- HTML is now 100% W3C valid<br>- More user options',
'lang_about_changelog_v04' => 'v0.4 (jun 2008)',
'lang_about_changelog_v04_ext' => '- SQL vulnerability fixed<br>- PHP-generated images in subnet overview',
'lang_about_changelog_v03' => 'v0.3 (dec 2007)',
'lang_about_changelog_v03_ext' => '- Class A subnet support<br>- Multi-language support<br>- User defined options<br>- All configuration options in one file (config.php)',
'lang_about_changelog_v02' => 'v0.2 (dec 2007)',
'lang_about_changelog_v02_ext' => '- Fixed ordering of IP addresses<br>- Fixed info fields',
'lang_about_changelog_v01' => 'v0.1 (dec 2007)',
'lang_about_changelog_v01_ext' => '- First beta release',
'lang_options_ipreg' => 'IP Reg options',
'lang_options_password_edit' => 'Modify password',
'lang_options_personal' => 'Personal options',
'lang_options_settings_edit' => 'Modify settings',
); );
?> ?>

31
lib.php Normal file
View File

@@ -0,0 +1,31 @@
<?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
*****************************************************************************/
// global version string
$config_version = 'v0.8';
// available languages
$config_lang = array('de', 'en');
include("lib/functions.php");
require("lib/db.class.php");
$db = new Db($dblink);
require("lib/user.class.php");
$user = new User();
require_once('smarty3/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = 'tpl';
$smarty->compile_dir = 'tpl_c';
$smarty->registerPlugin('function', 'treelist', 'print_tree');
$smarty->assign("suser_tooltips", $_SESSION['suser_tooltips']);
?>

BIN
lib/arrow.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

5
lib/changelink.js Normal file
View File

@@ -0,0 +1,5 @@
function changelink(optVal) {
if(optVal=="")
return false;
window.location='subnetview.php?subnet_id='+optVal;
}

3
lib/changetext.js Normal file
View File

@@ -0,0 +1,3 @@
function changetext(id,newtext) {
document.getElementById(id).innerHTML=newtext
}

BIN
lib/cross.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

173
lib/db.class.php Normal file
View File

@@ -0,0 +1,173 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg,
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
class Db {
protected $dblink;
public function __construct ($dblink) {
$this->dblink = $dblink;
}
function db_delete($query) {
// run query
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
}
function db_insert($query) {
// run query
echo "<pre>$query</pre>";
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
// return result
return mysqli_insert_id($this->dblink);
}
function db_select($query) {
// run query
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
// loop results
$result = array();
while($record = mysqli_fetch_assoc($sql)) {
$result[] = $record;
}
// return array
return $result;
}
function db_update($query) {
// run query
$sql = mysqli_query($this->dblink, $query) or die(mysqli_error($this->dblink));
}
function options_asset($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT asset_id, asset_name
FROM asset
ORDER BY asset_name";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['asset_id']] = $rec['asset_name'];
}
return $options;
}
function options_assetclass($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT assetclass_id, assetclass_name
FROM assetclass
ORDER BY assetclass_name";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['assetclass_id']] = $rec['assetclass_name'];
}
return $options;
}
function options_assetclassgroup($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT assetclassgroup_id, assetclassgroup_name
FROM assetclassgroup
ORDER BY assetclassgroup_name";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['assetclassgroup_id']] = $rec['assetclassgroup_name'];
}
return $options;
}
function options_location($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT location_id,
location_name
FROM location
ORDER BY location_name";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['location_id']] = $rec['location_name'];
}
return $options;
}
function options_subnet($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT subnet_id,
CONCAT_WS('/', subnet_address, subnet_mask) AS subnet_name
FROM subnet
ORDER BY INET_ATON(subnet_address)";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['subnet_id']] = $rec['subnet_name'];
}
return $options;
}
function options_vlan($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT vlan_id,
CONCAT_WS(' - ', vlan_number, vlan_name) AS vlan_option
FROM vlan
ORDER BY vlan_number";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['vlan_id']] = $rec['vlan_option'];
}
return $options;
}
function options_zone($null_value=NULL) {
$options = array();
if (isset($null_value)) {
$options[0] = $null_value;
}
$sql = "SELECT zone_id, zone_origin
FROM zone
ORDER BY zone_origin";
$records = $this->db_select($sql);
foreach ($records as $rec) {
$options[$rec['zone_id']] = $rec['zone_origin'];
}
return $options;
}
}
?>

170
lib/functions.php Normal file
View File

@@ -0,0 +1,170 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg,
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
// 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);
// capitalize (just because it looks better eh)
$mac = strtoupper($mac);
// and return
return ($mac);
}
// rebuild mac address
function write_mac($mac) {
// check string length
if (strlen($mac)!=12) {
// if the MAC is empty, or for whatever reason incorrect, just return
return $mac;
} else {
// count to 12...
for($i=0;$i<12;$i++) {
// ... and strip mac to pieces
${"mac".$i} = $mac{$i};
}
// get user preference
$user_mac = $_SESSION['suser_mac'];
// count to 12 again...
for($i=0;$i<12;$i++) {
// ... and replace user preference with pieces
$user_mac = preg_replace("/x/", ${"mac".$i}, $user_mac, 1);
}
// and return
return $user_mac;
}
}
// redirect page
function header_location($location) {
// send header
header("location: " . $location);
// exit to be sure
exit;
}
// sanitize input
function sanitize($input) {
global $dblink;
// trim whitespaces
$input = @trim($input);
// magic quotes enabled?
if(get_magic_quotes_gpc()) {
// strip slashes
$input = stripslashes($input);
}
// convert to utf-8
iconv("UTF-8", "UTF-8", $input);
// convert special chars
$input = htmlentities($input,ENT_QUOTES,'UTF-8');
// make sql ready
$input = mysqli_real_escape_string($dblink, $input);
// and return
return $input;
}
function mysql_nullstring($input) {
if (isset($input)) {
return $input;
} else {
return '';
}
}
function lang_getfrombrowser ($allowed_languages, $default_language, $lang_variable = null, $strict_mode = true) {
if ($lang_variable === null) {
$lang_variable = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
if (empty($lang_variable)) {
return $default_language;
}
$accepted_languages = preg_split('/,\s*/', $lang_variable);
$current_lang = $default_language;
$current_q = 0;
foreach ($accepted_languages as $accepted_language) {
$res = preg_match ('/^([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i',
$accepted_language, $matches);
if (!$res) {
continue;
}
$lang_code = explode ('-', $matches[1]);
if (isset($matches[2])) {
$lang_quality = (float)$matches[2];
} else {
$lang_quality = 1.0;
}
while (count ($lang_code)) {
if (in_array (strtolower (join ('-', $lang_code)), $allowed_languages)) {
if ($lang_quality > $current_q) {
$current_lang = strtolower (join ('-', $lang_code));
$current_q = $lang_quality;
break;
}
}
if ($strict_mode) {
break;
}
array_pop ($lang_code);
}
}
return $current_lang;
}
function print_tree_rec($tree, $level) {
$output = '<ul class="treelvl' . $level. '">' . "\n";
foreach ($tree as $node) {
$output .= '<li><a href="' . $node['href'] . '">' . $node['value'] . '</a>';
if ($node['children']) {
$output .= "\n" . print_tree_rec($node['children'], $level+1);
}
$output .= "</li>\n";
}
$output .= "</ul>\n";
return $output;
}
function print_tree ($params, &$smarty) {
if (empty($params['level'])) {
$level = 0;
} else {
$level = $params['level'];
}
if (empty($params['tree'])) {
return '';
} else {
return print_tree_rec($params['tree'], $level);
}
}
?>

BIN
lib/hs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
lib/hv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

840
lib/jscolor.js Normal file
View File

@@ -0,0 +1,840 @@
/**
* jscolor, JavaScript Color Picker
*
* @version 1.3.1
* @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
* @author Jan Odvarko, http://odvarko.cz
* @created 2008-06-15
* @updated 2010-01-23
* @link http://jscolor.com
*/
var jscolor = {
dir : '', // location of jscolor directory (leave empty to autodetect)
bindClass : 'color', // class name
binding : true, // automatic binding via <input class="...">
preloading : true, // use image preloading?
install : function() {
jscolor.addEvent(window, 'load', jscolor.init);
},
init : function() {
if(jscolor.binding) {
jscolor.bind();
}
if(jscolor.preloading) {
jscolor.preload();
}
},
getDir : function() {
if(!jscolor.dir) {
var detected = jscolor.detectDir();
jscolor.dir = detected!==false ? detected : 'jscolor/';
}
return jscolor.dir;
},
detectDir : function() {
var base = location.href;
var e = document.getElementsByTagName('base');
for(var i=0; i<e.length; i+=1) {
if(e[i].href) { base = e[i].href; }
}
var e = document.getElementsByTagName('script');
for(var i=0; i<e.length; i+=1) {
if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
var src = new jscolor.URI(e[i].src);
var srcAbs = src.toAbsolute(base);
srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
srcAbs.query = null;
srcAbs.fragment = null;
return srcAbs.toString();
}
}
return false;
},
bind : function() {
var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
var e = document.getElementsByTagName('input');
for(var i=0; i<e.length; i+=1) {
var m;
if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
var prop = {};
if(m[3]) {
try {
eval('prop='+m[3]);
} catch(eInvalidProp) {}
}
e[i].color = new jscolor.color(e[i], prop);
}
}
},
preload : function() {
for(var fn in jscolor.imgRequire) {
if(jscolor.imgRequire.hasOwnProperty(fn)) {
jscolor.loadImage(fn);
}
}
},
images : {
pad : [ 181, 101 ],
sld : [ 16, 101 ],
cross : [ 15, 15 ],
arrow : [ 7, 11 ]
},
imgRequire : {},
imgLoaded : {},
requireImage : function(filename) {
jscolor.imgRequire[filename] = true;
},
loadImage : function(filename) {
if(!jscolor.imgLoaded[filename]) {
jscolor.imgLoaded[filename] = new Image();
jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
}
},
fetchElement : function(mixed) {
return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
},
addEvent : function(el, evnt, func) {
if(el.addEventListener) {
el.addEventListener(evnt, func, false);
} else if(el.attachEvent) {
el.attachEvent('on'+evnt, func);
}
},
fireEvent : function(el, evnt) {
if(!el) {
return;
}
if(document.createEventObject) {
var ev = document.createEventObject();
el.fireEvent('on'+evnt, ev);
} else if(document.createEvent) {
var ev = document.createEvent('HTMLEvents');
ev.initEvent(evnt, true, true);
el.dispatchEvent(ev);
} else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
el['on'+evnt]();
}
},
getElementPos : function(e) {
var e1=e, e2=e;
var x=0, y=0;
if(e1.offsetParent) {
do {
x += e1.offsetLeft;
y += e1.offsetTop;
} while(e1 = e1.offsetParent);
}
while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
x -= e2.scrollLeft;
y -= e2.scrollTop;
}
return [x, y];
},
getElementSize : function(e) {
return [e.offsetWidth, e.offsetHeight];
},
getMousePos : function(e) {
if(!e) { e = window.event; }
if(typeof e.pageX === 'number') {
return [e.pageX, e.pageY];
} else if(typeof e.clientX === 'number') {
return [
e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
e.clientY + document.body.scrollTop + document.documentElement.scrollTop
];
}
},
getViewPos : function() {
if(typeof window.pageYOffset === 'number') {
return [window.pageXOffset, window.pageYOffset];
} else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
return [document.body.scrollLeft, document.body.scrollTop];
} else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
} else {
return [0, 0];
}
},
getViewSize : function() {
if(typeof window.innerWidth === 'number') {
return [window.innerWidth, window.innerHeight];
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
return [document.body.clientWidth, document.body.clientHeight];
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
return [document.documentElement.clientWidth, document.documentElement.clientHeight];
} else {
return [0, 0];
}
},
URI : function(uri) { // See RFC3986
this.scheme = null;
this.authority = null;
this.path = '';
this.query = null;
this.fragment = null;
this.parse = function(uri) {
var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
this.scheme = m[3] ? m[2] : null;
this.authority = m[5] ? m[6] : null;
this.path = m[7];
this.query = m[9] ? m[10] : null;
this.fragment = m[12] ? m[13] : null;
return this;
};
this.toString = function() {
var result = '';
if(this.scheme !== null) { result = result + this.scheme + ':'; }
if(this.authority !== null) { result = result + '//' + this.authority; }
if(this.path !== null) { result = result + this.path; }
if(this.query !== null) { result = result + '?' + this.query; }
if(this.fragment !== null) { result = result + '#' + this.fragment; }
return result;
};
this.toAbsolute = function(base) {
var base = new jscolor.URI(base);
var r = this;
var t = new jscolor.URI;
if(base.scheme === null) { return false; }
if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
r.scheme = null;
}
if(r.scheme !== null) {
t.scheme = r.scheme;
t.authority = r.authority;
t.path = removeDotSegments(r.path);
t.query = r.query;
} else {
if(r.authority !== null) {
t.authority = r.authority;
t.path = removeDotSegments(r.path);
t.query = r.query;
} else {
if(r.path === '') { // TODO: == or === ?
t.path = base.path;
if(r.query !== null) {
t.query = r.query;
} else {
t.query = base.query;
}
} else {
if(r.path.substr(0,1) === '/') {
t.path = removeDotSegments(r.path);
} else {
if(base.authority !== null && base.path === '') { // TODO: == or === ?
t.path = '/'+r.path;
} else {
t.path = base.path.replace(/[^\/]+$/,'')+r.path;
}
t.path = removeDotSegments(t.path);
}
t.query = r.query;
}
t.authority = base.authority;
}
t.scheme = base.scheme;
}
t.fragment = r.fragment;
return t;
};
function removeDotSegments(path) {
var out = '';
while(path) {
if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
path = path.replace(/^\.+/,'').substr(1);
} else if(path.substr(0,3)==='/./' || path==='/.') {
path = '/'+path.substr(3);
} else if(path.substr(0,4)==='/../' || path==='/..') {
path = '/'+path.substr(4);
out = out.replace(/\/?[^\/]*$/, '');
} else if(path==='.' || path==='..') {
path = '';
} else {
var rm = path.match(/^\/?[^\/]*/)[0];
path = path.substr(rm.length);
out = out + rm;
}
}
return out;
}
if(uri) {
this.parse(uri);
}
},
/*
* Usage example:
* var myColor = new jscolor.color(myInputElement)
*/
color : function(target, prop) {
this.required = true; // refuse empty values?
this.adjust = true; // adjust value to uniform notation?
this.hash = false; // prefix color with # symbol?
this.caps = true; // uppercase?
this.valueElement = target; // value holder
this.styleElement = target; // where to reflect current color
this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
this.pickerOnfocus = true; // display picker on focus?
this.pickerMode = 'HSV'; // HSV | HVS
this.pickerPosition = 'bottom'; // left | right | top | bottom
this.pickerFace = 10; // px
this.pickerFaceColor = 'ThreeDFace'; // CSS color
this.pickerBorder = 1; // px
this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
this.pickerInset = 1; // px
this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
this.pickerZIndex = 10000;
for(var p in prop) {
if(prop.hasOwnProperty(p)) {
this[p] = prop[p];
}
}
this.hidePicker = function() {
if(isPickerOwner()) {
removePicker();
}
};
this.showPicker = function() {
if(!isPickerOwner()) {
var tp = jscolor.getElementPos(target); // target pos
var ts = jscolor.getElementSize(target); // target size
var vp = jscolor.getViewPos(); // view pos
var vs = jscolor.getViewSize(); // view size
var ps = [ // picker size
2*this.pickerBorder + 4*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0],
2*this.pickerBorder + 2*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[1]
];
var a, b, c;
switch(this.pickerPosition.toLowerCase()) {
case 'left': a=1; b=0; c=-1; break;
case 'right':a=1; b=0; c=1; break;
case 'top': a=0; b=1; c=-1; break;
default: a=0; b=1; c=1; break;
}
var l = (ts[b]+ps[b])/2;
var pp = [ // picker pos
-vp[a]+tp[a]+ps[a] > vs[a] ?
(-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
tp[a],
-vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
(-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
(tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
];
drawPicker(pp[a], pp[b]);
}
};
this.importColor = function() {
if(!valueElement) {
this.exportColor();
} else {
if(!this.adjust) {
if(!this.fromString(valueElement.value, leaveValue)) {
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
styleElement.style.color = styleElement.jscStyle.color;
this.exportColor(leaveValue | leaveStyle);
}
} else if(!this.required && /^\s*$/.test(valueElement.value)) {
valueElement.value = '';
styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
styleElement.style.color = styleElement.jscStyle.color;
this.exportColor(leaveValue | leaveStyle);
} else if(this.fromString(valueElement.value)) {
// OK
} else {
this.exportColor();
}
}
};
this.exportColor = function(flags) {
if(!(flags & leaveValue) && valueElement) {
var value = this.toString();
if(this.caps) { value = value.toUpperCase(); }
if(this.hash) { value = '#'+value; }
valueElement.value = value;
}
if(!(flags & leaveStyle) && styleElement) {
styleElement.style.backgroundColor =
'#'+this.toString();
styleElement.style.color =
0.213 * this.rgb[0] +
0.715 * this.rgb[1] +
0.072 * this.rgb[2]
< 0.5 ? '#FFF' : '#000';
}
if(!(flags & leavePad) && isPickerOwner()) {
redrawPad();
}
if(!(flags & leaveSld) && isPickerOwner()) {
redrawSld();
}
};
this.fromHSV = function(h, s, v, flags) { // null = don't change
h<0 && (h=0) || h>6 && (h=6);
s<0 && (s=0) || s>1 && (s=1);
v<0 && (v=0) || v>1 && (v=1);
this.rgb = HSV_RGB(
h===null ? this.hsv[0] : (this.hsv[0]=h),
s===null ? this.hsv[1] : (this.hsv[1]=s),
v===null ? this.hsv[2] : (this.hsv[2]=v)
);
this.exportColor(flags);
};
this.fromRGB = function(r, g, b, flags) { // null = don't change
r<0 && (r=0) || r>1 && (r=1);
g<0 && (g=0) || g>1 && (g=1);
b<0 && (b=0) || b>1 && (b=1);
var hsv = RGB_HSV(
r===null ? this.rgb[0] : (this.rgb[0]=r),
g===null ? this.rgb[1] : (this.rgb[1]=g),
b===null ? this.rgb[2] : (this.rgb[2]=b)
);
if(hsv[0] !== null) {
this.hsv[0] = hsv[0];
}
if(hsv[2] !== 0) {
this.hsv[1] = hsv[1];
}
this.hsv[2] = hsv[2];
this.exportColor(flags);
};
this.fromString = function(hex, flags) {
var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
if(!m) {
return false;
} else {
if(m[1].length === 6) { // 6-char notation
this.fromRGB(
parseInt(m[1].substr(0,2),16) / 255,
parseInt(m[1].substr(2,2),16) / 255,
parseInt(m[1].substr(4,2),16) / 255,
flags
);
} else { // 3-char notation
this.fromRGB(
parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
flags
);
}
return true;
}
};
this.toString = function() {
return (
(0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
(0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
(0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
);
};
function RGB_HSV(r, g, b) {
var n = Math.min(Math.min(r,g),b);
var v = Math.max(Math.max(r,g),b);
var m = v - n;
if(m === 0) { return [ null, 0, v ]; }
var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
return [ h===6?0:h, m/v, v ];
}
function HSV_RGB(h, s, v) {
if(h === null) { return [ v, v, v ]; }
var i = Math.floor(h);
var f = i%2 ? h-i : 1-(h-i);
var m = v * (1 - s);
var n = v * (1 - s*f);
switch(i) {
case 6:
case 0: return [v,n,m];
case 1: return [n,v,m];
case 2: return [m,v,n];
case 3: return [m,n,v];
case 4: return [n,m,v];
case 5: return [v,m,n];
}
}
function removePicker() {
delete jscolor.picker.owner;
document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
}
function drawPicker(x, y) {
if(!jscolor.picker) {
jscolor.picker = {
box : document.createElement('div'),
boxB : document.createElement('div'),
pad : document.createElement('div'),
padB : document.createElement('div'),
padM : document.createElement('div'),
sld : document.createElement('div'),
sldB : document.createElement('div'),
sldM : document.createElement('div')
};
for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
var seg = document.createElement('div');
seg.style.height = segSize+'px';
seg.style.fontSize = '1px';
seg.style.lineHeight = '0';
jscolor.picker.sld.appendChild(seg);
}
jscolor.picker.sldB.appendChild(jscolor.picker.sld);
jscolor.picker.box.appendChild(jscolor.picker.sldB);
jscolor.picker.box.appendChild(jscolor.picker.sldM);
jscolor.picker.padB.appendChild(jscolor.picker.pad);
jscolor.picker.box.appendChild(jscolor.picker.padB);
jscolor.picker.box.appendChild(jscolor.picker.padM);
jscolor.picker.boxB.appendChild(jscolor.picker.box);
}
var p = jscolor.picker;
// recompute controls positions
posPad = [
x+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset,
y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
posSld = [
null,
y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
// controls interaction
p.box.onmouseup =
p.box.onmouseout = function() { target.focus(); };
p.box.onmousedown = function() { abortBlur=true; };
p.box.onmousemove = function(e) { holdPad && setPad(e); holdSld && setSld(e); };
p.padM.onmouseup =
p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
p.padM.onmousedown = function(e) { holdPad=true; setPad(e); };
p.sldM.onmouseup =
p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
p.sldM.onmousedown = function(e) { holdSld=true; setSld(e); };
// picker
p.box.style.width = 4*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] + 'px';
p.box.style.height = 2*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[1] + 'px';
// picker border
p.boxB.style.position = 'absolute';
p.boxB.style.clear = 'both';
p.boxB.style.left = x+'px';
p.boxB.style.top = y+'px';
p.boxB.style.zIndex = THIS.pickerZIndex;
p.boxB.style.border = THIS.pickerBorder+'px solid';
p.boxB.style.borderColor = THIS.pickerBorderColor;
p.boxB.style.background = THIS.pickerFaceColor;
// pad image
p.pad.style.width = jscolor.images.pad[0]+'px';
p.pad.style.height = jscolor.images.pad[1]+'px';
// pad border
p.padB.style.position = 'absolute';
p.padB.style.left = THIS.pickerFace+'px';
p.padB.style.top = THIS.pickerFace+'px';
p.padB.style.border = THIS.pickerInset+'px solid';
p.padB.style.borderColor = THIS.pickerInsetColor;
// pad mouse area
p.padM.style.position = 'absolute';
p.padM.style.left = '0';
p.padM.style.top = '0';
p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
p.padM.style.height = p.box.style.height;
p.padM.style.cursor = 'crosshair';
// slider image
p.sld.style.overflow = 'hidden';
p.sld.style.width = jscolor.images.sld[0]+'px';
p.sld.style.height = jscolor.images.sld[1]+'px';
// slider border
p.sldB.style.position = 'absolute';
p.sldB.style.right = THIS.pickerFace+'px';
p.sldB.style.top = THIS.pickerFace+'px';
p.sldB.style.border = THIS.pickerInset+'px solid';
p.sldB.style.borderColor = THIS.pickerInsetColor;
// slider mouse area
p.sldM.style.position = 'absolute';
p.sldM.style.right = '0';
p.sldM.style.top = '0';
p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
p.sldM.style.height = p.box.style.height;
try {
p.sldM.style.cursor = 'pointer';
} catch(eOldIE) {
p.sldM.style.cursor = 'hand';
}
// load images in optimal order
switch(modeID) {
case 0: var padImg = 'hs.png'; break;
case 1: var padImg = 'hv.png'; break;
}
p.padM.style.background = "url('"+jscolor.getDir()+"cross.gif') no-repeat";
p.sldM.style.background = "url('"+jscolor.getDir()+"arrow.gif') no-repeat";
p.pad.style.background = "url('"+jscolor.getDir()+padImg+"') 0 0 no-repeat";
// place pointers
redrawPad();
redrawSld();
jscolor.picker.owner = THIS;
document.getElementsByTagName('body')[0].appendChild(p.boxB);
}
function redrawPad() {
// redraw the pad pointer
switch(modeID) {
case 0: var yComponent = 1; break;
case 1: var yComponent = 2; break;
}
var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
jscolor.picker.padM.style.backgroundPosition =
(THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
(THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
// redraw the slider image
var seg = jscolor.picker.sld.childNodes;
switch(modeID) {
case 0:
var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
for(var i=0; i<seg.length; i+=1) {
seg[i].style.backgroundColor = 'rgb('+
(rgb[0]*(1-i/seg.length)*100)+'%,'+
(rgb[1]*(1-i/seg.length)*100)+'%,'+
(rgb[2]*(1-i/seg.length)*100)+'%)';
}
break;
case 1:
var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
var i = Math.floor(THIS.hsv[0]);
var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
switch(i) {
case 6:
case 0: rgb=[0,1,2]; break;
case 1: rgb=[1,0,2]; break;
case 2: rgb=[2,0,1]; break;
case 3: rgb=[2,1,0]; break;
case 4: rgb=[1,2,0]; break;
case 5: rgb=[0,2,1]; break;
}
for(var i=0; i<seg.length; i+=1) {
s = 1 - 1/(seg.length-1)*i;
c[1] = c[0] * (1 - s*f);
c[2] = c[0] * (1 - s);
seg[i].style.backgroundColor = 'rgb('+
(c[rgb[0]]*100)+'%,'+
(c[rgb[1]]*100)+'%,'+
(c[rgb[2]]*100)+'%)';
}
break;
}
}
function redrawSld() {
// redraw the slider pointer
switch(modeID) {
case 0: var yComponent = 2; break;
case 1: var yComponent = 1; break;
}
var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
jscolor.picker.sldM.style.backgroundPosition =
'0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
}
function isPickerOwner() {
return jscolor.picker && jscolor.picker.owner === THIS;
}
function blurTarget() {
if(valueElement === target) {
THIS.importColor();
}
if(THIS.pickerOnfocus) {
THIS.hidePicker();
}
}
function blurValue() {
if(valueElement !== target) {
THIS.importColor();
}
}
function setPad(e) {
var posM = jscolor.getMousePos(e);
var x = posM[0]-posPad[0];
var y = posM[1]-posPad[1];
switch(modeID) {
case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
}
}
function setSld(e) {
var posM = jscolor.getMousePos(e);
var y = posM[1]-posPad[1];
switch(modeID) {
case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
}
}
var THIS = this;
var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
var abortBlur = false;
var
valueElement = jscolor.fetchElement(this.valueElement),
styleElement = jscolor.fetchElement(this.styleElement);
var
holdPad = false,
holdSld = false;
var
posPad,
posSld;
var
leaveValue = 1<<0,
leaveStyle = 1<<1,
leavePad = 1<<2,
leaveSld = 1<<3;
// target
jscolor.addEvent(target, 'focus', function() {
if(THIS.pickerOnfocus) { THIS.showPicker(); }
});
jscolor.addEvent(target, 'blur', function() {
if(!abortBlur) {
window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
} else {
abortBlur = false;
}
});
// valueElement
if(valueElement) {
var updateField = function() {
THIS.fromString(valueElement.value, leaveValue);
};
jscolor.addEvent(valueElement, 'keyup', updateField);
jscolor.addEvent(valueElement, 'input', updateField);
jscolor.addEvent(valueElement, 'blur', blurValue);
valueElement.setAttribute('autocomplete', 'off');
}
// styleElement
if(styleElement) {
styleElement.jscStyle = {
backgroundColor : styleElement.style.backgroundColor,
color : styleElement.style.color
};
}
// require images
switch(modeID) {
case 0: jscolor.requireImage('hs.png'); break;
case 1: jscolor.requireImage('hv.png'); break;
}
jscolor.requireImage('cross.gif');
jscolor.requireImage('arrow.gif');
this.importColor();
}
};
jscolor.install();

122
lib/user.class.php Normal file
View File

@@ -0,0 +1,122 @@
<?php
/*****************************************************************************
IP Reg, a PHP/MySQL IPAM tool
Copyright (C) 2007-2009 Wietse Warendorff
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg,
or contact me at wietsew@users.sourceforge.net
*****************************************************************************/
class User {
function check_strlen($string) {
// check length
if(strlen($string)<1) {
return FALSE;
} else {
return TRUE;
}
}
function user_login($user_name, $user_pass) {
global $dblink;
// check user_name length
if($this->check_strlen($user_name)==FALSE) {
return FALSE;
}
// check user_pass length
if($this->check_strlen($user_pass)==FALSE) {
return FALSE;
}
// get user data
// initiate class
$db = new Db($dblink);
// build query
$query = "SELECT
user.user_id,
user.user_pass,
user.user_displayname,
user.user_language,
user.user_imagesize,
user.user_imagecount,
user.user_mac,
user.user_dateformat,
user.user_dns1suffix,
user.user_dns2suffix,
user.user_menu_assets,
user.user_menu_assetclasses,
user.user_menu_assetclassgroups,
user.user_menu_locations,
user.user_menu_nodes,
user.user_menu_subnets,
user.user_menu_users,
user.user_menu_vlans,
user.user_menu_zones,
user.user_tooltips
FROM
user
WHERE
user.user_name='" . $user_name . "'";
// run query
$users = $db->db_select($query);
// count results
$user_counter = count($users);
// any users?
if ($user_counter>0) {
// compare passwords
if(!strcmp(md5($user_pass), $users[0]['user_pass'])) {
// all ok: user is logged in, register session data
$_SESSION['suser_id'] = $users[0]['user_id'];
$_SESSION['suser_displayname'] = $users[0]['user_displayname'];
$_SESSION['suser_language'] = $users[0]['user_language'];
$_SESSION['suser_imagesize'] = $users[0]['user_imagesize'];
$_SESSION['suser_imagecount'] = $users[0]['user_imagecount'];
$_SESSION['suser_mac'] = $users[0]['user_mac'];
$_SESSION['suser_dateformat'] = $users[0]['user_dateformat'];
$_SESSION['suser_dns1suffix'] = $users[0]['user_dns1suffix'];
$_SESSION['suser_dns2suffix'] = $users[0]['user_dns2suffix'];
$_SESSION['suser_menu_assets'] = $users[0]['user_menu_assets'];
$_SESSION['suser_menu_assetclasses'] = $users[0]['user_menu_assetclasses'];
$_SESSION['suser_menu_assetclassgroups'] = $users[0]['user_menu_assetclassgroups'];
$_SESSION['suser_menu_locations'] = $users[0]['user_menu_locations'];
$_SESSION['suser_menu_nodes'] = $users[0]['user_menu_nodes'];
$_SESSION['suser_menu_subnets'] = $users[0]['user_menu_subnets'];
$_SESSION['suser_menu_users'] = $users[0]['user_menu_users'];
$_SESSION['suser_menu_vlans'] = $users[0]['user_menu_vlans'];
$_SESSION['suser_menu_zones'] = $users[0]['user_menu_zones'];
$_SESSION['suser_tooltips'] = $users[0]['user_tooltips'];
} else {
return FALSE;
}
} else {
return FALSE;
}
// no errors found, return
return TRUE;
}
function user_logout() {
// clear and destroy session
$_SESSION = array();
}
}
?>

View File

@@ -1,97 +1,46 @@
<?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, include("includes.php");
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 include("header.php");
along with this program. If not, see <http://www.gnu.org/licenses/>.
For more information, visit http://sourceforge.net/projects/ipreg, $query = "SELECT
or contact me at wietsew@users.sourceforge.net location_id AS id,
*****************************************************************************/ location_name AS value,
location_parent AS parent_id
FROM
location
ORDER BY location_parent, location_sort, location_name";
// includes $locations = $db->db_select($query);
include("includes.php");
// check authorisation // function for recursion
$auth = auth("location", $config_auth_locationview, 0); function build_tree($parent_id, $level) {
global $locations;
$children = array();
foreach ($locations as $key => $location) {
if ($location['parent_id'] == $parent_id) {
unset($location['parent_id']);
$location['children'] = build_tree($location['id'], $level+1);
$location['level'] = $level;
$location['href'] = 'locationview.php?location_id=' . $location['id'];
$children[] = $location;
}
}
return $children;
}
// start output $tree = build_tree(0, 0);
include("header.php"); $smarty->assign("locations", $tree);
// set template $smarty->display("location.tpl");
$tp = new Template("tpl/location.tpl");
// set language variables include("footer.php");
$tp->setvars($lang);
// create array with parent index and location names
$parents = array();
$location_names = array();
// get location information and insert to the arrays
$result = mysql_query("SELECT location_id, location_name, parent FROM location") or die(mysql_error());
while ($row = mysql_fetch_object($result)) {
$location_names[$row->location_id] = $row->location_name;
$parents[$row->parent][] = $row->location_id;
}
// look for parents and create a new array for every child
function location($parents, $parent = 0) {
$children = array();
foreach ($parents[$parent] as $child) {
if (isset($parents[$child])) {
// element has children
$children[$child] = location($parents, $child);
} else {
// no children, set NULL
$children[$child] = NULL;
}
}
return $children;
}
// recursive children check to template
function checkchildren ($array, $level) {
global $tp;
global $location_names;
foreach ($array as $location_id=>$val) {
if($val != "") {
$tp->set("location_id", $location_id);
$tp->set("location_name", $location_names[$location_id]);
$tp->set("nbsp", str_repeat("-&nbsp;&nbsp;",$level));
$tp->parse("locationrow");
checkchildren($val, $level+1);
} else {
$tp->set("location_id", $location_id);
$tp->set("location_name", $location_names[$location_id]);
$tp->set("nbsp", str_repeat("-&nbsp;&nbsp;",$level));
$tp->parse("locationrow");
}
}
$tp->parse("location");
$tp->clear("location");
}
// assemble the tree
$tree = location($parents);
// check for values and build template
checkchildren($tree, 0);
// output
$tp->parse();
$tp->spit();
include("footer.php");
?> ?>

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