diff --git a/asset.php b/asset.php
index 7a688cb..a76ceb6 100644
--- a/asset.php
+++ b/asset.php
@@ -1,23 +1,24 @@
-
-
-
+ // set template
+ $tp = new Template("tpl/asset.tpl");
+
+ // set language variables
+ $tp->setvars($lang);
+
+ // 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++) {
+ $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");
?>
\ No newline at end of file
diff --git a/assetadd.php b/assetadd.php
index 4020431..b513161 100644
--- a/assetadd.php
+++ b/assetadd.php
@@ -1,80 +1,24 @@
= 2) {
+ // set template
+ $tp = new Template("tpl/assetadd.tpl");
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $asset_name = $_POST['asset_name'];
- $hostname = $_POST['hostname'];
- $assetclass_id = $_POST['assetclass_id'];
- $asset_info = $_POST['asset_info'];
- mysql_query("INSERT INTO asset (asset_name, hostname, assetclass_id, asset_info) VALUE ('$asset_name', '$hostname', '$assetclass_id', '$asset_info')") or die(mysql_error());
- $asset_id = mysql_insert_id();
-
- header_location("assetview.php?asset_id=" . $asset_id);
- }
-?>
+ // set language variables
+ $tp->setvars($lang);
-
-
-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");
?>
\ No newline at end of file
diff --git a/assetclass.php b/assetclass.php
index 1ebdd87..c563576 100644
--- a/assetclass.php
+++ b/assetclass.php
@@ -1,23 +1,24 @@
-
-
-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");
?>
\ No newline at end of file
diff --git a/assetclassadd.php b/assetclassadd.php
index 636bf35..05dd0ad 100644
--- a/assetclassadd.php
+++ b/assetclassadd.php
@@ -1,63 +1,24 @@
= 2) {
+ // set template
+ $tp = new Template("tpl/assetclassadd.tpl");
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $assetclass_name = $_POST['assetclass_name'];
- $assetclassgroup_id = $_POST['assetclassgroup_id'];
- mysql_query("INSERT INTO assetclass (assetclass_name, assetclassgroup_id) VALUE ('$assetclass_name', '$assetclassgroup_id')") or die(mysql_error());
- $assetclass_id = mysql_insert_id();
-
- header_location("assetclassview.php?assetclass_id=" . $assetclass_id);
- }
-?>
+ // set language variables
+ $tp->setvars($lang);
-
-
-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");
?>
\ No newline at end of file
diff --git a/assetclassdel.php b/assetclassdel.php
new file mode 100644
index 0000000..78fb7c4
--- /dev/null
+++ b/assetclassdel.php
@@ -0,0 +1,24 @@
+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");
+?>
\ No newline at end of file
diff --git a/assetclassedit.php b/assetclassedit.php
index 90063d4..c52165f 100644
--- a/assetclassedit.php
+++ b/assetclassedit.php
@@ -1,78 +1,36 @@
= 2) {
+ // get id
+ $assetclass_id = $_GET['assetclass_id'];
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $assetclass_id = $_POST['assetclass_id'];
- $assetclass_name = $_POST['assetclass_name'];
- $assetclassgroup_id = $_POST['assetclassgroup_id'];
- mysql_query("UPDATE assetclass SET assetclass_name='$assetclass_name', assetclassgroup_id='$assetclassgroup_id' WHERE assetclass_id='$assetclass_id'") or die(mysql_error());
-
- header_location("assetclassview.php?assetclass_id=" . $assetclass_id);
- }
+ // set template
+ $tp = new Template("tpl/assetclassedit.tpl");
- $assetclass_id = $_GET['assetclass_id'];
+ // 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 current information
- $result = mysql_query("SELECT assetclass_name, assetclassgroup_id FROM assetclass WHERE assetclass_id='$assetclass_id'");
- while ($row = mysql_fetch_object($result)) {
- $assetclass_name = $row->assetclass_name;
- $assetclassgroup_id = $row->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"));
-
-
-parse();
+ $tp->spit();
include("footer.php");
?>
\ No newline at end of file
diff --git a/assetclassgroupview.php b/assetclassgroupview.php
index 31abeb9..d31c6bc 100644
--- a/assetclassgroupview.php
+++ b/assetclassgroupview.php
@@ -3,49 +3,44 @@
// get id
$assetclassgroup_id = $_GET['assetclassgroup_id'];
-
+
+ // set template
+ $tp = new Template("tpl/assetclassgroupview.tpl");
+
+ // set language variables
+ $tp->setvars($lang);
+
// get assetclassgroup info
- $result = mysql_query("SELECT assetclassgroup_name, color FROM assetclassgroup WHERE assetclassgroup_id='$assetclassgroup_id'");
- while ($row = mysql_fetch_object($result)) {
- $assetclassgroup_name = $row->assetclassgroup_name;
- $color = $row->color;
+ $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_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");
}
-?>
-
-
-
-
- Assetclass Groupname:
- |
-
-
- |
-
-
-
- Color:
- |
-
-
- |
-
-
-
- Assetclass(es):
- |
-
-
-assetclass_id . '">' . $row->assetclass_name . ' ';
- }
-?>
-
- |
-
-
-
-0) ? $tp->parse("assetclass") : $tp->hide("assetclass"));
+
+ // display options
+ if($_SESSION['suser_level'] >= $config_userlevel_assetclassgroupedit) {
+ $tp->set("assetclassgroup_id", $assetclassgroup_id);
+ $tp->parse("assetclassgroupedit");
+ } else {
+ $tp->hide("assetclassgroupedit");
+ }
+ if($_SESSION['suser_level'] >= $config_userlevel_assetclassgroupdel) {
+ $tp->set("assetclassgroup_id", $assetclassgroup_id);
+ $tp->parse("assetclassgroupdel");
+ } else {
+ $tp->hide("assetclassgroupdel");
+ }
+
+ // output
+ $tp->parse();
+ $tp->spit();
+
include("footer.php");
?>
\ No newline at end of file
diff --git a/assetclassview.php b/assetclassview.php
index 22c290c..1491fe6 100644
--- a/assetclassview.php
+++ b/assetclassview.php
@@ -3,68 +3,46 @@
// get id
$assetclass_id = $_GET['assetclass_id'];
-
+
+ // set template
+ $tp = new Template("tpl/assetclassview.tpl");
+
+ // set language variables
+ $tp->setvars($lang);
+
// get assetclassgroup info
- $result = mysql_query("SELECT ac.assetclassgroup_id, ac.assetclass_name, acg.assetclassgroup_name FROM assetclass ac, assetclassgroup acg WHERE ac.assetclass_id='$assetclass_id' AND acg.assetclassgroup_id=ac.assetclassgroup_id");
- while ($row = mysql_fetch_object($result)) {
- $assetclass_name = $row->assetclass_name;
- $assetclassgroup_id = $row->assetclassgroup_id;
- $assetclassgroup_name = $row->assetclassgroup_name;
+ $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_name", $row->assetclass_name);
+ $tp->set("assetclassgroup_id", $row->assetclassgroup_id);
+ $tp->set("assetclassgroup_name", $row->assetclassgroup_name);
+
+ // get assets for this assetclassgroup
+ $result = mysql_query("SELECT asset_id, asset_name FROM asset WHERE assetclass_id='$assetclass_id' ORDER BY asset_name") or die(mysql_error());
+ for ($i=0;$row=mysql_fetch_object($result);$i++) {
+ $tp->set("asset_id", $row->asset_id);
+ $tp->set("asset_name", $row->asset_name);
+ $tp->parse("assetrow");
}
-?>
-
-
-
-
- Assetclass Name:
- |
-
-
- |
-
-
-
- Assetclass Groupname:
- |
-
-
- |
-
-
-
- Asset(s):
- |
-
-
-asset_id . '">' . $row->asset_name . ' ';
- }
-?>
-
- |
-
-
+ if (($i>0) ? $tp->parse("asset") : $tp->hide("asset"));
-
-
-= 2) {
-?>
-
-
-
-= $config_userlevel_assetclassedit) {
+ $tp->set("assetclass_id", $assetclass_id);
+ $tp->parse("assetclassedit");
+ } else {
+ $tp->hide("assetclassedit");
}
+ if($_SESSION['suser_level'] >= $config_userlevel_assetclassdel) {
+ $tp->set("assetclass_id", $assetclass_id);
+ $tp->parse("assetclassdel");
+ } else {
+ $tp->hide("assetclassdel");
+ }
+
+ // output
+ $tp->parse();
+ $tp->spit();
include("footer.php");
?>
\ No newline at end of file
diff --git a/assetdel.php b/assetdel.php
index a6dfec0..b636b28 100644
--- a/assetdel.php
+++ b/assetdel.php
@@ -1,17 +1,33 @@
= 2) {
-
+ // get id
$asset_id = $_GET['asset_id'];
- mysql_query("DELETE FROM asset WHERE asset_id='$asset_id'") or die(mysql_error());
- mysql_query("DELETE FROM node WHERE asset_id='$asset_id'") or die(mysql_error());
- header("Location: asset.php");
+ // set template
+ $tp = new Template("tpl/assetdel.tpl");
+
+ // set language variables
+ $tp->setvars($lang);
+
+ // get asset info
+ $result = mysql_query("SELECT asset_name FROM asset WHERE asset_id='$asset_id'") or die(mysql_error());
+ $row=mysql_fetch_object($result);
+ $tp->set("asset_id", $asset_id);
+ $tp->set("asset_name", $row->asset_name);
- // end display only if admin
+ // 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");
?>
\ No newline at end of file
diff --git a/assetedit.php b/assetedit.php
index e796a64..0b952f3 100644
--- a/assetedit.php
+++ b/assetedit.php
@@ -1,96 +1,37 @@
= 2) {
-
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $asset_id = $_POST['asset_id'];
- $asset_name = $_POST['asset_name'];
- $hostname = $_POST['hostname'];
- $assetclass_id = $_POST['assetclass_id'];
- $asset_info = $_POST['asset_info'];
- mysql_query("UPDATE asset SET asset_name='$asset_name', hostname='$hostname', assetclass_id='$assetclass_id', asset_info='$asset_info' WHERE asset_id='$asset_id'") or die(mysql_error());
-
- header_location("assetview.php?asset_id=" . $asset_id);
- }
-
+ // get id
$asset_id = $_GET['asset_id'];
- // get current information
- $result = mysql_query("SELECT asset_name, hostname, assetclass_id, asset_info FROM asset WHERE asset_id='$asset_id'");
- while ($row = mysql_fetch_object($result)) {
- $asset_name = $row->asset_name;
- $hostname = $row->hostname;
- $assetclass_id = $row->assetclass_id;
- $asset_info = $row->asset_info;
- }
-?>
+ // set template
+ $tp = new Template("tpl/assetedit.tpl");
-
-
-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");
?>
\ No newline at end of file
diff --git a/assetview.php b/assetview.php
index f1c1533..3febf71 100644
--- a/assetview.php
+++ b/assetview.php
@@ -3,156 +3,56 @@
// get id
$asset_id = $_GET['asset_id'];
-
+
+ // set template
+ $tp = new Template("tpl/assetview.tpl");
+
+ // set language variables
+ $tp->setvars($lang);
+
// get asset info
- $result = mysql_query("SELECT a.asset_name, a.hostname, a.asset_info, ac.assetclass_id, ac.assetclass_name FROM asset a, assetclass ac WHERE a.asset_id='$asset_id' AND ac.assetclass_id=a.assetclass_id");
- while ($row = mysql_fetch_object($result)) {
- $asset_name = $row->asset_name;
- $hostname = $row->hostname;
- $asset_info = $row->asset_info;
- $assetclass_id = $row->assetclass_id;
- $assetclass_name = $row->assetclass_name;
- }
-?>
-
-
-
-
- Asset name:
- |
-
-
- |
-
-
-
- Hostname:
- |
-
-
- |
-
-
-
- Asset class:
- |
-
-
- |
-
-
-
- Asset info:
- |
-
-
- |
-
-
-
-node_id;
- $ip = $row->ip;
- $mac = write_mac($row->mac);
- $dns1 = $row->dns1;
- $dns2 = $row->dns2;
- $subnet_id = $row->subnet_id;
- $node_info = $row->node_info;
- $subnet_address = $row->subnet_address;
- $subnet_mask = $row->subnet_mask;
- $nodecount++;
-?>
-
-
-
-
-
-
-
- |
-
- Node #
- |
-
-
-
- IP Address:
- |
-
-
- |
-
-
-
- Subnet:
- |
-
- /
- |
-
-
-
- MAC Address:
- |
-
-
- |
-
-
-
- DNS name:
- |
-
-
- |
-
-
-
- DNS alias:
- |
-
-
- |
-
-
-
- Node info:
- |
-
-
- |
-
-
+ $result = mysql_query("SELECT a.asset_name, a.hostname, a.asset_info, ac.assetclass_id, ac.assetclass_name FROM asset a, assetclass ac WHERE a.asset_id='$asset_id' AND ac.assetclass_id=a.assetclass_id") or die(mysql_error());
+ $row=mysql_fetch_object($result);
+ $tp->set("asset_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);
-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"));
- // display only if admin
- if($_SESSION['suser_level'] >= 2) {
-?>
-
-
-
-
-
-= $config_userlevel_assetedit) {
+ $tp->set("asset_id", $asset_id);
+ $tp->parse("assetedit");
+ } else {
+ $tp->hide("assetedit");
}
+ if($_SESSION['suser_level'] >= $config_userlevel_assetdel) {
+ $tp->set("asset_id", $asset_id);
+ $tp->parse("assetdel");
+ } else {
+ $tp->hide("assetdel");
+ }
+
+ // output
+ $tp->parse();
+ $tp->spit();
include("footer.php");
?>
\ No newline at end of file
diff --git a/assigniptoasset.php b/assigniptoasset.php
index 70b0f3b..5f29f3e 100644
--- a/assigniptoasset.php
+++ b/assigniptoasset.php
@@ -1,115 +1,45 @@
= 2) {
+ // get ip and id
+ if((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = "");
+ if((isset($_GET['ip'])) ? $ip = $_GET['ip'] : $ip = "");
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $ip = $_POST['ip'];
- $mac = strip_mac($_POST['mac']);
- $subnet_id = $_POST['subnet_id'];
- $asset_id = $_POST['asset_id'];
- $node_info = $_POST['node_info'];
-
- // DNS1
- if (!empty($_POST['dns1']) && isset($_POST['dns1suffix'])) {
- $dns1 = $_POST['dns1'] . $config_dns1suffix;
- } else {
- $dns1 = $_POST['dns1'];
- }
-
- // DNS2
- if (!empty($_POST['dns2']) && isset($_POST['dns2suffix'])) {
- $dns2 = $_POST['dns2'] . $config_dns2suffix;
- } else {
- $dns2 = $_POST['dns2'];
- }
-
- mysql_query("INSERT INTO node (ip, mac, dns1, dns2, subnet_id, asset_id, node_info) VALUE ('$ip', '$mac', '$dns1', '$dns2', '$subnet_id', '$asset_id', '$node_info')") or die(mysql_error());
-
- header_location("assetview.php?asset_id=" . $asset_id);
- }
+ // set template
+ $tp = new Template("tpl/assigniptoasset.tpl");
- $ip = $_GET['ip'];
- $subnet_id = $_GET['subnet_id'];
-?>
+ // set language variables
+ $tp->setvars($lang);
-
-
-set("ip", $ip);
+ $tp->set("subnet_id", $subnet_id);
+ $tp->set("config_dns1suffix", $config_dns1suffix);
+ $tp->set("config_dns2suffix", $config_dns2suffix);
+
+ // get subnet info
+ $result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error());
+ for ($i=0;$row=mysql_fetch_object($result);$i++) {
+ if (($row->subnet_id==$subnet_id) ? $tp->set("selected", "selected") : $tp->set("selected", ""));
+ $tp->set("subnet_id", $row->subnet_id);
+ $tp->set("subnet_address", $row->subnet_address);
+ $tp->set("subnet_mask", $row->subnet_mask);
+ $tp->parse("subnetrow");
}
+ if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet"));
+
+ // get 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++) {
+ $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");
?>
\ No newline at end of file
diff --git a/assigniptonode.php b/assigniptonode.php
index 24c34ae..74816c7 100644
--- a/assigniptonode.php
+++ b/assigniptonode.php
@@ -1,59 +1,41 @@
subnet_address;
- $subnet_mask = $row->subnet_mask;
- }
-?>
+ // set template
+ $tp = new Template("tpl/assigniptonode.tpl");
-
-
-
- IP:
- |
-
-
- |
-
-
-
- Subnet:
- |
-
- /
- |
-
-
+ // set language variables
+ $tp->setvars($lang);
-= 2) {
-?>
-
-
+ // set variables
+ $tp->set("ip", $ip);
+ $tp->set("subnet_id", $subnet_id);
-
-
-set("subnet_address", $row->subnet_address);
+ $tp->set("subnet_mask", $row->subnet_mask);
+
+ // display options
+ if($_SESSION['suser_level'] >= $config_userlevel_assigniptonode) {
+ $tp->parse("assigniptonode");
+ } else {
+ $tp->hide("assigniptonode");
+ }
+ if($_SESSION['suser_level'] >= $config_userlevel_nodeadd) {
+ $tp->parse("nodeadd");
+ } else {
+ $tp->hide("nodeadd");
}
+
+ // output
+ $tp->parse();
+ $tp->spit();
include("footer.php");
?>
\ No newline at end of file
diff --git a/assignlocationtosubnet.php b/assignlocationtosubnet.php
index edb6e3f..2be2a6a 100644
--- a/assignlocationtosubnet.php
+++ b/assignlocationtosubnet.php
@@ -1,53 +1,40 @@
= 2) {
+ // 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 = "");
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $location_id = $_POST['location_id'];
- $subnet_id = $_POST['subnet_id'];
-
- mysql_query("INSERT INTO subnetlocation (location_id, subnet_id) VALUE ('$location_id', '$subnet_id')") or die(mysql_error());
+ // set template
+ $tp = new Template("tpl/assignlocationtosubnet.tpl");
+
+ // set language variables
+ $tp->setvars($lang);
- header("Location: location.php");
+ // 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"));
- $location_id = $_GET['location_id'];
-?>
-
-
-
-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");
?>
\ No newline at end of file
diff --git a/assignsubnettolocation.php b/assignsubnettolocation.php
index 362cd1a..1998a21 100644
--- a/assignsubnettolocation.php
+++ b/assignsubnettolocation.php
@@ -29,7 +29,7 @@
location_id . '">' . str_repeat(' ',$level) . $row->location_name . '';
display_children($row->location_id, $level+1);
diff --git a/assignvlantosubnet.php b/assignvlantosubnet.php
index 0fadbb3..c877fb6 100644
--- a/assignvlantosubnet.php
+++ b/assignvlantosubnet.php
@@ -1,53 +1,41 @@
= 2) {
+ // set template
+ $tp = new Template("tpl/assignvlantosubnet.tpl");
- // check for submit
- if ($_SERVER['REQUEST_METHOD']=="POST" ) {
- $vlan_id = $_POST['vlan_id'];
- $subnet_id = $_POST['subnet_id'];
-
- mysql_query("UPDATE subnet SET vlan_id='$vlan_id' WHERE subnet_id='$subnet_id'") or die(mysql_error());
-
- header("location: vlanview.php?vlan_id=" . $vlan_id);
- }
+ // set language variables
+ $tp->setvars($lang);
- $vlan_id = $_GET['vlan_id'];
-?>
+ // 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 = "");
-
-
-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");
?>
\ No newline at end of file
diff --git a/config.php b/config.php
index cec84b7..fb1f1ca 100644
--- a/config.php
+++ b/config.php
@@ -1,17 +1,52 @@
\ No newline at end of file
diff --git a/error.php b/error.php
new file mode 100644
index 0000000..f70c603
--- /dev/null
+++ b/error.php
@@ -0,0 +1,21 @@
+setvars($lang);
+
+ // get error
+ $error = $_GET['error'];
+
+ // set veriables
+ $tp->set("error", $lang['lang_error_' . $error]);
+
+ // output
+ $tp->parse();
+ $tp->spit();
+
+ include("footer.php");
+?>
\ No newline at end of file
diff --git a/footer.php b/footer.php
index ce69cc7..f6f394e 100644
--- a/footer.php
+++ b/footer.php
@@ -1,20 +1,11 @@
-
-
-
-
-
-