Make use of Yapter Template Engine
This commit is contained in:
@@ -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");
|
||||
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
// set variables
|
||||
$tp->set("ip", $ip);
|
||||
$tp->set("subnet_id", $subnet_id);
|
||||
|
||||
// get subnet info
|
||||
$result = mysql_query("SELECT subnet_address, subnet_mask FROM subnet WHERE subnet_id='$subnet_id'") or die(mysql_error());
|
||||
$row = mysql_fetch_object($result);
|
||||
$tp->set("subnet_address", $row->subnet_address);
|
||||
$tp->set("subnet_mask", $row->subnet_mask);
|
||||
|
||||
// display options
|
||||
if($_SESSION['suser_level'] >= $config_userlevel_assigniptonode) {
|
||||
$tp->parse("assigniptonode");
|
||||
} else {
|
||||
$tp->hide("assigniptonode");
|
||||
}
|
||||
?>
|
||||
|
||||
<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>
|
||||
|
||||
<?php
|
||||
// display only if admin
|
||||
if($_SESSION['suser_level'] >= 2) {
|
||||
?>
|
||||
|
||||
<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>
|
||||
|
||||
<?php
|
||||
// end display only if admin
|
||||
if($_SESSION['suser_level'] >= $config_userlevel_nodeadd) {
|
||||
$tp->parse("nodeadd");
|
||||
} else {
|
||||
$tp->hide("nodeadd");
|
||||
}
|
||||
|
||||
// output
|
||||
$tp->parse();
|
||||
$tp->spit();
|
||||
|
||||
include("footer.php");
|
||||
?>
|
||||
Reference in New Issue
Block a user