From 0264b5a42242521bd85ab2568f4bf23381df7a36 Mon Sep 17 00:00:00 2001 From: paulr Date: Sun, 12 Sep 2010 04:21:48 +1000 Subject: [PATCH] various stuff --- lib/db.php | 4 ++-- lib/ip.php | 2 -- lib/www.php | 33 +++++++++++++++++++++++++++++++-- www/index.php | 1 + 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/db.php b/lib/db.php index afa6679..77a9068 100644 --- a/lib/db.php +++ b/lib/db.php @@ -10,10 +10,10 @@ class db { $sql = 'CREATE TABLE "hosts" ("ho_id" INTEGER PRIMARY KEY AUTOINCREMENT,"ho_sn_id" INTEGER,"ho_ip" TEXT,"ho_name" TEXT,"ho_desc" TEXT);'; $this->dbobject->query($sql); - $sql = 'CREATE TABLE subnet ("sn_id" INTEGER,"snid_id" INTEGER,"sn_ip" TEXT,"sn_mask" TEXT,"sn_name" TEXT, "sn_desc" TEXT);'; + $sql = 'CREATE TABLE subnet ("sn_id" INTEGER PRIMARY KEY AUTOINCREMENT,"snid_id" INTEGER,"sn_ip" TEXT,"sn_mask" TEXT,"sn_name" TEXT, "sn_desc" TEXT);'; $this->dbobject->query($sql); - $sql = 'CREATE TABLE supernet ("sn_id" INTEGER,"sn_name" TEXT,"sn_ip" TEXT,"sn_mask" TEXT,"sn_desc" TEXT);'; + $sql = 'CREATE TABLE supernet ("sn_id" INTEGER PRIMARY KEY AUTOINCREMENT,"sn_name" TEXT,"sn_ip" TEXT,"sn_mask" TEXT,"sn_desc" TEXT);'; $this->dbobject->query($sql); } diff --git a/lib/ip.php b/lib/ip.php index 95d71b0..a1c6a8a 100644 --- a/lib/ip.php +++ b/lib/ip.php @@ -80,9 +80,7 @@ class ip { error_log("no 3"); return false; } - $slt .= $pss[$i].":"; } - $slt .= ":0"; // we are still a valid ipv6 ip address/mask error_log("Valid"); diff --git a/lib/www.php b/lib/www.php index 1b8085d..79409a8 100644 --- a/lib/www.php +++ b/lib/www.php @@ -1,6 +1,7 @@ // print_r($row); // echo "
"; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; // now we search for sub's echo "
".$row["sn_name"]."".$row["sn_ip"]."/".$row["sn_mask"]."".$row["sn_desc"]."Allocate SubnetDelete SupernetAllocate SubnetDelete Supernet

"; } @@ -130,7 +131,35 @@ function www_ip_addSuperRange() } else { header("Location: index.php?error=invalid ipaddress"); } +} + +function www_ip_allocateSubRange() +{ + global $db, $wwwConnector; + + $id = $_REQUEST["id"]; + + $res = $db->dbobject->query("select * from supernet where sn_id=='$id'"); + + foreach($res as $row) { + $sn = $row["sn_ip"]; + } + $wwwConnector->header(); + $wwwConnector->printError(); + ?> +sql is
+
+ + + + + + +
Subnet Name
Subnet IP
Subnet Mask
Description
+
+footer(); } ?> \ No newline at end of file diff --git a/www/index.php b/www/index.php index 353a053..a477d79 100644 --- a/www/index.php +++ b/www/index.php @@ -3,6 +3,7 @@ require_once "../lib/lib.php"; $wwwConnector = new www(); +global $wwwConnector; $wwwConnector->Go(); ?> -- 1.7.0.4