Make use of Yapter Template Engine
This commit is contained in:
@@ -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();
|
||||
|
||||
header_location("subnetview.php?subnet_id=" . $subnet_id);
|
||||
}
|
||||
?>
|
||||
// set language variables
|
||||
$tp->setvars($lang);
|
||||
|
||||
<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");
|
||||
?>
|
||||
Reference in New Issue
Block a user