parent
7322231d3e
commit
8d00ee5e1b
@ -1,23 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
?> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Asset:</b><br> |
||||
</td> |
||||
</tr> |
||||
// set template |
||||
$tp = new Template("tpl/asset.tpl"); |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset ORDER BY asset_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="assetview.php?asset_id=' . $row->asset_id . '">' . $row->asset_name . '</a></td></tr>'; |
||||
// 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")); |
||||
|
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<? |
||||
include("footer.php"); |
||||
?> |
@ -1,80 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 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(); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
// get assetclassgroup information |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("assetclass_id", $row->assetclass_id); |
||||
$tp->set("assetclass_name", $row->assetclass_name); |
||||
$tp->parse("assetclassrow"); |
||||
} |
||||
?> |
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass")); |
||||
|
||||
<form method="POST" action="assetadd.php"> |
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add asset:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="asset_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Hostname: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="hostname"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset class: |
||||
</td> |
||||
<td> |
||||
<select name="assetclass_id"> |
||||
<?php |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->assetclass_id . '">' . $row->assetclass_name . '</option>'; |
||||
} |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset info: |
||||
</td> |
||||
<td> |
||||
<textarea name="asset_info"></textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,23 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
?> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Assetclass:</b><br> |
||||
</td> |
||||
</tr> |
||||
// set template |
||||
$tp = new Template("tpl/assetclass.tpl"); |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="assetclassview.php?assetclass_id=' . $row->assetclass_id . '">' . $row->assetclass_name . '</a></td></tr>'; |
||||
// 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")); |
||||
|
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<?php |
||||
include("footer.php"); |
||||
?> |
@ -1,63 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// 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 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++) { |
||||
$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")); |
||||
|
||||
<form method="POST" action="assetclassadd.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add new assetclass:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Assetclass name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="assetclass_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Assetclass Group:<br> |
||||
</td> |
||||
<td> |
||||
<select name="assetclassgroup_id"> |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_id"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->assetclassgroup_id . '">' . $row->assetclassgroup_name. '</option>'; |
||||
} |
||||
?> |
||||
|
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get id |
||||
$assetclass_id = $_GET['assetclass_id']; |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/assetclassdel.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get assetclass info |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass WHERE assetclass_id='$assetclass_id'") or die(mysql_error()); |
||||
$row=mysql_fetch_object($result); |
||||
$tp->set("assetclass_id", $row->assetclass_id); |
||||
$tp->set("assetclass_name", $row->assetclass_name); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,78 +1,36 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// 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); |
||||
} |
||||
|
||||
// get id |
||||
$assetclass_id = $_GET['assetclass_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; |
||||
} |
||||
?> |
||||
// set template |
||||
$tp = new Template("tpl/assetclassedit.tpl"); |
||||
|
||||
<form method="POST" action="assetclassedit.php"> |
||||
<input type="hidden" name="assetclass_id" value="<?php echo $assetclass_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Edit assetclass:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Assetclass name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="assetclass_name" value="<?php echo $assetclass_name; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Assetclass Group:<br> |
||||
</td> |
||||
<td> |
||||
<select name="assetclassgroup_id"> |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name FROM assetclassgroup ORDER BY assetclassgroup_id"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
if ($row->assetclassgroup_id==$assetclassgroup_id) { |
||||
$selected = "selected"; |
||||
} else { |
||||
$selected = ""; |
||||
} |
||||
echo '<option value="' . $row->assetclassgroup_id . '" ' . $selected . '>' . $row->assetclassgroup_name. '</option>'; |
||||
// 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")); |
||||
|
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,17 +1,33 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 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); |
||||
|
||||
// end display only if admin |
||||
// get asset info |
||||
$result = mysql_query("SELECT asset_name FROM asset WHERE asset_id='$asset_id'") or die(mysql_error()); |
||||
$row=mysql_fetch_object($result); |
||||
$tp->set("asset_id", $asset_id); |
||||
$tp->set("asset_name", $row->asset_name); |
||||
|
||||
// get node info |
||||
$result = mysql_query("SELECT n.node_id, n.ip, n.mac, n.dns1, n.dns2, n.node_info, s.subnet_id, s.subnet_address, s.subnet_mask FROM node n, subnet s WHERE asset_id='$asset_id' AND s.subnet_id=n.subnet_id ORDER BY INET_ATON(n.ip)") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("node_id", $row->node_id); |
||||
$tp->set("ip", $row->ip); |
||||
$tp->parse("noderow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node")); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,96 +1,37 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 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()); |
||||
// get id |
||||
$asset_id = $_GET['asset_id']; |
||||
|
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
// set template |
||||
$tp = new Template("tpl/assetedit.tpl"); |
||||
|
||||
$asset_id = $_GET['asset_id']; |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// 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; |
||||
// 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; |
||||
$asset_info = $row->asset_info; |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="assetedit.php"> |
||||
<input type="hidden" name="asset_id" value="<?php echo $asset_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Edit asset:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="asset_name" value="<?php echo $asset_name; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Hostname: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="hostname" value="<?php echo $hostname; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset class: |
||||
</td> |
||||
<td> |
||||
<select name="assetclass_id"> |
||||
<?php |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
if ($row->assetclass_id==$assetclass_id) { |
||||
$selected = 'selected'; |
||||
} else { |
||||
$selected = ''; |
||||
} |
||||
echo '<option value="' . $row->assetclass_id . '" ' . $selected . '>' . $row->assetclass_name . '</option>'; |
||||
$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"); |
||||
} |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset info: |
||||
</td> |
||||
<td> |
||||
<textarea name="asset_info"><?php echo $asset_info; ?></textarea>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass")); |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,115 +1,45 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// 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']; |
||||
// get ip and id |
||||
if((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = ""); |
||||
if((isset($_GET['ip'])) ? $ip = $_GET['ip'] : $ip = ""); |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/assigniptoasset.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// set variables |
||||
$tp->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"); |
||||
} |
||||
|
||||
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); |
||||
} |
||||
|
||||
$ip = $_GET['ip']; |
||||
$subnet_id = $_GET['subnet_id']; |
||||
?> |
||||
|
||||
<form method="POST" action="assigniptoasset.php"> |
||||
<input type="hidden" name="ip" value="<?php echo $ip; ?>">
|
||||
<input type="hidden" name="subnet_id" value="<?php echo $subnet_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Assign <?php echo $ip; ?>:</b><br>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset: |
||||
</td> |
||||
<td> |
||||
<select name="asset_id"> |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset ORDER BY asset_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->asset_id . '">' . $row->asset_name . '</option>'; |
||||
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"); |
||||
} |
||||
?> |
||||
|
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
MAC address: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="mac"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
DNS name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns1"> |
||||
</td> |
||||
<td> |
||||
<input type="checkbox" name="dns1suffix" checked><?php echo $config_dns1suffix; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
DNS alias: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns2"> |
||||
</td> |
||||
<td> |
||||
<input type="checkbox" name="dns2suffix" checked><?php echo $config_dns2suffix; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Node info: |
||||
</td> |
||||
<td> |
||||
<textarea name="node_info"></textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset")); |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,59 +1,41 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get ip and id |
||||
$ip = $_GET['ip']; |
||||
$subnet_id = $_GET['subnet_id']; |
||||
|
||||
// get node info |
||||
$result = mysql_query("SELECT subnet_address, subnet_mask FROM subnet WHERE subnet_id='$subnet_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$subnet_address = $row->subnet_address; |
||||
$subnet_mask = $row->subnet_mask; |
||||
} |
||||
?> |
||||
// set template |
||||
$tp = new Template("tpl/assigniptonode.tpl"); |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>IP:</b> |
||||
</td> |
||||
<td> |
||||
<?php echo $ip; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>Subnet:</b> |
||||
</td> |
||||
<td> |
||||
<a href="subnetview.php?subnet_id=<?php echo $subnet_id; ?>&page=<?php echo page($ip); ?>"><?php echo $subnet_address; ?>/<?php echo $subnet_mask; ?></a>
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
<?php |
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
?> |
||||
// set variables |
||||
$tp->set("ip", $ip); |
||||
$tp->set("subnet_id", $subnet_id); |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="assigniptoasset.php?ip=<?php echo $ip; ?>&subnet_id=<?php echo $subnet_id; ?>">Assign IP to asset</a>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="nodeadd.php?ip=<?php echo $ip; ?>&subnet_id=<?php echo $subnet_id; ?>">Create new asset</a>
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
// 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); |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
// 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"); |
||||
?> |
@ -1,53 +1,40 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// 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()); |
||||
|
||||
header("Location: location.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"); |
||||
} |
||||
|
||||
$location_id = $_GET['location_id']; |
||||
?> |
||||
|
||||
<form method="POST" action="assignlocationtosubnet.php"> |
||||
<input type="hidden" name="location_id" value="<?php echo $location_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Assign to:</b><br> |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT subnet_id, subnet_address FROM subnet ORDER BY INET_ATON(subnet_address)"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->subnet_id . '">' . $row->subnet_address . '</option>'; |
||||
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")); |
||||
|
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,53 +1,41 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// 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 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"); |
||||
} |
||||
|
||||
$vlan_id = $_GET['vlan_id']; |
||||
?> |
||||
|
||||
<form method="POST" action="assignvlantosubnet.php"> |
||||
<input type="hidden" name="vlan_id" value="<?php echo $vlan_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Assign to:</b><br> |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT subnet_id, subnet_address FROM subnet ORDER BY INET_ATON(subnet_address)"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->subnet_id . '">' . $row->subnet_address . '</option>'; |
||||
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")); |
||||
|
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,17 +1,52 @@ |
||||
<?php
|
||||
// version |
||||
$config_version = 'v0.1'; |
||||
$config_version = 'v0.3'; |
||||
|
||||
// db connection |
||||
$mysql_host = "localhost"; |
||||
$mysql_username = "dbuser"; |
||||
$mysql_password = "dbpass"; |
||||
$mysql_dbname = "dbname"; |
||||
$mysql_username = "db_user"; |
||||
$mysql_password = "db_pass"; |
||||
$mysql_dbname = "db_name"; |
||||
|
||||
// standard password for new users |
||||
$config_user_lang = "en"; |
||||
$config_user_pass = "welcome"; |
||||
|
||||
// set userlevels |
||||
$config_userlevel_assetadd = 2; |
||||
$config_userlevel_assetdel = 2; |
||||
$config_userlevel_assetedit = 2; |
||||
$config_userlevel_assetview = 1; |
||||
$config_userlevel_assetclassadd = 2; |
||||
$config_userlevel_assetclassdel = 2; |
||||
$config_userlevel_assetclassedit = 2; |
||||
$config_userlevel_assetclassview = 1; |
||||
$config_userlevel_assetclassgroupadd = 2; |
||||
$config_userlevel_assetclassgroupdel = 2; |
||||
$config_userlevel_assetclassgroupedit = 2; |
||||
$config_userlevel_assetclassgroupview = 1; |
||||
$config_userlevel_locationadd = 2; |
||||
$config_userlevel_locationdel = 2; |
||||
$config_userlevel_locationedit = 2; |
||||
$config_userlevel_locationview = 1; |
||||
$config_userlevel_nodeadd = 2; |
||||
$config_userlevel_nodedel = 2; |
||||
$config_userlevel_nodeedit = 2; |
||||
$config_userlevel_nodeview = 1; |
||||
$config_userlevel_subnetadd = 2; |
||||
$config_userlevel_subnetdel = 2; |
||||
$config_userlevel_subnetedit = 2; |
||||
$config_userlevel_subnetview = 1; |
||||
$config_userlevel_useradd = 2; |
||||
$config_userlevel_userdel = 2; |
||||
$config_userlevel_useredit = 2; |
||||
$config_userlevel_userview = 1; |
||||
$config_userlevel_vlanadd = 2; |
||||
$config_userlevel_vlandel = 2; |
||||
$config_userlevel_vlanedit = 2; |
||||
$config_userlevel_vlanview = 1; |
||||
|
||||
// domain suffix for dns input fields |
||||
$config_dns1suffix = '.your.domain'; |
||||
$config_dns2suffix = '.your.domain'; |
||||
$config_dns1suffix = '.yourdomain.com'; |
||||
$config_dns2suffix = '.yourdomain.com'; |
||||
?> |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/error.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get error |
||||
$error = $_GET['error']; |
||||
|
||||
// set veriables |
||||
$tp->set("error", $lang['lang_error_' . $error]); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,20 +1,11 @@ |
||||
<?php |
||||
// start footer output |
||||
?> |
||||
|
||||
<hr> |
||||
// set template |
||||
$tp = new Template("tpl/footer.tpl"); |
||||
|
||||
<table border="0" width="100%"> |
||||
<tr> |
||||
<td align="center"> |
||||
<a href="index.php" class="label">IP Reg <?php echo $config_version; ?></a>
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
// get version for the footer-stamp |
||||
$tp->set("config_version", $config_version); |
||||
|
||||
</body> |
||||
</html> |
||||
|
||||
<?php |
||||
ob_end_flush(); |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
?> |
After Width: | Height: | Size: 1.0 KiB |
@ -1,81 +1,40 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// calculate stats |
||||
// set template |
||||
$tp = new Template("tpl/index.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// calculate assets |
||||
$query = mysql_query("SELECT asset_id FROM asset") or die(mysql_error()); |
||||
$assetcount = mysql_num_rows($query); |
||||
$tp->set('assetcount', $assetcount); |
||||
|
||||
// calculate locations |
||||
$query = mysql_query("SELECT location_id FROM location") or die(mysql_error()); |
||||
$locationcount = mysql_num_rows($query); |
||||
$tp->set('locationcount', $locationcount); |
||||
|
||||
// calculate nodes |
||||
$query = mysql_query("SELECT node_id FROM node") or die(mysql_error()); |
||||
$nodecount = mysql_num_rows($query); |
||||
$tp->set('nodecount', $nodecount); |
||||
|
||||
// calculate subnets |
||||
$query = mysql_query("SELECT subnet_id FROM subnet") or die(mysql_error()); |
||||
$subnetcount = mysql_num_rows($query); |
||||
$tp->set('subnetcount', $subnetcount); |
||||
|
||||
// calculate vlans |
||||
$query = mysql_query("SELECT vlan_id FROM vlan") or die(mysql_error()); |
||||
$vlancount = mysql_num_rows($query); |
||||
?> |
||||
$tp->set('vlancount', $vlancount); |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>IP Reg <?php echo $config_version; ?></b><br>
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Statistics:</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td width="100"> |
||||
Assets: |
||||
</td> |
||||
<td align="right"> |
||||
<?php echo $assetcount; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Locations: |
||||
</td> |
||||
<td align="right"> |
||||
<?php echo $locationcount; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Nodes: |
||||
</td> |
||||
<td align="right"> |
||||
<?php echo $nodecount; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnets: |
||||
</td> |
||||
<td align="right"> |
||||
<?php echo $subnetcount; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLANs: |
||||
</td> |
||||
<td align="right"> |
||||
<?php echo $vlancount; ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<?php
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,116 @@ |
||||
<?php |
||||
|
||||
$lang = array( |
||||
'lang_asset' => 'Asset', |
||||
'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_sublocation' => 'Sub-location', |
||||
'lang_sublocations' => 'Sub-locations', |
||||
'lang_subnet' => 'Subnet', |
||||
'lang_subnets' => 'Subnets', |
||||
'lang_vlan' => 'VLAN', |
||||
'lang_vlans' => 'VLANs', |
||||
|
||||
'lang_color' => 'Color', |
||||
'lang_error' => 'Error', |
||||
'lang_header_viewby' => 'View by', |
||||
'lang_language' => 'Language', |
||||
'lang_login' => 'Login', |
||||
'lang_logout' => 'Logout', |
||||
'lang_options' => 'Options', |
||||
'lang_reset' => 'Reset', |
||||
'lang_search' => 'Search!', |
||||
'lang_statistics' => 'Statistics', |
||||
'lang_submit' => 'Submit', |
||||
'lang_unassigned' => 'Unassigned', |
||||
|
||||
'lang_asset_add' => 'Add asset', |
||||
'lang_asset_del' => 'Delete asset', |
||||
'lang_asset_edit' => 'Modify asset', |
||||
'lang_asset_info' => 'Asset info', |
||||
'lang_asset_name' => 'Asset name', |
||||
'lang_hostname' => 'Hostname', |
||||
|
||||
'lang_assetclass_add' => 'Add assetclass', |
||||
'lang_assetclass_del' => 'Delete assetclass', |
||||
'lang_assetclass_edit' => 'Mofidy assetclass', |
||||
'lang_assetclass_name' => 'Assetclass name', |
||||
|
||||
'lang_assetclassgroup_add' => 'Add assetclassgroup', |
||||
'lang_assetclassgroup_del' => 'Delete assetclassgroup', |
||||
'lang_assetclassgroup_edit' => 'Modify assetclassgroup', |
||||
'lang_assetclassgroup_name' => 'Assetclass Groupname', |
||||
|
||||
'lang_assigniptoasset' => 'Assign IP to asset', |
||||
'lang_assignlocationtosubnet' => 'Assign location to subnet', |
||||
'lang_assignvlantosubnet' => 'Assign VLAN to subnet', |
||||
|
||||
'lang_error_ipinuse' => 'IP in use', |
||||
'lang_error_locationisparent' => 'This location has sub-locations', |
||||
'lang_error_notallowed' => 'Not allowed', |
||||
'lang_error_usernameinuse' => 'Username in use', |
||||
'lang_goback' => 'Go back', |
||||
|
||||
'lang_location_add' => 'Add location', |
||||
'lang_location_del' => 'Delete location', |
||||
'lang_location_edit' => 'Mofidy location', |
||||
'lang_location_info' => 'Location info', |
||||
'lang_location_name' => 'Location name', |
||||
'lang_location_parent' => 'Parent', |
||||
|
||||
'lang_node_add' => 'Add node', |
||||
'lang_node_del' => 'Delete node', |
||||
'lang_node_edit' => 'Modify node', |
||||
'lang_node_info' => 'Node info', |
||||
'lang_node_new' => 'Create new node', |
||||
'lang_dns1' => 'DNS name', |
||||
'lang_dns2' => 'DNS Alias', |
||||
'lang_ip' => 'IP Address', |
||||
'lang_mac' => 'MAC Address', |
||||
|
||||
'lang_search_found' => 'found', |
||||
'lang_search_results_found' => 'Total results found', |
||||
|
||||
'lang_subnet_add' => 'Add subnet', |
||||
'lang_subnet_subnetaddress' => 'Subnet address', |
||||
'lang_subnet_broadcastaddress' => 'Broadcast address', |
||||
'lang_subnet_del' => 'Delete subnet', |
||||
'lang_subnet_edit' => 'Modify subnet', |
||||
'lang_subnet_info' => 'Subnet info', |
||||
'lang_subnet_mask' => 'Subnet mask', |
||||
|
||||
'lang_user_add' => 'Add user', |
||||
'lang_user_del' => 'Delete user', |
||||
'lang_user_displayname' => 'Displayname', |
||||
'lang_user_edit' => 'Mofidy user', |
||||
'lang_user_level' => 'Userlevel', |
||||
'lang_user_name' => 'Username', |
||||
'lang_user_pass' => 'Password', |
||||
'lang_user_passnew1' => 'New password', |
||||
'lang_user_passnew2' => 'Retype new password', |
||||
'lang_user_passold' => 'Current password', |
||||
|
||||
'lang_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_name' => 'VLAN name', |
||||
|
||||
'lang_warning_asset_del_nodes' => 'These nodes will also be deleted!', |
||||
'lang_warning_search_nosearch' => 'Nothing to search for!', |
||||
|
||||
'lang_options_ipreg' => 'IP Reg options', |
||||
'lang_options_password_edit' => 'Modify password', |
||||
'lang_options_personal' => 'Personal options', |
||||
'lang_options_settings_edit' => 'Modify settings', |
||||
); |
||||
|
||||
?> |
@ -1,48 +1,69 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
function display_subnet ($location_id) { |
||||
$subnet = ''; |
||||
// set template |
||||
$tp = new Template("tpl/location.tpl"); |
||||
|
||||
$result = mysql_query("SELECT s.subnet_id, s.subnet_address, s.subnet_mask FROM subnet s INNER JOIN subnetlocation sl ON s.subnet_id=sl.subnet_id WHERE sl.location_id='$location_id' ORDER BY INET_ATON(subnet_address)"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$subnet .= '<a href="subnetview.php?subnet_id='. $row->subnet_id . '">' . $row->subnet_address . '/' . $row->subnet_mask . '</a><br>'; |
||||
} |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// create array with parent index and location names |
||||
$parents = array(); |
||||
$location_names = array(); |
||||
|
||||
return $subnet; |
||||
// 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; |
||||
} |
||||
|
||||
// displaysubnet link (or not) |
||||
if (isset($_GET['displaysubnet'])) { |
||||
$displaysubnetlink = '<a href="location.php">(hide subnets)</a>'; |
||||
// 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 { |
||||
$displaysubnetlink = '<a href="location.php?displaysubnet">(display subnets)</a>'; |
||||
// no children, set NULL |
||||
$children[$child] = NULL; |
||||
} |
||||
} |
||||
return $children; |
||||
} |
||||
|
||||
// "menu" |
||||
function display_children($parent, $level) { |
||||
$result = mysql_query("SELECT location_id, location_name FROM location WHERE parent='$parent' ORDER BY location_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
if (isset($_GET['displaysubnet'])) { |
||||
$displaysubnet = display_subnet($row->location_id); |
||||
// recursive children check to template |
||||
function checkchildren ($array, $level) { |
||||
global $tp; |
||||
global $location_names; |
||||
foreach ($array as $location_id=>$val) { |
||||
if($val != "") { |
||||
$tp->set("location_id", $location_id); |
||||
$tp->set("location_name", $location_names[$location_id]); |
||||
$tp->set("nbsp", str_repeat(" ",$level)); |
||||
$tp->parse("locationrow"); |
||||
checkchildren($val, $level+1); |
||||
} else { |
||||
$displaysubnet = ''; |
||||
$tp->set("location_id", $location_id); |
||||
$tp->set("location_name", $location_names[$location_id]); |
||||
$tp->set("nbsp", str_repeat(" ",$level)); |
||||
$tp->parse("locationrow"); |
||||
} |
||||
echo '<tr><td>' . str_repeat(' ',$level) . '<a href="locationview.php?location_id=' . $row->location_id . '">' . $row->location_name . '</a></td><td> </td><td>' . $displaysubnet . '</td></tr>'; |
||||
display_children($row->location_id, $level+1); |
||||
} |
||||
$tp->parse("location"); |
||||
$tp->clear("location"); |
||||
} |
||||
?> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Location:</b> <?php echo $displaysubnetlink; ?> |
||||
</td> |
||||
</tr> |
||||
<?php display_children('',0); ?>
|
||||
</table> |
||||
// assemble the tree |
||||
$tree = location($parents); |
||||
|
||||
// check for values and build template |
||||
checkchildren($tree, 0); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<?php |
||||
include("footer.php"); |
||||
?> |
@ -1,62 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
// set template |
||||
$tp = new Template("tpl/locationadd.tpl"); |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$location_name = $_POST['location_name']; |
||||
$parent = $_POST['parent']; |
||||
mysql_query("INSERT INTO location (location_name, parent) VALUE ('$location_name', '$parent')") or die(mysql_error()); |
||||
$location_id = mysql_insert_id(); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
header_location("locationview.php?location_id=" . $location_id); |
||||
// 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++) { |
||||
$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")); |
||||
|
||||
<form method="POST" action="locationadd.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add new location:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Location name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="location_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Parent: |
||||
</td> |
||||
<td> |
||||
<select name="parent"> |
||||
<option value="0">(none)</option> |
||||
<?php |
||||
$result = mysql_query("SELECT location_name, location_id FROM location ORDER BY location_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->location_id . '">' . $row->location_name . '</option>'; |
||||
} |
||||
?> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,24 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get id |
||||
$location_id = $_GET['location_id']; |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/locationdel.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get location info |
||||
$result = mysql_query("SELECT location_name FROM location WHERE location_id='$location_id'") or die(mysql_error()); |
||||
$row=mysql_fetch_object($result); |
||||
$tp->set("location_id", $location_id); |
||||
$tp->set("location_name", $row->location_name); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,191 +1,43 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$ip = str_replace(' ', '', $_POST['ip']); |
||||
|
||||
// IP in use? |
||||
$result = mysql_query("SELECT * FROM node WHERE ip='$ip'"); |
||||
if (mysql_num_rows($result)!=0) { |
||||
echo 'IP in use!'; |
||||
exit; |
||||
} else { |
||||
$asset_name = $_POST['asset_name']; |
||||
$hostname = $_POST['hostname']; |
||||
$assetclass_id = $_POST['assetclass_id']; |
||||
mysql_query("INSERT INTO asset (asset_name, hostname, assetclass_id) VALUE ('$asset_name', '$hostname', '$assetclass_id')") or die(mysql_error()); |
||||
|
||||
// get asset_id for new node |
||||
$asset_id = mysql_insert_id(); |
||||
$mac = strip_mac($_POST['mac']); |
||||
|
||||
// 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']; |
||||
} |
||||
|
||||
$subnet_id = $_POST['subnet_id']; |
||||
mysql_query("INSERT INTO node (ip, mac, dns1, dns2, subnet_id, asset_id) VALUE ('$ip', '$mac', '$dns1', '$dns2', '$subnet_id', '$asset_id')") or die(mysql_error()); |
||||
$node_id = mysql_insert_id(); |
||||
|
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
} |
||||
|
||||
// check for ip |
||||
if (isset($_GET['ip'])) { |
||||
$ip = $_GET['ip']; |
||||
} else { |
||||
$ip = ""; |
||||
} |
||||
// check for subnet_id |
||||
if (isset($_GET['subnet_id'])) { |
||||
$subnet_id = $_GET['subnet_id']; |
||||
} else { |
||||
$subnet_id = ''; |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="nodeadd.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add new node:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="asset_name"> |
||||
</td> |
||||
<td> |
||||
* |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Hostname: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="hostname"> |
||||
</td> |
||||
<td> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
IP Address: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="ip" value="<?php echo $ip; ?>">
|
||||
</td> |
||||
<td> |
||||
* |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet:<br> |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
if ($row->subnet_id==$subnet_id) { |
||||
$selected = ' selected'; |
||||
} else { |
||||
$selected = ''; |
||||
} |
||||
echo '<option value="' . $row->subnet_id . '" ' . $selected . '>' . $row->subnet_address . '/' . $row->subnet_mask . '</option>'; |
||||
} |
||||
?> |
||||
|
||||
</select> |
||||
</td> |
||||
<td> |
||||
* |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset class: |
||||
</td> |
||||
<td> |
||||
<select name="assetclass_id"> |
||||
<?php |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<option value="' . $row->assetclass_id . '" ' . $selected . '>' . $row->assetclass_name . '</option>'; |
||||
} |
||||
?> |
||||
</select> |
||||
</td> |
||||
<td> |
||||
* |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
MAC Address: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="mac"> |
||||
</td> |
||||
<td> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
DNS name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns1"> |
||||
</td> |
||||
<td> |
||||
<input type="checkbox" name="dns1suffix" checked><?php echo $config_dns1suffix; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
DNS alias: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns2"> |
||||
</td> |
||||
<td> |
||||
<input type="checkbox" name="dns2suffix" checked><?php echo $config_dns2suffix; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// set template |
||||
$tp = new Template("tpl/nodeadd.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// check for set ip and/or subnet_id |
||||
if ((isset($_GET['ip'])) ? $ip = $tp->set("ip", $_GET['ip']) : $tp->set("ip", "")); |
||||
if ((isset($_GET['subnet_id'])) ? $subnet_id = $_GET['subnet_id'] : $subnet_id = ''); |
||||
|
||||
// set variables |
||||
$tp->set("config_dns1suffix", $config_dns1suffix); |
||||
$tp->set("config_dns2suffix", $config_dns2suffix); |
||||
|
||||
// get subnet info |
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
if (($row->subnet_id==$subnet_id) ? $tp->set("selected", "selected") : $tp->set("selected", "")); |
||||
$tp->set("subnet_id", $row->subnet_id); |
||||
$tp->set("subnet_address", $row->subnet_address); |
||||
$tp->set("subnet_mask", $row->subnet_mask); |
||||
$tp->parse("subnetrow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet")); |
||||
|
||||
// get assetclassgroup information |
||||
$result = mysql_query("SELECT assetclass_id, assetclass_name FROM assetclass ORDER BY assetclass_name") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("assetclass_id", $row->assetclass_id); |
||||
$tp->set("assetclass_name", $row->assetclass_name); |
||||
$tp->parse("assetclassrow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("assetclass") : $tp->hide("assetclass")); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,23 +1,25 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// get id |
||||
$node_id = $_GET['node_id']; |
||||
|
||||
// get asset id |
||||
$result = mysql_query("SELECT asset_id FROM node WHERE node_id='$node_id'") or die(mysql_error()); |
||||
$asset_id = mysql_result($result, 0, "asset_id"); |
||||
// set template |
||||
$tp = new Template("tpl/nodedel.tpl"); |
||||
|
||||
// delete node |
||||
mysql_query("DELETE FROM node WHERE node_id='$node_id'") or die(mysql_error()); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// redirect |
||||
header("Location: assetview.php?asset_id=" . $asset_id); |
||||
// get asset info |
||||
$result = mysql_query("SELECT ip, asset_id FROM node WHERE node_id='$node_id'") or die(mysql_error()); |
||||
$row=mysql_fetch_object($result); |
||||
$tp->set("node_id", $node_id); |
||||
$tp->set("asset_id", $row->asset_id); |
||||
$tp->set("ip", $row->ip); |
||||
|
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,129 +1,41 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$node_id = $_POST['node_id']; |
||||
$subnet_id = $_POST['subnet_id']; |
||||
$mac = strip_mac($_POST['mac']); |
||||
$dns1 = $_POST['dns1']; |
||||
$dns2 = $_POST['dns2']; |
||||
$node_info = $_POST['node_info']; |
||||
mysql_query("UPDATE node SET subnet_id='$subnet_id', mac='$mac', dns1='$dns1', dns2='$dns2', node_info='$node_info' WHERE node_id='$node_id'") or die(mysql_error()); |
||||
// get id |
||||
$node_id = $_GET['node_id']; |
||||
|
||||
header_location("nodeview.php?node_id=" . $node_id); |
||||
} |
||||
// set template |
||||
$tp = new Template("tpl/nodeedit.tpl"); |
||||
|
||||
$node_id = $_GET['node_id']; |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get node info |
||||
$result = mysql_query("SELECT a.asset_name, n.ip, n.mac, n.dns1, n.dns2, n.subnet_id, n.node_info FROM asset a, node n WHERE node_id='$node_id' AND a.asset_id=n.asset_id"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$ip = $row->ip; |
||||
$result = mysql_query("SELECT a.asset_name, n.ip, n.mac, n.dns1, n.dns2, n.subnet_id, n.node_info FROM asset a, node n WHERE node_id='$node_id' AND a.asset_id=n.asset_id") or die(mysql_error()); |
||||
$row = mysql_fetch_object($result); |
||||
$subnet_id = $row->subnet_id; |
||||
$mac = $row->mac; |
||||
$dns1 = $row->dns1; |
||||
$dns2 = $row->dns2; |
||||
$node_info = $row->node_info; |
||||
$asset_name = $row->asset_name; |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="nodeedit.php"> |
||||
<input type="hidden" name="node_id" value="<?php echo $node_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Edit node:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Asset: |
||||
</td> |
||||
<td> |
||||
<?php echo $asset_name; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
IP Address: |
||||
</td> |
||||
<td> |
||||
<?php echo $ip; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet:<br> |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
if ($row->subnet_id==$subnet_id) { |
||||
$selected = ' selected'; |
||||
} else { |
||||
$selected = ''; |
||||
$tp->set("node_id", $node_id); |
||||
$tp->set("asset_name", $row->asset_name); |
||||
$tp->set("ip", $row->ip); |
||||
$tp->set("mac", write_mac($row->mac)); |
||||
$tp->set("dns1", $row->dns1); |
||||
$tp->set("dns2", $row->dns2); |
||||
$tp->set("node_info", nl2br($row->node_info)); |
||||
|
||||
// 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"); |
||||
} |
||||
echo '<option value="' . $row->subnet_id . '" ' . $selected . '>' . $row->subnet_address . '/' . $row->subnet_mask . '</option>'; |
||||
} |
||||
?> |
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet")); |
||||
|
||||
</select> |
||||
</td> |
||||
<td> |
||||
* |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
MAC Address: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="mac" value="<?php echo $mac; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
DNS name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns1" value="<?php echo $dns1; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
DNS alias: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns2" value="<?php echo $dns2; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Node info: |
||||
</td> |
||||
<td> |
||||
<textarea name="node_info"><?php echo $node_info; ?></textarea>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,77 +1,28 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
?> |
||||
// set template |
||||
$tp = new Template("tpl/options.tpl"); |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>IP Reg options</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="assetadd.php">Add new asset</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="assetclassadd.php">Add new assetclass</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="locationadd.php">Add new location</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="nodeadd.php">Add new node</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="useradd.php">Add new user</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="subnetadd.php">Add new subnet</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="vlanadd.php">Add new vlan</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
?> |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// display options |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_assetadd) ? $tp->parse("assetadd") : $tp->hide("assetadd")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_assetclassadd) ? $tp->parse("assetclassadd") : $tp->hide("assetclassadd")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_locationadd) ? $tp->parse("locationadd") : $tp->hide("locationadd")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_nodeadd) ? $tp->parse("nodeadd") : $tp->hide("nodeadd")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_useradd) ? $tp->parse("useradd") : $tp->hide("useradd")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_subnetadd) ? $tp->parse("subnetadd") : $tp->hide("subnetadd")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_vlanadd) ? $tp->parse("vlanadd") : $tp->hide("vlanadd")); |
||||
|
||||
<p> |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_assigniptoasset) ? $tp->parse("assigniptoasset") : $tp->hide("assigniptoasset")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_assignlocationtosubnet) ? $tp->parse("assignlocationtosubnet") : $tp->hide("assignlocationtosubnet")); |
||||
if(($_SESSION['suser_level'] >= $config_userlevel_assignvlantosubnet) ? $tp->parse("assignvlantosubnet") : $tp->hide("assignvlantosubnet")); |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Personal options</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="useredit.php">Modify settings</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="userpassedit.php">Modify password</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<? |
||||
include("footer.php"); |
||||
?> |
@ -1,103 +1,105 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/search.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get string that was searched for |
||||
if (empty($search)) { |
||||
echo 'Nothing to search for...'; |
||||
exit; |
||||
} |
||||
$needle = '%' . $search . '%'; |
||||
$tp->parse("nosearch"); |
||||
$tp->hide("asset"); |
||||
$tp->hide("location"); |
||||
$tp->hide("node"); |
||||
$tp->hide("subnet"); |
||||
$tp->hide("vlan"); |
||||
$tp->hide("resultcount"); |
||||
} else { |
||||
$tp->hide("nosearch"); |
||||
|
||||
// set resultcounter to zero |
||||
// set needle and counter |
||||
$needle = '%' . $search . '%'; |
||||
$resultcounter = 0; |
||||
|
||||
echo '<table border="0">'; |
||||
|
||||
// look for asset |
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset WHERE asset_name LIKE '$needle' OR asset_info LIKE '%$needle%' ORDER BY asset_name"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>Asset(s):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="assetview.php?asset_id=' . $row->asset_id . '">' . $row->asset_name . '</a></td></tr>'; |
||||
$resultcounter++; |
||||
} |
||||
|
||||
// look for location |
||||
$result = mysql_query("SELECT location_id, location_name FROM location WHERE location_name LIKE '$needle' OR location_info LIKE '%$needle%' ORDER BY location_name"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>Location(s):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="locationview.php?location_id=' . $row->location_id . '">' . $row->location_name . '</a></td></tr>'; |
||||
$resultcounter++; |
||||
} |
||||
|
||||
// look for ip |
||||
$result = mysql_query("SELECT node_id, ip FROM node WHERE ip LIKE '$needle' ORDER BY ip"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>Registered IP(s):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . $row->ip . '</a></td></tr>'; |
||||
// search assets |
||||
$result = mysql_query("SELECT asset_id, asset_name FROM asset WHERE asset_name LIKE '$needle' OR asset_info LIKE '%$needle%' ORDER BY asset_name") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("counter", $i+1); |
||||
$tp->set("item_name", $lang['lang_assets']); |
||||
$tp->set("item", "asset"); |
||||
$tp->set("id", $row->asset_id); |
||||
$tp->set("name", $row->asset_name); |
||||
$resultcounter++; |
||||
$tp->parse("row"); |
||||
} |
||||
if (($i>0) ? $tp->parse("asset") : $tp->hide("asset")); |
||||
$tp->clear("row"); |
||||
|
||||
// look for mac |
||||
$mac = strip_mac($needle); |
||||
$result = mysql_query("SELECT node_id, mac FROM node WHERE mac LIKE '$mac' ORDER BY mac"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>MAC(s):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . write_mac($row->mac) . '</a></td></tr>'; |
||||
// search locations |
||||
$result = mysql_query("SELECT location_id, location_name FROM location WHERE location_name LIKE '$needle' OR location_info LIKE '%$needle%' ORDER BY location_name") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("counter", $i+1); |
||||
$tp->set("item_name", $lang['lang_locations']); |
||||
$tp->set("item", "location"); |
||||
$tp->set("id", $row->location_id); |
||||
$tp->set("name", $row->location_name); |
||||
$resultcounter++; |
||||
$tp->parse("row"); |
||||
} |
||||
if (($i>0) ? $tp->parse("location") : $tp->hide("location")); |
||||
$tp->clear("row"); |
||||
|
||||
// look for dns1 |
||||
$result = mysql_query("SELECT node_id, dns1 FROM node WHERE dns1 LIKE '$needle' ORDER BY dns1"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>DNS name(s):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . $row->dns1 . '</a></td></tr>'; |
||||
// search node |
||||
$result = mysql_query("SELECT node_id, ip FROM node WHERE ip LIKE '$needle' OR mac LIKE '$needle' OR dns1 LIKE '$needle' OR dns2 LIKE '$needle' OR node_info LIKE '$needle' ORDER BY ip") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("counter", $i+1); |
||||
$tp->set("item_name", $lang['lang_nodes']); |
||||
$tp->set("item", "node"); |
||||
$tp->set("id", $row->node_id); |
||||
$tp->set("name", $row->ip); |
||||
$resultcounter++; |
||||
$tp->parse("row"); |
||||
} |
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node")); |
||||
$tp->clear("row"); |
||||
|
||||
// look for dns2 |
||||
$result = mysql_query("SELECT node_id, dns2 FROM node WHERE dns2 LIKE '$needle' ORDER BY dns2"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>DNS alias(es):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="nodeview.php?node_id=' . $row->node_id . '">' . $row->dns2 . '</a></td></tr>'; |
||||
// search subnet |
||||
$result = mysql_query("SELECT subnet_id, subnet_address FROM subnet WHERE subnet_address LIKE '$needle' OR subnet_info LIKE '%$needle%' ORDER BY INET_ATON(subnet_address)") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("counter", $i+1); |
||||
$tp->set("item_name", $lang['lang_subnets']); |
||||
$tp->set("item", "subnet"); |
||||
$tp->set("id", $row->subnet_id); |
||||
$tp->set("name", $row->subnet_address); |
||||
$resultcounter++; |
||||
$tp->parse("row"); |
||||
} |
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet")); |
||||
$tp->clear("row"); |
||||
|
||||
// look for subnet |
||||
$result = mysql_query("SELECT subnet_id, subnet_address FROM subnet WHERE subnet_address LIKE '$needle' OR subnet_info LIKE '%$needle%' ORDER BY INET_ATON(subnet_address)"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>Subnet(s):</b></td></tr>'; |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="subnetview.php?subnet_id=' . $row->subnet_id . '">' . $row->subnet_address . '</a></td></tr>'; |
||||
// search vlan |
||||
$result = mysql_query("SELECT vlan_id, vlan_name FROM vlan WHERE vlan_name LIKE '$needle' OR vlan_info LIKE '%$needle%' ORDER BY vlan_name") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("counter", $i+1); |
||||
$tp->set("item_name", $lang['lang_vlans']); |
||||
$tp->set("item", "vlan"); |
||||
$tp->set("id", $row->vlan_id); |
||||
$tp->set("name", $row->vlan_name); |
||||
$resultcounter++; |
||||
$tp->parse("row"); |
||||
} |
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan")); |
||||
$tp->clear("row"); |
||||
|
||||
// look for vlan |
||||
$result = mysql_query("SELECT vlan_id, vlan_name FROM vlan WHERE vlan_name LIKE '$needle' OR vlan_info LIKE '%$needle%' ORDER BY vlan_name"); |
||||
if (mysql_num_rows($result)>0) { |
||||
echo '<tr><td><b>VLAN(s):</b></td></tr>'; |
||||
$tp->set("resultcounter", $resultcounter); |
||||
$tp->parse("resultcount"); |
||||
} |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="vlanview.php?vlan_id=' . $row->vlan_id . '">' . $row->vlan_name . '</a></td></tr>'; |
||||
$resultcounter++; |
||||
} |
||||
|
||||
echo '<tr><td> </td></tr>'; |
||||
echo '<tr><td>Results found: ' . $resultcounter . '</td></tr>'; |
||||
|
||||
echo '</table>'; |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,419 @@ |
||||
<?php |
||||
session_start(); |
||||
|
||||
// check for user_id, if unnkown -> login |
||||
if(empty($_SESSION['suser_id'])) { |
||||
header("Location: login.php"); |
||||
exit; |
||||
} |
||||
|
||||
// includes |
||||
include("config.php"); |
||||
include("dbconnect.php"); |
||||
include("functions.php"); |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
// check for action |
||||
if (isset($_POST['add'])) { |
||||
switch ($_POST['add']) { |
||||
case ("asset") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assetadd) { |
||||
// get variables |
||||
$asset_name = $_POST['asset_name']; |
||||
$hostname = $_POST['hostname']; |
||||
$assetclass_id = $_POST['assetclass_id']; |
||||
$asset_info = $_POST['asset_info']; |
||||
|
||||
// update db |
||||
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(); |
||||
|
||||
// redirect |
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
break; |
||||
case ("assetclass") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assetclassadd) { |
||||
// get variables |
||||
$assetclass_name = $_POST['assetclass_name']; |
||||
$assetclassgroup_id = $_POST['assetclassgroup_id']; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO assetclass (assetclass_name, assetclassgroup_id) VALUE ('$assetclass_name', '$assetclassgroup_id')") or die(mysql_error()); |
||||
$assetclass_id = mysql_insert_id(); |
||||
|
||||
// redirect |
||||
header_location("assetclassview.php?assetclass_id=" . $assetclass_id); |
||||
} |
||||
break; |
||||
case ("assigniptoasset") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assigniptoasset) { |
||||
// get variables |
||||
$ip = $_POST['ip']; |
||||
$subnet_id = $_POST['subnet_id']; |
||||
$asset_id = $_POST['asset_id']; |
||||
$mac = strip_mac($_POST['mac']); |
||||
if ((!empty($_POST['dns1']) && isset($_POST['dns1suffix'])) ? $dns1 = $_POST['dns1'] . $config_dns1suffix : $dns1 = $_POST['dns1']); |
||||
if ((!empty($_POST['dns2']) && isset($_POST['dns2suffix'])) ? $dns2 = $_POST['dns2'] . $config_dns2suffix : $dns2 = $_POST['dns2']); |
||||
$node_info = $_POST['node_info']; |
||||
|
||||
// update db |
||||
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()); |
||||
|
||||
// redirect |
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
break; |
||||
case ("assignlocationtosubnet") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assignlocationtosubnet) { |
||||
// get variables |
||||
$location_id = $_POST['location_id']; |
||||
$subnet_id = $_POST['subnet_id']; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO subnetlocation (location_id, subnet_id) VALUE ('$location_id', '$subnet_id')") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("Location: location.php"); |
||||
} |
||||
break; |
||||
case ("assignvlantosubnet") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assignvlantosubnet) { |
||||
// get variables |
||||
$vlan_id = $_POST['vlan_id']; |
||||
$subnet_id = $_POST['subnet_id']; |
||||
|
||||
// update db |
||||
mysql_query("UPDATE subnet SET vlan_id='$vlan_id' WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("vlanview.php?vlan_id=" . $vlan_id); |
||||
} |
||||
break; |
||||
case ("location") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_locationadd) { |
||||
// get variables |
||||
$location_name = $_POST['location_name']; |
||||
$parent = $_POST['parent']; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO location (location_name, parent) VALUE ('$location_name', '$parent')") or die(mysql_error()); |
||||
$location_id = mysql_insert_id(); |
||||
|
||||
// redirect |
||||
header_location("locationview.php?location_id=" . $location_id); |
||||
} |
||||
break; |
||||
case ("node") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_nodeadd) { |
||||
$result = mysql_query("SELECT * FROM node WHERE ip='$ip'") or die(mysql_error()); |
||||
if (mysql_num_rows($result) == 0) { |
||||
// get variables |
||||
$asset_name = $_POST['asset_name']; |
||||
$hostname = $_POST['hostname']; |
||||
$assetclass_id = $_POST['assetclass_id']; |
||||
$ip = $_POST['ip']; |
||||
$mac = strip_mac($_POST['mac']); |
||||
if ((!empty($_POST['dns1']) && isset($_POST['dns1suffix'])) ? $dns1 = $_POST['dns1'] . $config_dns1suffix : $dns1 = $_POST['dns1']); |
||||
if ((!empty($_POST['dns2']) && isset($_POST['dns2suffix'])) ? $dns2 = $_POST['dns2'] . $config_dns2suffix : $dns2 = $_POST['dns2']); |
||||
$subnet_id = $_POST['subnet_id']; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO asset (asset_name, hostname, assetclass_id) VALUE ('$asset_name', '$hostname', '$assetclass_id')") or die(mysql_error()); |
||||
$asset_id = mysql_insert_id(); |
||||
mysql_query("INSERT INTO node (ip, mac, dns1, dns2, subnet_id, asset_id) VALUE ('$ip', '$mac', '$dns1', '$dns2', '$subnet_id', '$asset_id')") or die(mysql_error()); |
||||
$node_id = mysql_insert_id(); |
||||
|
||||
// redirect |
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
// display error |
||||
$error = "ipinuse"; |
||||
} |
||||
break; |
||||
case ("subnet") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_subnetadd) { |
||||
// get variables |
||||
$subnet_address= $_POST['subnet_address']; |
||||
$subnet_mask = $_POST['subnet_mask']; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO subnet (subnet_address, subnet_mask) VALUE ('$subnet_address', '$subnet_mask')") or die(mysql_error()); |
||||
$subnet_id = mysql_insert_id(); |
||||
|
||||
// redirect |
||||
header_location("subnetview.php?subnet_id=" . $subnet_id); |
||||
} |
||||
break; |
||||
case ("user") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_useradd) { |
||||
// check for unique username |
||||
$result = mysql_query("SELECT user_name FROM user WHERE user_name='$user_name'") or die(mysql_error()); |
||||
if(mysql_num_rows($result) == 0) { |
||||
// get variables |
||||
$user_name = $_POST['user_name']; |
||||
$user_pass = md5($config_user_pass); |
||||
$user_level = $_POST['user_level']; |
||||
$displayname = $_POST['user_name']; |
||||
$user_lang = $config_user_lang; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO user (user_name, user_pass, user_level, user_displayname, user_lang) VALUE ('$user_name', '$user_pass', '$user_level', '$displayname', '$user_lang')") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("options.php"); |
||||
} |
||||
// display error |
||||
$error = "usernameinuse"; |
||||
} |
||||
break; |
||||
case ("vlan") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_vlanadd) { |
||||
// get variables |
||||
$vlan_name = $_POST['vlan_name']; |
||||
$vlan_number= $_POST['vlan_number']; |
||||
|
||||
// update db |
||||
mysql_query("INSERT INTO vlan (vlan_name, vlan_number) VALUE ('$vlan_name', '$vlan_number')") or die(mysql_error()); |
||||
$vlan_id = mysql_insert_id(); |
||||
|
||||
// redirect |
||||
header_location("vlan.php?vlan_id=" . $vlan_id); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (isset($_POST['edit'])) { |
||||
switch ($_POST['edit']) { |
||||
case ("asset") : |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assetedit) { |
||||
// get variables |
||||
$asset_id = $_POST['asset_id']; |
||||
$asset_name = $_POST['asset_name']; |
||||
$hostname = $_POST['hostname']; |
||||
$assetclass_id = $_POST['assetclass_id']; |
||||
$asset_info = $_POST['asset_info']; |
||||
|
||||
// update db |
||||
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()) or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
break; |
||||
case ("assetclass") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assetclassedit) { |
||||
// get variables |
||||
$assetclass_id = $_POST['assetclass_id']; |
||||
$assetclass_name = $_POST['assetclass_name']; |
||||
$assetclassgroup_id = $_POST['assetclassgroup_id']; |
||||
|
||||
// update db |
||||
mysql_query("UPDATE assetclass SET assetclass_name='$assetclass_name', assetclassgroup_id='$assetclassgroup_id' WHERE assetclass_id='$assetclass_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("assetclassview.php?assetclass_id=" . $assetclass_id); |
||||
} |
||||
break; |
||||
case ("node") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_nodeedit) { |
||||
// get variables |
||||
$node_id = $_POST['node_id']; |
||||
$subnet_id = $_POST['subnet_id']; |
||||
$mac = strip_mac($_POST['mac']); |
||||
$dns1 = $_POST['dns1']; |
||||
$dns2 = $_POST['dns2']; |
||||
$node_info = $_POST['node_info']; |
||||
|
||||
// update db |
||||
mysql_query("UPDATE node SET subnet_id='$subnet_id', mac='$mac', dns1='$dns1', dns2='$dns2', node_info='$node_info' WHERE node_id='$node_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("nodeview.php?node_id=" . $node_id); |
||||
} |
||||
break; |
||||
case ("subnet") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_subnetedit) { |
||||
// get variables |
||||
$subnet_id = $_POST['subnet_id']; |
||||
$subnet_address= $_POST['subnet_address']; |
||||
$subnet_mask = $_POST['subnet_mask']; |
||||
$vlan_id = $_POST['vlan_id']; |
||||
$subnet_info = $_POST['subnet_info']; |
||||
|
||||
// update db |
||||
mysql_query("UPDATE subnet SET subnet_address='$subnet_address', subnet_mask='$subnet_mask', vlan_id='$vlan_id', subnet_info='$subnet_info' WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("subnetview.php?subnet_id=" . $subnet_id); |
||||
} |
||||
break; |
||||
case ("user") : |
||||
// get variables |
||||
$user_displayname = $_POST['user_displayname']; |
||||
$user_mac = $_POST['user_mac']; |
||||
$user_lang = $_POST['user_lang']; |
||||
|
||||
//update db |
||||
mysql_query("UPDATE user SET user_displayname='$user_displayname', user_mac='$user_mac', user_lang='$user_lang' WHERE user_id='$suser_id'") or die(mysql_error()); |
||||
|
||||
// update session |
||||
$_SESSION['suser_displayname'] = $user_displayname; |
||||
$_SESSION['suser_mac'] = $user_mac; |
||||
$_SESSION['suser_lang'] = $user_lang; |
||||
|
||||
// redirect |
||||
header_location("options.php"); |
||||
break; |
||||
case ("userpass") : |
||||
// check variables |
||||
if (trim($_POST['user_passold']) <> "" && trim($_POST['user_passnew1']) && trim($_POST['user_passnew2']) && trim($_POST['user_passnew1']) == trim($_POST['user_passnew2'])) { |
||||
// get variables |
||||
$user_passold = $_POST['user_passold']; |
||||
$user_passnew = md5($_POST['user_passnew1']); |
||||
|
||||
// get current pass |
||||
$result = mysql_query("SELECT user_pass FROM user WHERE user_id='$suser_id'") or die(mysql_error()); |
||||
// check current pass |
||||
if(!strcmp(md5($user_passold), mysql_result($result, 0, "user_pass"))) { |
||||
// update db |
||||
mysql_query("UPDATE user SET user_pass='$user_passnew' WHERE user_id='$suser_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("options.php"); |
||||
} |
||||
} |
||||
|
||||
// display error |
||||
echo '<b>Error!</b>'; |
||||
break; |
||||
case ("vlan") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_vlanedit) { |
||||
// get variables |
||||
$vlan_id = $_POST['vlan_id']; |
||||
$vlan_name = $_POST['vlan_name']; |
||||
$vlan_number = $_POST['vlan_number']; |
||||
$vlan_info = $_POST['vlan_info']; |
||||
|
||||
// update db |
||||
mysql_query("UPDATE vlan SET vlan_name='$vlan_name', vlan_number='$vlan_number', vlan_info='$vlan_info' WHERE vlan_id='$vlan_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("vlanview.php?vlan_id=" . $vlan_id); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (isset($_POST['del'])) { |
||||
switch ($_POST['del']) { |
||||
case ("asset") : |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assetdel) { |
||||
// get variables |
||||
$asset_id = $_POST['asset_id']; |
||||
|
||||
// update db |
||||
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()); |
||||
|
||||
// redirect |
||||
header_location("asset.php"); |
||||
} |
||||
break; |
||||
case ("assetclass") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assetclassdel) { |
||||
// get variables |
||||
$assetclass_id = $_POST['assetclass_id']; |
||||
|
||||
// update db |
||||
mysql_query("DELETE FROM assetclass WHERE assetclass_id='$assetclass_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("assetclass.php"); |
||||
} |
||||
break; |
||||
case ("location") : |
||||
if($_SESSION['suser_level'] >= $config_userlevel_locationdel) { |
||||
// get variables |
||||
$location_id = $_POST['location_id']; |
||||
|
||||
$result = mysql_query("SELECT location_id FROM location WHERE parent='$location_id'") or die(mysql_error()); |
||||
if (mysql_num_rows($result) == 0) { |
||||
// update db |
||||
mysql_query("DELETE FROM location WHERE location_id='$location_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("location.php"); |
||||
} |
||||
// display error |
||||
$error = "locationisparent"; |
||||
} |
||||
break; |
||||
case ("node") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_nodedel) { |
||||
// get variables |
||||
$node_id = $_POST['node_id']; |
||||
$asset_id = $_POST['asset_id']; |
||||
|
||||
// update db |
||||
mysql_query("DELETE FROM node WHERE node_id='$node_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("assetview.php?asset_id=" . $asset_id); |
||||
} |
||||
break; |
||||
case ("subnet") : |
||||
if($_SESSION['suser_level'] >= $config_userlevel_subnetdel) { |
||||
// get variables |
||||
$subnet_id = $_POST['subnet_id']; |
||||
|
||||
// update db |
||||
mysql_query("DELETE FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
mysql_query("DELETE FROM node WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("asset.php"); |
||||
} |
||||
break; |
||||
case ("vlan") : |
||||
// check permission |
||||
if($_SESSION['suser_level'] >= $config_userlevel_vlandel) { |
||||
// get variables |
||||
$vlan_id = $_POST['vlan_id']; |
||||
|
||||
// update db |
||||
mysql_query("DELETE FROM vlan WHERE vlan_id='$vlan_id'") or die(mysql_error()); |
||||
|
||||
// redirect |
||||
header_location("vlan.php"); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
// still not redirected, check for error |
||||
if(empty($error)) { |
||||
$error = "notallowed"; |
||||
} |
||||
|
||||
// redirect |
||||
header_location("error.php?error=" . $error); |
||||
?> |
@ -1,23 +1,25 @@ |
||||
<?php |
||||
include("header.php"); |
||||
?> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Subnet:</b><br> |
||||
</td> |
||||
</tr> |
||||
// set template |
||||
$tp = new Template("tpl/subnet.tpl"); |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="subnetview.php?subnet_id=' . $row->subnet_id . '">' . $row->subnet_address . '/' . $row->subnet_mask . '</a></td></tr>'; |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get subnet info |
||||
$result = mysql_query("SELECT subnet_id, subnet_address, subnet_mask FROM subnet ORDER BY INET_ATON(subnet_address)") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("subnet_id", $row->subnet_id); |
||||
$tp->set("subnet_address", $row->subnet_address); |
||||
$tp->set("subnet_mask", $row->subnet_mask); |
||||
$tp->parse("subnetrow"); |
||||
} |
||||
?> |
||||
if (($i>0) ? $tp->parse("subnet") : $tp->hide("subnet")); |
||||
|
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<?php |
||||
include("footer.php"); |
||||
?> |
@ -1,54 +1,15 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
// set template |
||||
$tp = new Template("tpl/subnetadd.tpl"); |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$subnet_address= $_POST['subnet_address']; |
||||
$subnet_mask = $_POST['subnet_mask']; |
||||
mysql_query("INSERT INTO subnet (subnet_address, subnet_mask) VALUE ('$subnet_address', '$subnet_mask')") or die(mysql_error()); |
||||
$subnet_id = mysql_insert_id(); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
header_location("subnetview.php?subnet_id=" . $subnet_id); |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="subnetadd.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add new subnet:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet Address: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_address"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet Mask: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_mask" size="2"> (16-30) |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,34 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get id |
||||
$subnet_id = $_GET['subnet_id']; |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/subnetdel.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get subnet info |
||||
$result = mysql_query("SELECT subnet_address, subnet_mask FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
$row=mysql_fetch_object($result); |
||||
$tp->set("subnet_id", $subnet_id); |
||||
$tp->set("subnet_address", $row->subnet_address); |
||||
$tp->set("subnet_mask", $row->subnet_mask); |
||||
|
||||
// get node info |
||||
$result = mysql_query("SELECT node_id, ip, mac, dns1, dns2, node_info FROM node WHERE subnet_id='$subnet_id' ORDER BY INET_ATON(ip)") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("node_id", $row->node_id); |
||||
$tp->set("ip", $row->ip); |
||||
$tp->parse("noderow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("node") : $tp->hide("node")); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,100 +1,39 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$subnet_id = $_POST['subnet_id']; |
||||
$subnet_address= $_POST['subnet_address']; |
||||
$subnet_mask = $_POST['subnet_mask']; |
||||
$vlan_id = $_POST['vlan_id']; |
||||
$subnet_info = $_POST['subnet_info']; |
||||
|
||||
mysql_query("UPDATE subnet SET subnet_address='$subnet_address', subnet_mask='$subnet_mask', vlan_id='$vlan_id', subnet_info='$subnet_info' WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
|
||||
header_location("subnetview.php?subnet_id=" . $subnet_id); |
||||
} |
||||
|
||||
// get id |
||||
$subnet_id = $_GET['subnet_id']; |
||||
|
||||
// get current information |
||||
$result = mysql_query("SELECT subnet_address, subnet_mask, vlan_id, subnet_info FROM subnet WHERE subnet_id='$subnet_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$subnet_address = $row->subnet_address; |
||||
$subnet_mask = $row->subnet_mask; |
||||
$vlan_id = $row->vlan_id; |
||||
$subnet_info = $row->subnet_info; |
||||
} |
||||
?> |
||||
// set template |
||||
$tp = new Template("tpl/subnetedit.tpl"); |
||||
|
||||
<form method="POST" action="subnetedit.php"> |
||||
<input type="hidden" name="subnet_id" value="<?php echo $subnet_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Edit subnet:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet Address: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_address" value="<?php echo $subnet_address; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet Mask: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_mask" size="2" value="<?php echo $subnet_mask; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLAN |
||||
</td> |
||||
<td> |
||||
<select name="vlan_id"> |
||||
<option value="0">(none)</option> |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan ORDER BY vlan_number"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
if ($row->vlan_id==$vlan_id) { |
||||
$selected = 'selected'; |
||||
} else { |
||||
$selected = ''; |
||||
} |
||||
echo '<option value="' . $row->vlan_id . '" ' . $selected . '>' . $row->vlan_name . ' ('. $row->vlan_number . ')</option>'; |
||||
// get subnet information |
||||
$result = mysql_query("SELECT subnet_address, subnet_mask, vlan_id, subnet_info FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
$row = mysql_fetch_object($result); |
||||
$vlan_id = $row->vlan_id; |
||||
$tp->set("subnet_id", $subnet_id); |
||||
$tp->set("subnet_address", $row->subnet_address); |
||||
$tp->set("subnet_mask", $row->subnet_mask); |
||||
$tp->set("vlan_id", $vlan_id); |
||||
$tp->set("subnet_info", $row->subnet_info); |
||||
|
||||
// get vlan info |
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan ORDER BY vlan_number") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
if (($row->vlan_id==$vlan_id) ? $tp->set("selected", "selected") : $tp->set("selected", "")); |
||||
$tp->set("vlan_id", $row->vlan_id); |
||||
$tp->set("vlan_name", $row->vlan_name); |
||||
$tp->set("vlan_number", $row->vlan_number); |
||||
$tp->parse("vlanrow"); |
||||
} |
||||
?> |
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan")); |
||||
|
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Subnet info: |
||||
</td> |
||||
<td> |
||||
<textarea name="subnet_info"><?php echo $subnet_info; ?></textarea>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,229 +1,216 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get id |
||||
$subnet_id = $_GET['subnet_id']; |
||||
|
||||
// get page |
||||
if(isset($_GET['page'])) { |
||||
$page = $_GET['page']; |
||||
} else { |
||||
$page = 0; |
||||
} |
||||
?> |
||||
|
||||
<script language="javascript"> |
||||
function linkTo(optVal){ |
||||
if(optVal=="") |
||||
return false; |
||||
window.location='subnetview.php?subnet_id='+optVal; |
||||
} |
||||
</script> |
||||
<script type="text/javascript"> |
||||
function change(id,newtext) { |
||||
document.getElementById(id).innerHTML=newtext |
||||
} |
||||
</script> |
||||
// set template |
||||
$tp = new Template("tpl/subnetview.tpl"); |
||||
|
||||
<?php |
||||
// get all info |
||||
$result = mysql_query("SELECT subnet_address, subnet_mask, vlan_id, subnet_info FROM subnet WHERE subnet_id='$subnet_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get subnet info |
||||
$result = mysql_query("SELECT subnet_address, subnet_mask, vlan_id, subnet_info FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error()); |
||||
$row = mysql_fetch_object($result); |
||||
$tp->set("subnet_id", $subnet_id); |
||||
$tp->set("subnet_address", $row->subnet_address); |
||||
$tp->set("subnet_mask", $row->subnet_mask); |
||||
$tp->set("subnet_info", nl2br($row->subnet_info)); |
||||
|
||||
// set needed variables |
||||
$subnet_address = $row->subnet_address; |
||||
$subnet_mask = $row->subnet_mask; |
||||
$vlan_id = $row->vlan_id; |
||||
$subnet_info = $row->subnet_info; |
||||
} |
||||
|
||||
// determine current range |
||||
// split up the range |
||||
$iprange = explode('.', $subnet_address); |
||||
$iprange1 = $iprange[0]; |
||||
$iprange2 = $iprange[1]; |
||||
$iprange3 = $iprange[2]; |
||||
$iprange4 = $iprange[3]; |
||||
|
||||
// calculate no. of hosts |
||||
// create array for these addresses |
||||
$subnet = array(); |
||||
if ($subnet_mask>=24) { |
||||
// Class C |
||||
// calculate hosts |
||||
$hostcount = pow(2,(32-$subnet_mask)); |
||||
|
||||
// is there a need for pagination? |
||||
if ($hostcount>256) { |
||||
$maxdisplayedip = 256; |
||||
// fill array with addresses we want to see |
||||
for($i=0;$i<$hostcount;$i++) { |
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i); |
||||
$subnet[$ip] = array(); |
||||
} |
||||
|
||||
// calculate broadcast address and create pagination |
||||
if ($hostcount>65536) { |
||||
// class A subnet |
||||
echo 'Class A subnets (>65536 nodes) are not supported'; |
||||
exit; |
||||
} else { |
||||
// class B subnet |
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . ($hostcount/256-1) . '.255'; |
||||
// calculate broadcast address |
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$i-1); |
||||
|
||||
$pagination = 'Page: <select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">'; |
||||
for ($i=0;$i<($hostcount/256);$i++) { |
||||
if ($i==$page) { |
||||
$selected = ' selected'; |
||||
} else { |
||||
$selected = ''; |
||||
// no pagination needed |
||||
$tp->set("pagination", ' '); |
||||
} else if ($subnet_mask>=16) { |
||||
// Class B |
||||
// which part do we want to see? |
||||
if((empty($page)) ? $page=$subnet_address : $page=$page); |
||||
$page = explode('.', $page); |
||||
$page2 = $page[2]; |
||||
|
||||
// fill array with addresses we want to see |
||||
for($i=0;$i<256;$i++) { |
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . $page2 . '.' . $i; |
||||
$subnet[$ip] = array(); |
||||
} |
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $i . '"' . $selected . '>' . $iprange1 . '.' . $iprange2 . '.' . ($i) . '.0</option>'; |
||||
|
||||
// calculate broadcast address |
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . ($iprange3+$i-1) . '.255'; |
||||
|
||||
// create pagination |
||||
$pagination = 'Page: ' . $iprange1 . '.' . $iprange2 . '. '; |
||||
$pagination .= '<select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">'; |
||||
for($i=$iprange3;$i<(pow(2,(32-$subnet_mask))/256);$i++) { |
||||
if(($i==$page2) ? $selected='selected' : $selected=''); |
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $iprange1 . '.' . $iprange2 . '.' . $i . '.0"' . $selected . '>' . $i . '.0</option>'; |
||||
} |
||||
$pagination .= '</select>'; |
||||
} |
||||
$tp->set("pagination", $pagination); |
||||
} else { |
||||
// // class C subnet so no pagination needed, set static variables |
||||
$pagination = ' '; |
||||
$page = 0; |
||||
$maxdisplayedip = $hostcount; |
||||
$broadcast_address = $iprange1 . '.' . $iprange2 . '.' . $iprange3 . '.' . ($iprange4+$hostcount-1); |
||||
// Class A |
||||
// which part do we want to see? |
||||
if((empty($page)) ? $page=$subnet_address : $page=$page); |
||||
$page = explode('.', $page); |
||||
$page2 = $page[1]; |
||||
$page3 = $page[2]; |
||||
|
||||
// fill array with addresses we want to see |
||||
for($i=0;$i<256;$i++) { |
||||
$ip = $iprange1 . '.' . $page2 . '.' . $page3 . '.' . $i; |
||||
$subnet[$ip] = array(); |
||||
} |
||||
|
||||
// calculate broadcast address |
||||
$broadcast_address = $iprange1 . '.' . ($iprange+$i-1) . '.255.255'; |
||||
|
||||
// create pagination |
||||
$pagination = 'Page: '; |
||||
// selectbox 1 |
||||
$pagination .= '<select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">'; |
||||
for($i=$iprange2;$i<(pow(2,(24-$subnet_mask))/256);$i++) { |
||||
if(($i==$page2) ? $selected='selected' : $selected=''); |
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $iprange1 . '.' . $i . '.' . $page3 . '.0"' . $selected . '>' . $iprange1 . '.' . $i . '</option>'; |
||||
} |
||||
$pagination .= '</select><select name="pagination" onchange="linkTo(this.options[this.selectedIndex].value);">'; |
||||
// selectbox 2 |
||||
for($i=0;$i<256;$i++) { |
||||
if(($i==$page3) ? $selected='selected' : $selected=''); |
||||
$pagination .= '<option value="' . $subnet_id . '&page=' . $iprange1 . '.' . $page2 . '.' . $i . '.0"' . $selected . '>' . $i . '.0</option>'; |
||||
} |
||||
$pagination .= '</select>'; |
||||
$tp->set("pagination", $pagination); |
||||
} |
||||
?> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="32"> |
||||
<b>Subnet: </b><?php echo $subnet_address . '/'. $subnet_mask; ?> |
||||
</td> |
||||
<td colspan="32" align="right"> |
||||
<?php echo $pagination; ?> |
||||
</td> |
||||
</tr> |
||||
// get nodes for this subnet and implement the values into the array |
||||
$result = mysql_query("SELECT a.asset_name, acg.color, n.node_id, n.ip FROM asset a, assetclass ac, assetclassgroup acg, node n WHERE n.ip IN ('".implode("','",array_keys($subnet))."') AND n.subnet_id='$subnet_id' AND a.asset_id=n.asset_id AND ac.assetclass_id=a.assetclass_id AND acg.assetclassgroup_id=ac.assetclassgroup_id") or die(mysql_error()); |
||||
while ($row = mysql_fetch_array($result)) { |
||||
$subnet[$row['ip']] = $row; |
||||
} |
||||
|
||||
<?php |
||||
echo '<tr>'; |
||||
// replace subnet address (if in array) |
||||
if(array_key_exists($subnet_address, $subnet)) { |
||||
$subnet[$subnet_address]=array("subnet_address"); |
||||
} |
||||
|
||||
for ($i=1;$i<=$maxdisplayedip;$i++) { |
||||
// build current ip |
||||
$ip = $iprange1 . '.' . $iprange2 . '.' . ($iprange3+$page) . '.' . ($i+$iprange4-1); |
||||
// replace broadcast address (if in array) |
||||
if(array_key_exists($broadcast_address, $subnet)) { |
||||
$subnet[$broadcast_address]=array("broadcast_address"); |
||||
} |
||||
|
||||
// disable subnet_address and broadcast_address |
||||
if ($ip==$subnet_address) { |
||||
echo '<td><img src="images/cross.jpg" onMouseOver="change(\'remotetext\',\'' . $ip . ' (Subnet address)\')" onMouseOut="change(\'remotetext\',\' \')"></td>'; |
||||
} else if ($ip==$broadcast_address) { |
||||
echo '<td><img src="images/cross.jpg" onMouseOver="change(\'remotetext\',\'' . $ip . ' (Broadcast address)\')" onMouseOut="change(\'remotetext\',\' \')"></td>'; |
||||
// loop array and send to template |
||||
$i=1; |
||||
foreach($subnet as $ip => $node) { |
||||
if(($i%64==0) ? $tr="</tr><tr>" : $tr=""); |
||||
if(empty($node)) { |
||||
$tp->set("url", 'assigniptonode.php?subnet_id=' . $subnet_id . '&ip='. $ip); |
||||
$tp->set("remotetext", $ip); |
||||
$tp->set("color", 'grey'); |
||||
} else if ($node[0]=="subnet_address") { |
||||
$tp->set("url", ""); |
||||
$tp->set("remotetext", $ip . ' ' . $lang['lang_subnet_subnetaddress']); |
||||
$tp->set("color", 'cross'); |
||||
} else if ($node[0]=="broadcast_address") { |
||||
$tp->set("url", ""); |
||||
$tp->set("remotetext", $ip . ' ' . $lang['lang_subnet_broadcastaddress']); |
||||
$tp->set("color", 'cross'); |
||||
} else { |
||||
// check for current ip address |
||||
$result = mysql_query("SELECT a.asset_name, acg.color, n.node_id FROM asset a, assetclass ac, assetclassgroup acg, node n WHERE n.ip='$ip' AND a.asset_id=n.asset_id AND ac.assetclass_id=a.assetclass_id AND acg.assetclassgroup_id=ac.assetclassgroup_id"); |
||||
if (mysql_num_rows($result)==0) { |
||||
// ip not in use |
||||
echo '<td><a href="assigniptonode.php?ip='. $ip . '&subnet_id=' . $subnet_id . '"><img src="images/grey.jpg" border="0" onMouseOver="change(\'remotetext\',\'' . $ip . '\')" onMouseOut="change(\'remotetext\',\' \')"></a></td>'; |
||||
} else { |
||||
// ip in use |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$node_id = $row->node_id; |
||||
echo '<td><a href="nodeview.php?node_id=' . $node_id . '"><img src="images/' . $row->color . '.jpg" border="0" onMouseOver="change(\'remotetext\',\'' . $ip . ' ' . $row->asset_name . '\')" onMouseOut="change(\'remotetext\',\' \')"></a></td>'; |
||||
} |
||||
$tp->set("url", 'nodeview.php?node_id=' . $node['node_id']); |
||||
$tp->set("remotetext", $ip . ' ' . $node['asset_name']); |
||||
$tp->set("color", $node['color']); |
||||
} |
||||
$tp->set("tr", $tr); |
||||
$tp->parse("iprow"); |
||||
$i++; |
||||
} |
||||
$tp->parse("subnet"); |
||||
|
||||
if ($i%64==0) { |
||||
echo '</tr><tr>'; |
||||
} |
||||
} |
||||
?> |
||||
<tr> |
||||
<td colspan="64"> |
||||
<a id="remotetext"> </a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>VLAN(s):</b> |
||||
</td> |
||||
<td> |
||||
|
||||
<?php |
||||
// search vlan(s) for this subnet |
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan WHERE vlan_id='$vlan_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<a href="vlanview.php?vlan_id=' . $row->vlan_id . '">' . $row->vlan_name . ' ('. $row->vlan_number . ')</a>'; |
||||
} |
||||
?> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>Location(s):</b> |
||||
</td> |
||||
<td> |
||||
|
||||
<?php |
||||
// search location(s) for this subnet |
||||
$result = mysql_query("SELECT l.location_id FROM location l INNER JOIN subnetlocation sl ON l.location_id=sl.location_id WHERE sl.subnet_id='$subnet_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo location_name($row->location_id, '') . '<br>'; |
||||
} |
||||
?> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>Subnet info:</b> |
||||
</td> |
||||
<td> |
||||
<?php echo nl2br($subnet_info); ?> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
<td width="100"> |
||||
|
||||
</td> |
||||
<td> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<img src="images/grey.jpg"> Unassigned |
||||
</td> |
||||
</tr> |
||||
</tr> |
||||
<?php |
||||
// display assetclass(es) |
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name, color FROM assetclassgroup ORDER BY assetclassgroup_id"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><img src="images/' . $row->color . '.jpg"> <a href="assetclassgroupview.php?assetclassgroup_id=' . $row->assetclassgroup_id . '">' . $row->assetclassgroup_name . '</a></td></tr>'; |
||||
} |
||||
?> |
||||
</table> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
// get vlan info |
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan WHERE vlan_id='$vlan_id'") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("vlan_id", $row->vlan_id); |
||||
$tp->set("vlan_name", $row->vlan_name); |
||||
$tp->parse("vlanrow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("vlan") : $tp->hide("vlan")); |
||||
|
||||
<?php |
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
?> |
||||
// get location info |
||||
$result = mysql_query("SELECT l.location_id, l.location_name FROM location l INNER JOIN subnetlocation sl ON l.location_id=sl.location_id WHERE sl.subnet_id='$subnet_id'") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("location_id", $row->location_id); |
||||
$tp->set("location_name", $row->location_name); |
||||
$tp->parse("locationrow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("location") : $tp->hide("location")); |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="subnetedit.php?subnet_id=<?php echo $subnet_id; ?>">Modify subnet</a>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="assignsubnettolocation.php?subnet_id=<?php echo $subnet_id; ?>">Assign location</a>
|
||||
</td> |
||||
</tr> |
||||
// get assetclass info |
||||
$result = mysql_query("SELECT assetclassgroup_id, assetclassgroup_name, color FROM assetclassgroup ORDER BY assetclassgroup_id") or die(mysql_error()); |
||||
for ($i=0;$row=mysql_fetch_object($result);$i++) { |
||||
$tp->set("assetclassgroup_id", $row->assetclassgroup_id); |
||||
$tp->set("assetclassgroup_name", $row->assetclassgroup_name); |
||||
$tp->set("color", $row->color); |
||||
$tp->parse("assetclassgrouprow"); |
||||
} |
||||
if (($i>0) ? $tp->parse("assetclassgroup") : $tp->hide("assetclassgroup")); |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
// display options |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assignlocationtosubnet) { |
||||
$tp->parse("assignlocationtosubnet"); |
||||
} else { |
||||
$tp->hide("assignlocationtosubnet"); |
||||
} |
||||
if($_SESSION['suser_level'] >= $config_userlevel_assignvlantosubnet) { |
||||
$tp->set("vlan_id", $vlan_id); |
||||
$tp->parse("assignvlantosubnet"); |
||||
} else { |
||||
$tp->hide("assignvlantosubnet"); |
||||
} |
||||
if($_SESSION['suser_level'] >= $config_userlevel_subnetedit) { |
||||
$tp->parse("subnetedit"); |
||||
} else { |
||||
$tp->hide("subnetedit"); |
||||
} |
||||
if($_SESSION['suser_level'] >= $config_userlevel_subnetdel) { |
||||
$tp->parse("subnetdel"); |
||||
} else { |
||||
$tp->hide("subnetdel"); |
||||
} |
||||
?> |
||||
|
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"><a href="nodelist.php?subnet_id=<?php echo $subnet_id; ?>">View assigned IP addresses in subnet</a>
|
||||
</td> |
||||
</tr> |
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<?php |
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,16 @@ |
||||
[BLOCK table AS asset] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_asset}:</b><br> |
||||
</td> |
||||
</tr> |
||||
[BLOCK assetrow] |
||||
<tr> |
||||
<td> |
||||
<a href="assetview.php?asset_id={asset_id}">{asset_name}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetrow] |
||||
</table> |
||||
[END table] |
@ -0,0 +1,53 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="asset"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_asset_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_asset_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="asset_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_hostname}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="hostname"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS assetclass] |
||||
<tr> |
||||
<td> |
||||
{lang_assetclass}: |
||||
</td> |
||||
<td> |
||||
<select name="assetclass_id"> |
||||
[BLOCK assetclassrow] |
||||
<option value="{assetclass_id}">{assetclass_name}</option> |
||||
[END assetclassrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td> |
||||
{lang_asset_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="asset_info"></textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,16 @@ |
||||
[BLOCK table AS assetclass] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assetclass}:</b><br> |
||||
</td> |
||||
</tr> |
||||
[BLOCK assetclassrow] |
||||
<tr> |
||||
<td> |
||||
<a href="assetclassview.php?assetclass_id={assetclass_id}">{assetclass_name}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassrow] |
||||
</table> |
||||
[END table] |
@ -0,0 +1,37 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="assetclass"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_assetclass_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_assetclass_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="assetclass_name"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS assetclassgroup] |
||||
<tr> |
||||
<td> |
||||
{lang_assetclassgroup}:<br> |
||||
</td> |
||||
<td> |
||||
<select name="assetclassgroup_id"> |
||||
[BLOCK assetclassgrouprow] |
||||
<option value="{assetclassgroup_id}">{assetclassgroup_name}</option> |
||||
[END assetclassgrouprow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,34 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="del" value="assetclass"> |
||||
<input type="hidden" name="assetclass_id" value="{assetclass_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assetclass_del}</b><br> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assetclass_name}:</b> |
||||
</td> |
||||
<td> |
||||
{assetclass_name} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,38 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="assetclass"> |
||||
<input type="hidden" name="assetclass_id" value="{assetclass_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_assetclass_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_assetclass_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="assetclass_name" value="{assetclass_name}"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS assetclassgroup] |
||||
<tr> |
||||
<td> |
||||
{lang_assetclassgroup}:<br> |
||||
</td> |
||||
<td> |
||||
<select name="assetclassgroup_id"> |
||||
[BLOCK assetclassgrouprow] |
||||
<option value="{assetclassgroup_id}" {selected}>{assetclassgroup_name}</option> |
||||
[END assetclassgrouprow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,49 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>Assetclass Groupname:</b> |
||||
</td> |
||||
<td> |
||||
{assetclassgroup_name} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>Color:</b> |
||||
</td> |
||||
<td> |
||||
<img src="images/{color}.jpg"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>Assetclass(es):</b> |
||||
</td> |
||||
[BLOCK table AS assetclass] |
||||
<td> |
||||
[BLOCK assetclassrow] |
||||
<a href="assetclassview.php?assetclass_id={assetclass_id}">{assetclass_name}</a><br> |
||||
[END assetclassrow] |
||||
</td> |
||||
[END table] |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assetclassgroupedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetclassgroupedit.php?assetclassgroup_id={assetclassgroup_id}">{lang_assetclassgroup_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassgroupedit] |
||||
[BLOCK assetclassgroupdel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetclassgroupdel.php?assetclassgroup_id={assetclassgroup_id}">{lang_assetclassgroup_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassgroupdel] |
||||
</table> |
@ -0,0 +1,49 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assetclass_name}:</b> |
||||
</td> |
||||
<td> |
||||
{assetclass_name} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assetclassgroup_name}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="assetclassgroupview.php?assetclassgroup_id={assetclassgroup_id}">{assetclassgroup_name}</a> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS asset] |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assets}:</b><br> |
||||
</td> |
||||
<td> |
||||
[BLOCK assetrow] |
||||
<a href="assetview.php?asset_id={asset_id}">{asset_name}</a><br> |
||||
[END assetrow] |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assetclassedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetclassedit.php?assetclass_id={assetclass_id}">{lang_assetclass_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassedit] |
||||
[BLOCK assetclassdel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetclassdel.php?assetclass_id={assetclass_id}">{lang_assetclass_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassdel] |
||||
</table> |
@ -0,0 +1,51 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="del" value="asset"> |
||||
<input type="hidden" name="asset_id" value="{asset_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_asset_del}</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_asset_name}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="assetview.php?asset_id={asset_id}">{asset_name}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
[BLOCK table AS node] |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<img src="images/warning.gif"> {lang_warning_asset_del_nodes} |
||||
</td> |
||||
</tr> |
||||
[BLOCK noderow] |
||||
<tr> |
||||
<td> |
||||
<b>{lang_ip}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="nodeview.php?node_id={node_id}">{ip}</a> |
||||
</td> |
||||
</tr> |
||||
[END noderow] |
||||
</table> |
||||
[END table] |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,54 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="asset"> |
||||
<input type="hidden" name="asset_id" value="{asset_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_asset_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_asset_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="asset_name" value="{asset_name}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_hostname}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="hostname" value="{hostname}"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS assetclass] |
||||
<tr> |
||||
<td> |
||||
{lang_assetclass}: |
||||
</td> |
||||
<td> |
||||
<select name="assetclass_id"> |
||||
[BLOCK assetclassrow] |
||||
<option value="{assetclass_id}" {selected}>{assetclass_name}</option> |
||||
[END assetclassrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td> |
||||
{lang_asset_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="asset_info">{asset_info}</textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,118 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_asset_name}:</b> |
||||
</td> |
||||
<td> |
||||
{asset_name} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_hostname}:</b> |
||||
</td> |
||||
<td> |
||||
{hostname} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_assetclass}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="assetclassview.php?assetclass_id={assetclass_id}">{assetclass_name}</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_asset_info}:</b> |
||||
</td> |
||||
<td> |
||||
{asset_info} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
[BLOCK table AS node] |
||||
<table border="0"> |
||||
[BLOCK noderow] |
||||
<tr> |
||||
<td> |
||||
|
||||
</td> |
||||
<td> |
||||
<b>{lang_node} #{nodecount}</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_ip}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="nodeview.php?node_id={node_id}">{ip}</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="subnetview.php?subnet_id={subnet_id}&page={ip}">{subnet_address}/{subnet_mask}</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_mac}:</b> |
||||
</td> |
||||
<td> |
||||
{mac} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_dns1}:</b> |
||||
</td> |
||||
<td> |
||||
{dns1} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_dns2}:</b> |
||||
</td> |
||||
<td> |
||||
{dns2} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_node_info}:</b> |
||||
</td> |
||||
<td> |
||||
{node_info} |
||||
</td> |
||||
</tr> |
||||
[END noderow] |
||||
</table> |
||||
[END table] |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assetedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetedit.php?asset_id={asset_id}">{lang_asset_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetedit] |
||||
[BLOCK assetdel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetdel.php?asset_id={asset_id}">{lang_asset_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetdel] |
||||
</table> |
@ -0,0 +1,89 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="assigniptoasset"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_assigniptoasset}:</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_ip}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="ip" value="{ip}"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS subnet] |
||||
<tr> |
||||
<td> |
||||
{lang_subnet}: |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
[BLOCK subnetrow] |
||||
<option value="{subnet_id}" {selected}>{subnet_address}/{subnet_mask}</option> |
||||
[END subnetrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
[BLOCK table AS asset] |
||||
<tr> |
||||
<td> |
||||
{lang_asset_name}: |
||||
</td> |
||||
<td> |
||||
<select name="asset_id"> |
||||
[BLOCK assetrow] |
||||
<option value="{asset_id}">{asset_name}</option> |
||||
[END assetrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td> |
||||
{lang_mac}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="mac"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_dns1}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns1"> |
||||
</td> |
||||
<td> |
||||
<input type="checkbox" name="dns1suffix" checked>{config_dns1suffix} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_dns2}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns2"> |
||||
</td> |
||||
<td> |
||||
<input type="checkbox" name="dns2suffix" checked>{config_dns2suffix} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_node_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="node_info"></textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,38 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_ip}:</b> |
||||
</td> |
||||
<td> |
||||
{ip} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="subnetview.php?subnet_id={subnet_id}&page={ip}">{subnet_address}/{subnet_mask}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assigniptonode] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assigniptoasset.php?subnet_id={subnet_id}&ip={ip}">{lang_assigniptoasset}</a> |
||||
</td> |
||||
</tr> |
||||
[END assigniptonode] |
||||
[BLOCK nodeadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="nodeadd.php?subnet_id={subnet_id}&ip={ip}">{lang_node_new}</a> |
||||
</td> |
||||
</tr> |
||||
[END nodeadd] |
||||
</table> |
||||
|
@ -0,0 +1,44 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="assignlocationtosubnet"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_assignlocationtosubnet}:</b> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS location] |
||||
<tr> |
||||
<td> |
||||
{lang_location_name}: |
||||
</td> |
||||
<td> |
||||
<select name="location_id"> |
||||
<option value="0">(none)</option> |
||||
[BLOCK locationrow] |
||||
<option value="{location_id}" {selected}>{location_name}</option> |
||||
[END locationrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
[BLOCK table AS subnet] |
||||
<tr> |
||||
<td> |
||||
{lang_subnet}: |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
[BLOCK subnetrow] |
||||
<option value="{subnet_id}" {selected}>{subnet_address}/{subnet_mask}</option> |
||||
[END subnetrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,43 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="assignvlantosubnet"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_assignvlantosubnet}:</b><br> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS vlan] |
||||
<tr> |
||||
<td> |
||||
{lang_vlan}: |
||||
</td> |
||||
<td> |
||||
<select name="vlan_id"> |
||||
[BLOCK vlanrow] |
||||
<option value="{vlan_id}" {selected}>{vlan_name} ({vlan_id})</option> |
||||
[END vlanrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
[BLOCK table AS subnet] |
||||
<tr> |
||||
<td> |
||||
{lang_subnet}: |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
[BLOCK subnetrow] |
||||
<option value="{subnet_id}" {selected}>{subnet_address}/{subnet_mask}</option> |
||||
[END subnetrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,12 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<img src="images/warning.gif"> <b>{lang_error}:</b> {error}<br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<a href="javascript:history.back();"><< {lang_goback}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
@ -0,0 +1,13 @@ |
||||
|
||||
<hr> |
||||
|
||||
<table border="0" width="100%"> |
||||
<tr> |
||||
<td align="center"> |
||||
<a href="index.php" class="label">IP Reg {config_version}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,31 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
||||
<html> |
||||
<head> |
||||
<title>IP Reg</title> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
||||
<link rel="stylesheet" href="tpl/style.css" type="text/css"> |
||||
</head> |
||||
|
||||
<body> |
||||
<form method="POST" action="search.php"> |
||||
<table border="0" width="100%"> |
||||
<tr> |
||||
<td> |
||||
{lang_header_viewby}: <a href="asset.php">{lang_asset}</a> - |
||||
<a href="assetclass.php">{lang_assetclass}</a> - |
||||
<a href="location.php">{lang_location}</a> - |
||||
<a href="subnet.php">{lang_subnet}</a> - |
||||
<a href="vlan.php">{lang_vlan}</a> |
||||
.:<input type="text" name="search" value="{search}"> <input type="submit" value="{lang_search}"> |
||||
</td> |
||||
<td align="right"> |
||||
{suser_displayname} - |
||||
<a href="options.php">{lang_options}</a> - |
||||
<a href="logout.php">{lang_logout}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<hr> |
||||
|
@ -0,0 +1,57 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>IP Reg</b><br> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_statistics}:</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td width="100"> |
||||
{lang_assets}: |
||||
</td> |
||||
<td align="right"> |
||||
{assetcount} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_locations}: |
||||
</td> |
||||
<td align="right"> |
||||
{locationcount} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_nodes}: |
||||
</td> |
||||
<td align="right"> |
||||
{nodecount} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_subnets}: |
||||
</td> |
||||
<td align="right"> |
||||
{subnetcount} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlans}: |
||||
</td> |
||||
<td align="right"> |
||||
{vlancount} |
||||
</td> |
||||
</tr> |
||||
</table> |
@ -0,0 +1,16 @@ |
||||
[BLOCK table AS location] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_locations}:</b><br> |
||||
</td> |
||||
</tr> |
||||
[BLOCK locationrow] |
||||
<tr> |
||||
<td> |
||||
{nbsp}<a href="locationview.php?location_id={location_id}">{location_name}</a> |
||||
</td> |
||||
</tr> |
||||
[END locationrow] |
||||
</table> |
||||
[END table] |
@ -0,0 +1,38 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="location"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_location_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_location_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="location_name"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS location] |
||||
<tr> |
||||
<td> |
||||
{lang_location_parent}: |
||||
</td> |
||||
<td> |
||||
<select name="parent"> |
||||
<option value="0">(none)</option> |
||||
[BLOCK locationrow] |
||||
<option value="{location_id}">{location_name}</option> |
||||
[END locationrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,29 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="del" value="location"> |
||||
<input type="hidden" name="location_id" value="{location_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_location_del}</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_location_name}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="locationview.php?location_id={location_id}">{location_name}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,47 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="location"> |
||||
<input type="hidden" name="location_id" value="{location_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_location_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_location_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="location_name" value="{location_name}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_location_parent}: |
||||
</td> |
||||
<td> |
||||
[BLOCK table AS parent] |
||||
<select name="parent"> |
||||
<option value="0">(none)</option> |
||||
[BLOCK parentrow] |
||||
<option value="{parent_id}" {selected}>{parent_name}</option> |
||||
[END parentrow] |
||||
</select> |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_location_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="location_info">{location_info}</textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,73 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_location_name}:</b> |
||||
</td> |
||||
<td> |
||||
[BLOCK table AS locationcrumb] |
||||
[BLOCK locationcrumbrow] |
||||
{seperator}<a href="locationview.php?location_id={location_id}">{location_name}</a> |
||||
[END locationcrumbrow] |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_location_info}:</b> |
||||
</td> |
||||
<td> |
||||
{location_info} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnets}:</b> |
||||
</td> |
||||
[BLOCK table AS subnet] |
||||
<td> |
||||
[BLOCK subnetrow] |
||||
<a href="subnetview.php?subnet_id={subnet_id}">{subnet_address}/{subnet_mask}</a><br> |
||||
[END subnetrow] |
||||
</td> |
||||
[END table] |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_sublocations}:</b> |
||||
</td> |
||||
[BLOCK table AS sublocation] |
||||
<td> |
||||
[BLOCK sublocationrow] |
||||
<a href="locationview.php?location_id={sublocation_id}">{sublocation_name}</a><br> |
||||
[END sublocationrow] |
||||
</td> |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assignlocationtosubnet] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assignlocationtosubnet.php?location_id={location_id}">{lang_assignlocationtosubnet}</a> |
||||
</td> |
||||
</tr> |
||||
[END assignlocationtosubnet] |
||||
[BLOCK locationedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="locationedit.php?location_id={location_id}">{lang_location_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END locationedit] |
||||
[BLOCK locationdel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="locationdel.php?location_id={location_id}">{lang_location_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END locationdel] |
||||
</table> |
@ -0,0 +1,91 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="node"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_node_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_asset_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="asset_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_hostname}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="hostname"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_ip}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="ip" value="{ip}"> |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS subnet] |
||||
<tr> |
||||
<td> |
||||
{lang_subnet}: |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
[BLOCK subnetrow] |
||||
<option value="{subnet_id}" {selected}>{subnet_address}/{subnet_mask}</option> |
||||
[END subnetrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
[BLOCK table AS assetclass] |
||||
<tr> |
||||
<td> |
||||
{lang_assetclass}: |
||||
</td> |
||||
<td> |
||||
<select name="assetclass_id"> |
||||
[BLOCK assetclassrow] |
||||
<option value="{assetclass_id}">{assetclass_name}</option> |
||||
[END assetclassrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td> |
||||
{lang_mac}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="mac"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_dns1}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns1"> <input type="checkbox" name="dns1suffix" checked>{config_dns1suffix} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_dns2}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns2"> <input type="checkbox" name="dns2suffix" checked>{config_dns2suffix} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,30 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="del" value="node"> |
||||
<input type="hidden" name="node_id" value="{node_id}"> |
||||
<input type="hidden" name="asset_id" value="{asset_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_node_del}</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_ip}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="nodeview.php?node_id={node_id}">{ip}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,78 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="node"> |
||||
<input type="hidden" name="node_id" value="{node_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_node_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_asset_name}: |
||||
</td> |
||||
<td> |
||||
{asset_name}: |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_ip} |
||||
</td> |
||||
<td> |
||||
{ip} |
||||
</td> |
||||
</tr> |
||||
[BLOCK table AS subnet] |
||||
<tr> |
||||
<td> |
||||
{lang_subnet}: |
||||
</td> |
||||
<td> |
||||
<select name="subnet_id"> |
||||
[BLOCK subnetrow] |
||||
<option value="{subnet_id}" {selected}>{subnet_address}/{subnet_mask}</option> |
||||
[END subnetrow] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
[END table] |
||||
<tr> |
||||
<td> |
||||
{lang_mac}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="mac" value="{mac}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_dns1}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns1" value="{dns1}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_dns2}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="dns2" value="{dns2}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_node_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="node_info">{node_info}</textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,46 @@ |
||||
[BLOCK table AS node] |
||||
<table border="0"> |
||||
<tr> |
||||
<td width="100"> |
||||
<a href="nodelist.php?subnet_id={subnet_id}&order=ip"><b>{lang_ip}:</b></a> |
||||
</td> |
||||
<td width="150"> |
||||
<a href="nodelist.php?subnet_id={subnet_id}&order=asset_name"><b>{lang_asset_name}:</b></a> |
||||
</td> |
||||
<td width="150"> |
||||
<a href="nodelist.php?subnet_id={subnet_id}&order=hostname"><b>{lang_hostname}:</b></a> |
||||
</td> |
||||
<td width="150"> |
||||
<a href="nodelist.php?subnet_id={subnet_id}&order=mac"><b>{lang_mac}:</b></a> |
||||
</td> |
||||
<td width="150"> |
||||
<a href="nodelist.php?subnet_id={subnet_id}&order=dns1"><b>{lang_dns1}:</b></a> |
||||
</td> |
||||
<td width="150"> |
||||
<a href="nodelist.php?subnet_id={subnet_id}&order=dns2"><b>{lang_dns2}:</b></a> |
||||
</td> |
||||
</tr> |
||||
[BLOCK noderow] |
||||
<tr> |
||||
<td> |
||||
<a href="nodeview.php?node_id={node_id}">{ip}</a> |
||||
</td> |
||||
<td> |
||||
<a href="assetview.php?asset_id={asset_id}">{asset_name}</a> |
||||
</td> |
||||
<td> |
||||
{hostname} |
||||
</td> |
||||
<td> |
||||
{mac} |
||||
</td> |
||||
<td> |
||||
{dns1} |
||||
</td> |
||||
<td> |
||||
{dns2} |
||||
</td> |
||||
</tr> |
||||
[END noderow] |
||||
</table> |
||||
[END table] |
@ -0,0 +1,87 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_ip}:</b> |
||||
</td> |
||||
<td> |
||||
{ip} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="subnetview.php?subnet_id={subnet_id}&page={ip}">{subnet_address}/{subnet_mask}</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_asset_name}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="assetview.php?asset_id={asset_id}">{asset_name}</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_mac}:</b> |
||||
</td> |
||||
<td> |
||||
{mac} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_dns1}:</b> |
||||
</td> |
||||
<td> |
||||
{dns1} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_dns2}:</b> |
||||
</td> |
||||
<td> |
||||
{dns2} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_node_info}:</b> |
||||
</td> |
||||
<td> |
||||
{node_info} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK nodeedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="nodeedit.php?node_id={node_id}">{lang_node_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END nodeedit] |
||||
[BLOCK nodedel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="nodedel.php?node_id={node_id}">{lang_node_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END nodedel] |
||||
</table> |
@ -0,0 +1,102 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_options_ipreg}</b> |
||||
</td> |
||||
</tr> |
||||
[BLOCK assetadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetadd.php">{lang_asset_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetadd] |
||||
[BLOCK assetclassadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assetclassadd.php">{lang_assetclass_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassadd] |
||||
[BLOCK locationadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="locationadd.php">{lang_location_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END locationadd] |
||||
[BLOCK nodeadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="nodeadd.php">{lang_node_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END nodeadd] |
||||
[BLOCK subnetadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="subnetadd.php">{lang_subnet_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END subnetadd] |
||||
[BLOCK useradd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="useradd.php">{lang_user_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END useradd] |
||||
[BLOCK vlanadd] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="vlanadd.php">{lang_vlan_add}</a> |
||||
</td> |
||||
</tr> |
||||
[END vlanadd] |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assigniptoasset] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assigniptoasset.php">{lang_assigniptoasset}</a> |
||||
</td> |
||||
</tr> |
||||
[END assigniptoasset] |
||||
[BLOCK assignlocationtosubnet] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assignlocationtosubnet.php">{lang_assignlocationtosubnet}</a> |
||||
</td> |
||||
</tr> |
||||
[END assignlocationtosubnet] |
||||
[BLOCK assignvlantosubnet] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assignvlantosubnet.php">{lang_assignvlantosubnet}</a> |
||||
</td> |
||||
</tr> |
||||
[END assignvlantosubnet] |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_options_personal}</b> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="useredit.php">{lang_options_settings_edit}</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="userpassedit.php">{lang_options_password_edit}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
@ -0,0 +1,41 @@ |
||||
[BLOCK nosearch] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<img src="images/warning.gif"> {lang_warning_search_nosearch} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
[END nosearch] |
||||
|
||||
[BLOCK table AS asset] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{item_name} {lang_search_found} ({counter}):</b> |
||||
</td> |
||||
</tr> |
||||
[BLOCK row] |
||||
<tr> |
||||
<td> |
||||
<a href="{item}view.php?{item}_id={id}">{name}</a> |
||||
</td> |
||||
</tr> |
||||
[END row] |
||||
</table> |
||||
[END table] |
||||
|
||||
[REUSE table AS location] |
||||
[REUSE table AS node] |
||||
[REUSE table AS subnet] |
||||
[REUSE table AS vlan] |
||||
|
||||
[BLOCK resultcount] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_search_results_found}</b>: {resultcounter} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
[END resultcount] |
@ -0,0 +1,39 @@ |
||||
body { |
||||
background-color: #FFFFFF; |
||||
color: #000000; |
||||
font-family: Verdana, Arial, Helvetica, Sans-serif; |
||||
margin: 12px; |
||||
margin-top: 12px; |
||||
font-size: 70%; |
||||
} |
||||
|
||||
a { |
||||
color: #466A8D; |
||||
} |
||||
|
||||
a:hover { |
||||
color: #E1B100; |
||||
} |
||||
|
||||
input { |
||||
font-size: 100%; |
||||
position: relative; |
||||
top: -2px; |
||||
font-family: Verdana, Arial, Helvetica, Sans-serif; |
||||
} |
||||
|
||||
select { |
||||
font-size: 100%; |
||||
font-family: Verdana, Sans-serif; |
||||
position: relative; |
||||
top: -2px; |
||||
} |
||||
|
||||
table { |
||||
font-size: 100%; |
||||
} |
||||
|
||||
td { |
||||
vertical-align: top; |
||||
height: 18px; |
||||
} |
@ -0,0 +1,16 @@ |
||||
[BLOCK table AS subnet] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet}:</b><br> |
||||
</td> |
||||
</tr> |
||||
[BLOCK subnetrow] |
||||
<tr> |
||||
<td> |
||||
<a href="subnetview.php?subnet_id={subnet_id}">{subnet_address}/{subnet_mask}</a> |
||||
</td> |
||||
</tr> |
||||
[END subnetrow] |
||||
</table> |
||||
[END table] |
@ -0,0 +1,31 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="subnet"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_subnet_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_subnet_address}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_address"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_subnet_mask}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_mask" size="2"> (8-30) |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_subnet}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,51 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="del" value="subnet"> |
||||
<input type="hidden" name="subnet_id" value="{subnet_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet_del}</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="subnetview.php?subnet_id={subnet_id}">{subnet_address}/{subnet_mask}</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
[BLOCK table AS node] |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<img src="images/warning.gif"> {lang_warning_asset_del_nodes} |
||||
</td> |
||||
</tr> |
||||
[BLOCK noderow] |
||||
<tr> |
||||
<td> |
||||
<b>{lang_ip}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="nodeview.php?node_id={node_id}">{ip}</a> |
||||
</td> |
||||
</tr> |
||||
[END noderow] |
||||
</table> |
||||
[END table] |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,55 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="subnet"> |
||||
<input type="hidden" name="subnet_id" value="{subnet_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_subnet_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_subnet_subnetaddress}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_address" value="{subnet_address}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_subnet_mask}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="subnet_mask" size="2" value="{subnet_mask}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlan} |
||||
</td> |
||||
<td> |
||||
[BLOCK table AS vlan] |
||||
<select name="vlan_id"> |
||||
<option value="0">(none)</option> |
||||
[BLOCK vlanrow] |
||||
<option value="{vlan_id}" {selected}>{vlan_name} ({vlan_number})</option> |
||||
[END vlanrow] |
||||
[END table] |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_subnet_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="subnet_info">{subnet_info}</textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,153 @@ |
||||
<script language="javascript"> |
||||
function linkTo(optVal){ |
||||
if(optVal=="") |
||||
return false; |
||||
window.location='subnetview.php?subnet_id='+optVal; |
||||
} |
||||
</script> |
||||
<script type="text/javascript"> |
||||
function change(id,newtext) { |
||||
document.getElementById(id).innerHTML=newtext |
||||
} |
||||
</script> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<table border="0" width="100%"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet}: </b>{subnet_address}/{subnet_mask} |
||||
</td> |
||||
<td align="right"> |
||||
{pagination} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
[BLOCK table AS subnet] |
||||
<table border="0"> |
||||
<tr> |
||||
[BLOCK iprow] |
||||
<td><a href="{url}" onMouseOver="change('remotetext','{remotetext}')" onMouseOut="change('remotetext',' ')"><img src="images/{color}.jpg" border="0"></a></td>{tr} |
||||
[END iprow] |
||||
</tr> |
||||
</table> |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<a id="remotetext"> </a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlans}:</b> |
||||
</td> |
||||
<td> |
||||
[BLOCK table AS vlan] |
||||
[BLOCK vlanrow] |
||||
<a href="vlanview.php?vlan_id={vlan_id}">{vlan_name}</a><br> |
||||
[END vlanrow] |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_locations}:</b> |
||||
</td> |
||||
<td> |
||||
[BLOCK table AS location] |
||||
[BLOCK locationrow] |
||||
<a href="locationview.php?location_id={location_id}">{location_name}</a><br> |
||||
[END locationrow] |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnet_info}:</b> |
||||
</td> |
||||
<td> |
||||
{subnet_info} |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</td> |
||||
<td width="100"> |
||||
|
||||
</td> |
||||
<td> |
||||
[BLOCK table AS assetclassgroup] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<img src="images/grey.jpg"> {lang_unassigned} |
||||
</td> |
||||
</tr> |
||||
[BLOCK assetclassgrouprow] |
||||
<tr> |
||||
<td> |
||||
<img src="images/{color}.jpg"> <a href="assetclassgroupview.php?assetclassgroup_id={assetclassgroup_id}">{assetclassgroup_name}</a> |
||||
</td> |
||||
</tr> |
||||
[END assetclassgrouprow] |
||||
</table> |
||||
[END table] |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assignlocationtosubnet] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assignlocationtosubnet.php?subnet_id={subnet_id}">{lang_assignlocationtosubnet}</a> |
||||
</td> |
||||
</tr> |
||||
[END assignlocationtosubnet] |
||||
[BLOCK assignvlantosubnet] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assignvlantosubnet.php?vlan_id={vlan_id}">{lang_assignvlantosubnet}</a> |
||||
</td> |
||||
</tr> |
||||
[END assignvlantosubnet] |
||||
[BLOCK subnetedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="subnetedit.php?subnet_id={subnet_id}">{lang_subnet_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END subnetedit] |
||||
[BLOCK subnetdel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="subnetdel.php?subnet_id={subnet_id}">{lang_subnet_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END subnetdel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="nodelist.php?subnet_id={subnet_id}">View assigned IP addresses in subnet</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
@ -0,0 +1,41 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="user"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_user_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="user_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_pass}: |
||||
</td> |
||||
<td> |
||||
{user_pass} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_level}: |
||||
</td> |
||||
<td> |
||||
<select name="user_level"> |
||||
<option value="1">1</option> |
||||
<option value="2">2</option> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,46 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="user"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_options_settings_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_displayname}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="user_displayname" value="{user_displayname}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_mac}: |
||||
</td> |
||||
<td> |
||||
<select name="user_mac"> |
||||
<option value="0">xxxxxxxxxxxx</option> |
||||
<option value="1">xx-xx-xx-xx-xx-xx</option> |
||||
<option value="2">xx:xx:xx:xx:xx:xx</option> |
||||
<option value="3">xxxxxx-xxxxxx</option> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_language}: |
||||
</td> |
||||
<td> |
||||
<select name="user_lang"> |
||||
<option value="en">English</option> |
||||
</select> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,39 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="userpass"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_options_password_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_passold}: |
||||
</td> |
||||
<td> |
||||
<input type="password" name="user_passold"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_passnew1}: |
||||
</td> |
||||
<td> |
||||
<input type="password" name="user_passnew1"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_user_passnew2}: |
||||
</td> |
||||
<td> |
||||
<input type="password" name="user_passnew2"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,16 @@ |
||||
[BLOCK table AS vlan] |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlan}:</b><br> |
||||
</td> |
||||
</tr> |
||||
[BLOCK vlanrow] |
||||
<tr> |
||||
<td> |
||||
<a href="vlanview.php?vlan_id={vlan_id}">{vlan_name} ({vlan_number})</a> |
||||
</td> |
||||
</tr> |
||||
[END vlanrow] |
||||
</table> |
||||
[END table] |
@ -0,0 +1,31 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="add" value="vlan"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_vlan_add}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlan_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlan_number}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_number" size="3"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,29 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="del" value="vlan"> |
||||
<input type="hidden" name="vlan_id" value="{vlan_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlan_del}</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlan_name}:</b> |
||||
</td> |
||||
<td> |
||||
<a href="vlanview.php?vlan_id={vlan_id}">{vlan_name} ({vlan_number})</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,40 @@ |
||||
<form method="POST" action="submit.php"> |
||||
<input type="hidden" name="edit" value="vlan"> |
||||
<input type="hidden" name="vlan_id" value="{vlan_id}"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>{lang_vlan_edit}:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlan_name}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_name" value="{vlan_name}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlan_number}: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_number" size="3" value="{vlan_number}"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
{lang_vlan_info}: |
||||
</td> |
||||
<td> |
||||
<textarea name="vlan_info">{vlan_info}</textarea> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="{lang_submit}"><input type="reset" value="{lang_reset}"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
@ -0,0 +1,64 @@ |
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlan_name}:</b> |
||||
</td> |
||||
<td> |
||||
{vlan_name} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlan_number}:</b> |
||||
</td> |
||||
<td> |
||||
{vlan_number} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_vlan_info}:</b> |
||||
</td> |
||||
<td> |
||||
{vlan_info} |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
<b>{lang_subnets}:</b> |
||||
</td> |
||||
[BLOCK table AS subnet] |
||||
<td> |
||||
[BLOCK subnetrow] |
||||
<a href="subnetview.php?subnet_id={subnet_id}">{subnet_address}/{subnet_mask}</a><br> |
||||
[END subnetrow] |
||||
</td> |
||||
[END table] |
||||
</tr> |
||||
</table> |
||||
|
||||
<p> |
||||
|
||||
<table border="0"> |
||||
[BLOCK assignvlantosubnet] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="assignvlantosubnet.php?vlan_id={vlan_id}">{lang_assignvlantosubnet}</a> |
||||
</td> |
||||
</tr> |
||||
[END assignvlantosubnet] |
||||
[BLOCK vlanedit] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="vlanedit.php?vlan_id={vlan_id}">{lang_vlan_edit}</a> |
||||
</td> |
||||
</tr> |
||||
[END vlanedit] |
||||
[BLOCK vlandel] |
||||
<tr> |
||||
<td> |
||||
<img src="images/arrow.gif" border="0"> <a href="vlandel.php?vlan_id={vlan_id}">{lang_vlan_del}</a> |
||||
</td> |
||||
</tr> |
||||
[END vlandel] |
||||
</table> |
@ -1,70 +1,17 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
// set template |
||||
$tp = new Template("tpl/useradd.tpl"); |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
// check for unique username |
||||
$result = mysql_query("SELECT user_name FROM user WHERE user_name='$user_name'") or die(mysql_error()); |
||||
if(mysql_num_rows($result) == 0) { |
||||
$user_name = $_POST['user_name']; |
||||
$user_pass = md5($config_user_pass); |
||||
$user_level = $_POST['user_level']; |
||||
$displayname = $_POST['user_name']; |
||||
mysql_query("INSERT INTO user (user_name, user_pass, user_level, displayname) VALUE ('$user_name', '$user_pass', '$user_level', '$displayname')") or die(mysql_error()); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
header_location("options.php"); |
||||
} |
||||
echo '<b>Error!</b>'; |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="useradd.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add user:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Username: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="user_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Password: |
||||
</td> |
||||
<td> |
||||
<?php echo $config_user_pass; ?> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Level: |
||||
</td> |
||||
<td> |
||||
<select name="user_level"> |
||||
<option value="1">View all</option> |
||||
<option value="2">Edit all</option> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
$tp->set("user_pass", $config_user_pass); |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,75 +1,15 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get user_id |
||||
$suser_id = $_SESSION['suser_id']; |
||||
// set template |
||||
$tp = new Template("tpl/userpassedit.tpl"); |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
if (trim($_POST['user_passold']) <> "" && trim($_POST['user_passnew1']) && trim($_POST['user_passnew2']) && trim($_POST['user_passnew1']) == trim($_POST['user_passnew2'])) { |
||||
$user_passold = $_POST['user_passold']; |
||||
$user_passnew = md5($_POST['user_passnew1']); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
$result = mysql_query("SELECT user_pass FROM user WHERE user_id='$suser_id'") or die(mysql_error()); |
||||
// check current pass |
||||
if(!strcmp(md5($user_passold), mysql_result($result, 0, "user_pass"))) { |
||||
// ok, update pass |
||||
mysql_query("UPDATE user SET user_pass='$user_passnew' WHERE user_id='$suser_id'") or die(mysql_error()); |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
header_location("options.php"); |
||||
} |
||||
} |
||||
|
||||
// not ok |
||||
echo '<b>Error!</b>'; |
||||
} |
||||
|
||||
// get current information |
||||
$result = mysql_query("SELECT displayname FROM user WHERE user_id='$suser_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$displayname = $row->displayname; |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="userpassedit.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Modify settings:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Current password: |
||||
</td> |
||||
<td> |
||||
<input type="password" name="user_passold"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
New password: |
||||
</td> |
||||
<td> |
||||
<input type="password" name="user_passnew1"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
Retype new password: |
||||
</td> |
||||
<td> |
||||
<input type="password" name="user_passnew2"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<? |
||||
include("footer.php"); |
||||
?> |
@ -1,23 +1,25 @@ |
||||
<?php |
||||
include("header.php"); |
||||
?> |
||||
|
||||
<table border="0"> |
||||
<tr> |
||||
<td> |
||||
<b>VLAN:</b><br> |
||||
</td> |
||||
</tr> |
||||
// set template |
||||
$tp = new Template("tpl/vlan.tpl"); |
||||
|
||||
<?php |
||||
$result = mysql_query("SELECT vlan_id, vlan_number, vlan_name FROM vlan ORDER BY vlan_number"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
echo '<tr><td><a href="vlanview.php?vlan_id=' . $row->vlan_id . '">' . $row->vlan_name . ' ('. $row->vlan_number . ')</a></td></tr>'; |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// 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++) { |
||||
$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")); |
||||
|
||||
</table> |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
<?php |
||||
include("footer.php"); |
||||
?> |
@ -1,53 +1,15 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
// set template |
||||
$tp = new Template("tpl/vlanadd.tpl"); |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$vlan_name = $_POST['vlan_name']; |
||||
$vlan_number= $_POST['vlan_number']; |
||||
mysql_query("INSERT INTO vlan (vlan_name, vlan_number) VALUE ('$vlan_name', '$vlan_number')") or die(mysql_error()); |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
header("Location: vlan.php"); |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="vlanadd.php"> |
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Add new VLAN:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLAN name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_name"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLAN ID: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_number" size="3"> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,25 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// get id |
||||
$vlan_id = $_GET['vlan_id']; |
||||
|
||||
// set template |
||||
$tp = new Template("tpl/vlandel.tpl"); |
||||
|
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get vlanclass info |
||||
$result = mysql_query("SELECT vlan_id, vlan_name, vlan_number FROM vlan WHERE vlan_id='$vlan_id'") or die(mysql_error()); |
||||
$row=mysql_fetch_object($result); |
||||
$tp->set("vlan_id", $row->vlan_id); |
||||
$tp->set("vlan_name", $row->vlan_name); |
||||
$tp->set("vlan_number", $row->vlan_number); |
||||
|
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -1,72 +1,26 @@ |
||||
<?php |
||||
include("header.php"); |
||||
|
||||
// display only if admin |
||||
if($_SESSION['suser_level'] >= 2) { |
||||
// get id |
||||
$vlan_id = $_GET['vlan_id']; |
||||
|
||||
// check for submit |
||||
if ($_SERVER['REQUEST_METHOD']=="POST" ) { |
||||
$vlan_id = $_POST['vlan_id']; |
||||
$vlan_name = $_POST['vlan_name']; |
||||
$vlan_number = $_POST['vlan_number']; |
||||
$vlan_info = $_POST['vlan_info']; |
||||
mysql_query("UPDATE vlan SET vlan_name='$vlan_name', vlan_number='$vlan_number', vlan_info='$vlan_info' WHERE vlan_id='$vlan_id'") or die(mysql_error()); |
||||
// set template |
||||
$tp = new Template("tpl/vlanedit.tpl"); |
||||
|
||||
header_location("vlanview.php?vlan_id=" . $vlan_id); |
||||
} |
||||
// set language variables |
||||
$tp->setvars($lang); |
||||
|
||||
// get current information |
||||
$result = mysql_query("SELECT vlan_name, vlan_number, vlan_info FROM vlan WHERE vlan_id='$vlan_id'"); |
||||
while ($row = mysql_fetch_object($result)) { |
||||
$vlan_name = $row->vlan_name; |
||||
$vlan_number = $row->vlan_number; |
||||
$vlan_info = $row->vlan_info; |
||||
} |
||||
?> |
||||
|
||||
<form method="POST" action="vlanedit.php"> |
||||
<input type="hidden" name="vlan_id" value="<?php echo $vlan_id; ?>">
|
||||
<table border="0"> |
||||
<tr> |
||||
<td colspan="2"> |
||||
<b>Edit VLAN:</b><br> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLAN name: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_name" value="<?php echo $vlan_name; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLAN ID: |
||||
</td> |
||||
<td> |
||||
<input type="text" name="vlan_number" size="3" value="<?php echo $vlan_number; ?>">
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td> |
||||
VLAN info: |
||||
</td> |
||||
<td> |
||||
<textarea name="vlan_info"><?php echo $vlan_info; ?></textarea>
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" align="right"> |
||||
<input type="submit" value="Submit"><input type="reset" value="Reset"> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
</form> |
||||
// get vlan information |
||||
$result = mysql_query("SELECT vlan_name, vlan_number, vlan_info FROM vlan WHERE vlan_id='$vlan_id'") or die(mysql_error()); |
||||
$row = mysql_fetch_object($result); |
||||
$tp->set("vlan_id", $vlan_id); |
||||
$tp->set("vlan_name", $row->vlan_name); |
||||
$tp->set("vlan_number", $row->vlan_number); |
||||
$tp->set("vlan_info", $row->vlan_info); |
||||
|
||||
<?php |
||||
// end display only if admin |
||||
} |
||||
// output |
||||
$tp->parse(); |
||||
$tp->spit(); |
||||
|
||||
include("footer.php"); |
||||
?> |
@ -0,0 +1,483 @@ |
||||
<?php |
||||
/***************************************************************************** |
||||
$Id: yapter.php,v 1.24 2006/01/31 07:30:28 nvie Exp $ |
||||
|
||||
Yapter 2.14b2 - Yet Another PHP Template Engine ® |
||||
Copyright (C) 2001-2003 Vincent Driessen |
||||
|
||||
This library is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU Lesser General Public |
||||
License as published by the Free Software Foundation; either |
||||
version 2.1 of the License, or (at your option) any later version. |
||||
|
||||
This library 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 |
||||
Lesser General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU Lesser General Public |
||||
License along with this library; if not, write to the Free Software |
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||||
|
||||
For more information, visit http://yapter.sf.net/ or contact us at |
||||
nvie@users.sourceforge.net |
||||
The full terms of the GNU Lesser General Public License that apply to Yapter |
||||
can be found at http://yapter.sf.net/LICENSE |
||||
*****************************************************************************/ |
||||
|
||||
// Define Yapter's warning levels |
||||
define('E_YAPTER_NONE', 0); // Be completely silent |
||||
define('E_YAPTER_NOTICE', 1); // Report notices |
||||
define('E_YAPTER_WARNING', 2); // Report warnings |
||||
define('E_YAPTER_ERROR', 4); // Report errors |
||||
define('E_YAPTER_DIE_ON_ERROR', 8); // Die on errors |
||||
define('E_YAPTER_ALL', 15); // Report errors, warnings and notices |
||||
|
||||
// Define Yapter's ignore levels |
||||
define('E_YAPTER_IGN_UNKNOWN_VARS', 16); // Ignore unknown variables |
||||
define('E_YAPTER_AUTO_HIDE_BLOCK', 32); // Automaticly hide unparsed blocks |
||||
|
||||
class Template { |
||||
var $_ROOT = '__DOCUMENT_ROOT'; |
||||
var $parseUnknownVars = false; // Defines whether unknown variables should be removed or left alone |
||||
var $blox = array(); // $blox[blockname]['content'] holds the template's content |
||||
// $blox[blockname]['numlines'] holds the number of lines in the block |
||||
// $blox[blockname]['parsed'] holds an array with the parsed data |
||||
// $blox[$_ROOT] always holds the main template |
||||
var $blockDefs = array(); // Keeps track of all block-definitions from which multiple blocks... |
||||
// ...can be created instances of |
||||
|
||||
var $vars = array(); // This array contains all variables. All are accessible from all blocks. |
||||
|
||||
var $warningLevel; // The level of verbosity Yapter complies with (see the E_* defines above) |
||||
var $startTime; // Holds the start time of the script, so that it can compare it to the... |
||||
// ...end time to calculate the execution time. (For debugging purposes only.) |
||||
|
||||
var $missing_list; // List of variable names that are declared but never set. |
||||
|
||||
///////////////////////////////////////////////////////////////////// |
||||
|
||||
function error($msg) |
||||
{ |
||||
if ($this->warningLevel & E_YAPTER_ERROR) |
||||
if ($this->warningLevel & E_YAPTER_DIE_ON_ERROR ) |
||||
// if DIE_ON_ERROR is set, then do die on error! |
||||
die("<br />\n<b>Yapter error</b>: ".$msg."<br />\n"); // Die here! |
||||
else |
||||
// else just barf out the message |
||||
echo "<br />\n<b>Yapter error</b>: ".$msg."<br />\n"; |
||||
} |
||||
|
||||
function warning($msg) |
||||
{ |
||||
if ($this->warningLevel & E_YAPTER_WARNING) |
||||
echo "<br />\n<b>Yapter warning</b>: ".$msg."<br />\n"; |
||||
} |
||||
|
||||
function notice($msg) |
||||
{ |
||||
if ($this->warningLevel & E_YAPTER_NOTICE) |
||||
echo "<br />\n<b>Yapter notice</b>: ".$msg."<br />\n"; |
||||
} |
||||
|
||||
function warn_var_not_set($varname) |
||||
{ |
||||
if (!in_array($varname, $this->missing_list) && !($this->warningLevel & E_YAPTER_IGN_UNKNOWN_VARS)) { |
||||
$this->missing_list[] = $varname; // Add it to the list... |
||||
// ...and print a warning once. |
||||
$this->warning('Variable <b>'.htmlspecialchars($varname).'</b> found, but never assigned a value. (This message is shown only once for each variable.)'); |
||||
} |
||||
} |
||||
|
||||
///////////////////////////////////////////////////////////////////// |
||||
|
||||
function Template($file, $level = E_YAPTER_ALL) |
||||
{ |
||||
if (is_bool($level)) { |
||||
// |
||||
// Rationale: |
||||
// ========= |
||||
// Older Yapter versions had the possibility of turning |
||||
// on the so called "debug mode" with a bool parameter |
||||
// as the second argument to this constructor. |
||||
// However, since debug mode was dropped and the |
||||
// warning level support was built in, it was a logical |
||||
// step of replacing the second parameter. |
||||
// |
||||
// However, to prevent people from making mistakes, |
||||
// we'll check if the user passed a boolean parameter. |
||||
// If so, he or she is probably using debug mode, and |
||||
// we'll issue a notice in these cases. |
||||
// |
||||
// Thanks to Ivo Koster. |
||||
// |
||||
$this->notice('Debug mode is not supported anymore since Yapter version 2.12.'); |
||||
$this->warningLevel = E_YAPTER_ALL; |
||||
} |
||||
else |
||||
$this->warningLevel = (int)$level; |
||||
|
||||
$this->startTime = $this->getmicrotime(); |
||||
$this->addBlockFromFile($this->_ROOT, $file); |
||||
$this->missing_list = array(); |
||||
} |
||||
|
||||
/* setParseMode(): specifies to parse unknown variables or not */ |
||||
function setParseMode($parseUnknownVars) |
||||
{ |
||||
$this->parseUnknownVars = (bool)$parseUnknownVars; |
||||
} |
||||
|
||||
/* setWarningLevel(): sets the level of verbosity which Yapter should obey */ |
||||
function setWarningLevel($level) |
||||
{ |
||||
$this->warningLevel = $level; |
||||
} |
||||
|
||||
/* addBlock(): adds a new block to the blox-array */ |
||||
function addBlock($blockname, $content) |
||||
{ |
||||
$this->blox[$blockname]['content'] = $content; |
||||
$this->blox[$blockname]['numlines'] = sizeof($this->blox[$blockname]['content']); |
||||
$this->blox[$blockname]['parsed'] = ''; |
||||
$this->prepare($blockname); |
||||
} |
||||
|
||||
/* addBlockFromFile(): adds a new block, filling it with the specified's file contents */ |
||||
function addBlockFromFile($blockname, $file) |
||||
{ |
||||
$content = @file($file) or $this->error('Cannot open template file <b>'.htmlspecialchars($file).'</b>!'); |
||||
//--- eliminate double block def mod -klp |
||||
// if ($blockname != $this->_ROOT) |
||||
// $this->addBlockDef($blockname, $content); |
||||
$this->addBlock($blockname, $content); |
||||
} |
||||
|
||||
/* addBlockDef(): adds a block definition to the block-definition array from which other blocks can be copied */ |
||||
function addBlockDef($blockdef, $content) |
||||
{ |
||||
/* if (isset($this->blockDefs[$blockdef])) |
||||
$this->error('Block "'.htmlspecialchars($blockdef).'" allready exists. I cannot create it twice.'); |
||||
else |
||||
$this->blockDefs[$blockdef] = $content; |
||||
*/ |
||||
$this->blockDefs[$blockdef] = $content; |
||||
} |
||||
|
||||
/* addBlockFromDef(): copies a block from the block definition array */ |
||||
function addBlockFromDef($blockname, $blockdef) |
||||
{ |
||||
$this->addBlock($blockname, $this->blockDefs[$blockdef]); |
||||
} |
||||
|
||||
/* prepare(): handles subprocessing of templates found in the main template file */ |
||||
function prepare($blockname) |
||||
{ |
||||
$currblockcontents = array(); |
||||
$block = &$this->blox[$blockname]; |
||||
for ($i = 0; $i < $block['numlines']; $i++) { |
||||
if (isset($block['content'][$i])) |
||||
$line = $block['content'][$i]; |
||||
else |
||||
continue; |
||||
|
||||
// Try to find a tag-definition on this line |
||||
if (preg_match('/\[(INCLUDE|BLOCK|END|REUSE|SET) ([A-Za-z0-9_.\/-]+)( AS ([A-Za-z0-9_-]+))?]/', $line, $matches)) { |
||||
$type = $matches[1]; |
||||
$name = (!empty($matches[4])) ? $matches[4] : $matches[2]; |
||||
if ($type == 'END' && !isset($currblockdef)) |
||||
$this->error('"[END '.$name.']" found without matching "[BLOCK '.$name.']" or "[SET '.$name.']"'); |
||||
if ($type == 'END' && $matches[2] == $currblockdef) { |
||||
if (isset($matches[4])) |
||||
$this->error('Given "AS"-parameter not allowed in END-tags!'); |
||||
|
||||
// End the current block definition: add the block to the blox-array |
||||
//--- if wrapper mod -klp |
||||
if (isset($currblockdef) && isset($currblockcontents) && isset($currblockname)) { |
||||
$this->addBlockDef($currblockdef, $currblockcontents); |
||||
$this->addBlockFromDef($currblockname, $currblockdef); |
||||
} |
||||
|
||||
// Now, try to remove the block from the template definition, replacing it with a var |
||||
for ($j = $i; $j >= $currblockstart; $j--) { |
||||
if ($j == $currblockstart && $currblocktype == 'BLOCK') |
||||
$block['content'][$j] = "{" . $currblockname . "}"; |
||||
else |
||||
unset($block['content'][$j]); |
||||
} |
||||
|
||||
// unset these thingies for further preparing |
||||
unset($currblocktype); |
||||
unset($currblockstart); |
||||
unset($currblockname); |
||||
unset($currblockdef); |
||||
$currblockcontents = array(); |
||||
|
||||
} elseif (($type == 'SET' || $type == 'BLOCK') && !isset($currblockname)) { |
||||
|
||||
if ($type == 'BLOCK') { |
||||
|
||||
// Start block definition |
||||
$currblocktype = $type; |
||||
$currblockstart = $i; |
||||
$currblockname = $name; |
||||
$currblockdef = $matches[2]; |
||||
|
||||
} else { // SET-tag |
||||
|
||||
// Start block definition |
||||
if (isset($matches[4])) |
||||
$this->error('Given "AS"-parameter not allowed in SET-tags!'); |
||||
|
||||
$currblocktype = $type; |
||||
$currblockstart = $i; |
||||
$currblockname = $matches[2]; |
||||
$currblockdef = $matches[2]; |
||||
|
||||
} |
||||
|
||||
} elseif ($type == 'INCLUDE' && !isset($currblockname)) { |
||||
|
||||
// Make this line a variable... |
||||
$block['content'][$i] = "{" . $name . "}\n"; |
||||
|
||||
// ...and include the given file... |
||||
$this->addBlockFromFile($name, $matches[2]); |
||||
|
||||
} elseif ($type == 'REUSE' && !isset($currblockname)) { |
||||
|
||||
if (!isset($matches[4])) |
||||
$this->error('Missing "AS"-parameter in [REUSE <b>$name</b>] tag!'); |
||||
|
||||
// Make this line a variable... |
||||
$block['content'][$i] = "{" . $matches[4] . "}\n"; |
||||
|
||||
// ...and get this REUSE value from the block definition list... |
||||
$this->addBlockFromDef($matches[4], $matches[2]); |
||||
|
||||
} elseif ($currblockname != $name) { |
||||
if ($currblockname) |
||||
$currblockcontents[] = $line; |
||||
} |
||||
|
||||
} else { |
||||
// No tag-definition... just normal text so do nothing here |
||||
if (!empty($currblockname)) |
||||
$currblockcontents[] = $line; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/* parse(): parses the specified block, filling variables and nested blockdefs */ |
||||
function parse($blockname = '') |
||||
{ |
||||
if (!$blockname) |
||||
$blockname = $this->_ROOT; |
||||
if (!isset($this->blox[$blockname])) |
||||
$this->error('Block "'.htmlspecialchars($blockname).'" does not exist.'); |
||||
|
||||
$block = &$this->blox[$blockname]; |
||||
$parsed = $block['content']; |
||||
|
||||
// Loop through all the lines of the template and parse variables one-by-one |
||||
for ($i = 0; $i < $block['numlines']; $i++) { |
||||
if (!isset($parsed[$i])) |
||||
continue; |
||||
$line = $parsed[$i]; |
||||
|
||||
// Look for variables in this line, processing it character-by-character |
||||
unset($start); |
||||
unset($buffer); |
||||
for ($j = 0; $j < strlen($line); $j++) { |
||||
$char = $line[$j]; |
||||
if (!isset($start) && $char == '{') |
||||
$start = $j; |
||||
elseif (isset($start) && $char == '}') { |
||||
// The sequence {} is not a valid variable value |
||||
if (!isset($buffer)) { |
||||
unset($start); |
||||
continue; |
||||
} else { |
||||
// Gotcha! Now replace this variable with its contents |
||||
// First, check to see if it's a variable or a block that has to be parsed |
||||
if (isset($this->vars[$buffer])) |
||||
$value = $this->vars[$buffer]; |
||||
elseif (isset($this->blox[$buffer])) { |
||||
if ($this->blox[$buffer]['parsed']) { |
||||
// The value must be filled with the parsed data from the $buffer block |
||||
$value = @implode('', $this->blox[$buffer]['parsed']); |
||||
} elseif ($this->warningLevel & E_YAPTER_AUTO_HIDE_BLOCK) { |
||||
// Automaticly hide unparsed bloks |
||||
$value = ""; |
||||
} else { |
||||
// Make the recursive call now |
||||
$value = @implode('', $this->parse($buffer)); |
||||
} |
||||
} else { |
||||
// No variable or block name found by the name of $buffer |
||||
|
||||
// First, issue a warning! |
||||
$this->warn_var_not_set($buffer); |
||||
|
||||
if ($this->parseUnknownVars) { |
||||
// Unable to find variable, replace this one with an empty |
||||
// string silently. |
||||
$value = ''; |
||||
} else { |
||||
// Unable to find variable, leave this one alone... |
||||
unset($start); |
||||
unset($buffer); |
||||
continue; |
||||
} |
||||
} |
||||
$part1 = substr($line, 0, $start); |
||||
$part2 = substr($line, $start + strlen($buffer) + 2); |
||||
$line = $part1 . $value . $part2; |
||||
$j += strlen($value) - (strlen($buffer) + 2); |
||||
unset($start); |
||||
unset($buffer); |
||||
} |
||||
} elseif (isset($start)) { |
||||
// Check to see $char is a proper character (range: [A-Za-z0-9_./-]) |
||||
// In Yapter 2.13b2, I've added the '/' char as well, to support inclusion |
||||
// from Unix paths, like '../../foo.tpl' |
||||
if (($char >= 'a' && $char <= 'z') || ($char >= '0' && $char <= '9') || ($char >= 'A' && $char <= 'Z') || ($char == '_') || ($char == '.') || ($char == '-') || ($char == '/')) { |
||||
if (!empty($buffer)) |
||||
$buffer .= $char; |
||||
else |
||||
$buffer = $char; |
||||
} else { |
||||
unset($start); |
||||
unset($buffer); |
||||
} |
||||
} |
||||
} |
||||
$parsed[$i] = $line; |
||||
} |
||||
|
||||
if (is_array($this->blox[$blockname]['parsed'])) { |
||||
$this->blox[$blockname]['parsed'] = array_merge($this->blox[$blockname]['parsed'], $parsed); |
||||
} else { |
||||
//--- array cast mod -klp |
||||
$this->blox[$blockname]['parsed'] = (array) $parsed; |
||||
} |
||||
return $this->blox[$blockname]['parsed']; |
||||
} |
||||
|
||||
/* set(): assigns a value to a variabele inside curly brackets ('{' and '}') */ |
||||
function set($varname, $value) |
||||
{ |
||||
if (isset($value)) |
||||
$this->vars[$varname] = $value; |
||||
else |
||||
$this->warning('Trying to set <b>'.htmlspecialchars($varname).'</b> to NULL. Variable not set.'); |
||||
} |
||||
|
||||
/* setVars(): assigns values to variables for each element in the given array |
||||
Contributed by: Raniz |
||||
*/ |
||||
function setVars($variables) |
||||
{ |
||||
if (!is_array($variables)) |
||||
$this->error('Value passed to setVars is not an array.'); |
||||
foreach($variables as $varname => $value) |
||||
$this->vars[$varname] = $value; |
||||
} |
||||
|
||||
/* setFile(): assigns the contents of a file to a variabele inside curly brackets ('{' and '}') */ |
||||
function setFile($varname, $filename) |
||||
{ |
||||
if (!file_exists($filename)) |
||||
$this->error('Cannot open file "'.htmlspecialchars($filename).'" for inclusion in "'.htmlspecialchars($varname).'".'); |
||||
$value = implode('', file($filename)); |
||||
$this->set($varname, $value); |
||||
} |
||||
|
||||
/* getVar(): returns the value of the 'varname' variable */ |
||||
function getVar($varname) |
||||
{ |
||||
if ($this->vars[$varname]) |
||||
return $this->vars[$varname]; |
||||
else |
||||
return false; |
||||
} |
||||
|
||||
/* getBlock(): returns the content of the 'blockname' block */ |
||||
function getBlockContent($blockname) |
||||
{ |
||||
if ($this->$blox[$blockname]['content']) |
||||
return @implode('', $this->$blox[$blockname]['content']); |
||||
else |
||||
return false; |
||||
} |
||||
|
||||
/* replace(): replaces the content of one block by another */ |
||||
function replace($block, $byblock) |
||||
{ |
||||
if (!isset($this->blox[$block])) |
||||
$this->error('Block "'.htmlspecialchars($block).'" does not exist.'); |
||||
if (!isset($this->blox[$byblock])) |
||||
$this->error('Block "'.htmlspecialchars($block).'" does not exist.'); |
||||
$this->blox[$block]['content'] = $this->blox[$byblock]['content']; |
||||
$this->blox[$block]['numlines'] = $this->blox[$byblock]['numlines']; |
||||
} |
||||
|
||||
/* hide(): hides all the contents of the given block */ |
||||
function hide($block) |
||||
{ |
||||
if (!isset($this->blox[$block])) |
||||
$this->error('Block "'.htmlspecialchars($block).'" does not exist.'); |
||||
$this->blox[$block]['content'] = array(); |
||||
$this->blox[$block]['numlines'] = 0; |
||||
} |
||||
|
||||
/* clear(): resets the parsed data to an empty string again and defines the block as 'unparsed' */ |
||||
function clear($blockname) |
||||
{ |
||||
if (!isset($this->blox[$blockname])) |
||||
$this->error('Block "'.htmlspecialchars($blockname).'" does not exist.'); |
||||
$this->blox[$blockname]['parsed'] = ''; |
||||
unset($this->vars[$blockname]); // often, a variabele is set whenever a block should be discarded... |
||||
// ...now reset such a variable to make sure the block is not overriden |
||||
} |
||||
|
||||
/* getContents(): gets the final contents to be outputted on the screen */ |
||||
function getContents($blockname = '') |
||||
{ |
||||
if ($blockname == '') $blockname = $this->_ROOT; |
||||
$parsed = $this->blox[$blockname]['parsed']; |
||||
if ($parsed) |
||||
return implode('', $parsed); |
||||
else |
||||
return false; |
||||
} |
||||
|
||||
/* spit(): ouputs contents to screen */ |
||||
function spit() |
||||
{ |
||||
echo $this->getContents(); |
||||
} |
||||
|
||||
function getmicrotime() |
||||
{ |
||||
/* I got this getmicrotime()-function from the PHP.net website, but it seems to be |
||||
buggy, while it sometimes displays a negative execution time when you substract |
||||
the current time with the starting time of the script... I only noticed it at |
||||
my Windows localhost machine, not on *nix servers. Is anybody familiar with this |
||||
behaviour? Any information about this is welcome at nvie@users.sourceforge.net |
||||
for your co-operation. */ |
||||
list($usec, $sec) = explode(' ', microtime()); |
||||
return ((float)$usec + (float)$sec); |
||||
} |
||||
|
||||
function execTime() |
||||
{ |
||||
return round($this->getmicrotime() - $this->startTime, 5); |
||||
} |
||||
|
||||
function executionTime() |
||||
{ |
||||
echo "<p>\n\nThe execution time is <b>".$this->execTime()."</b> seconds.<br>\n"; |
||||
} |
||||
} |
||||
?> |
Reference in new issue