X-Git-Url: http://git.pjr.cc/?p=PHPIPManager.git;a=blobdiff_plain;f=lib%2Fwww.php;fp=lib%2Fwww.php;h=1b8085de3286c07ef1a51c2de35c216634543446;hp=c45de8ae91c027fd75473afa7f2656d4f204535e;hb=2569c990f8e6d6cd66bf85e0db5da9dcd671825a;hpb=bb7eb6654bf2983a7c9d45ad22b0ddbc5608dbe5
diff --git a/lib/www.php b/lib/www.php
index c45de8a..1b8085d 100644
--- a/lib/www.php
+++ b/lib/www.php
@@ -43,6 +43,7 @@ class www {
{
// we build a frame of framey's
$this->header();
+ $this->printError();
$this->mainPage();
$this->footer();
}
@@ -51,7 +52,6 @@ class www {
{
global $db;
- echo "
Welcome to PHPIPManager
";
?>
- dbobject->query("select * from supernet");
+ foreach($res as $row) {
+ //echo "";
+ // print_r($row);
+ // echo "
";
+ echo "".$row["sn_name"]." | ".$row["sn_ip"]."/".$row["sn_mask"]." | ".$row["sn_desc"]." | ";
+ echo "Allocate Subnet | ";
+ echo "Delete Supernet | ";
+ // now we search for sub's
+ echo "
---|
";
+ }
+ }
+
+ function printError()
+ {
+ if(isset($_REQUEST["error"]))
+ {
+ echo "".$_REQUEST["error"]."";
+ }
+ if(isset($_REQUEST["notice"]))
+ {
+ echo "".$_REQUEST["notice"]."";
+ }
+
}
- function header()
+ function header($title = "Welcome to PHP IP Manager")
{
?>
-
+
-
+
dbobject->query($sql);
+ if(ip::isValid($sn, $mask)) {
+ $sn = ip::truncateNetwork($sn, $mask);
+ $sql = "insert into supernet values (NULL, '$name', '$sn', '$mask', '$desc')";
+ $db->dbobject->query($sql);
+ header("Location: index.php?notice=range added");
+ } else {
+ header("Location: index.php?error=invalid ipaddress");
+ }
- header("Location: index.php");
}
?>
\ No newline at end of file