From 671b623794ad8bd9d8a57f28436a46a62b12ef66 Mon Sep 17 00:00:00 2001 From: paulr Date: Sun, 12 Sep 2010 05:40:28 +1000 Subject: [PATCH] added some db functionality --- lib/db.php | 1 - lib/ip.php | 2 +- lib/www.php | 39 +++++++++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/lib/db.php b/lib/db.php index 77a9068..e7afc6e 100644 --- a/lib/db.php +++ b/lib/db.php @@ -22,7 +22,6 @@ class db { try { $this->dbobject = new PDO("$DB_URI"); - error_log("channy is a poof"); } catch(PDOException $exep) { error_log("execpt on db open"); } diff --git a/lib/ip.php b/lib/ip.php index 91d7013..6775fba 100644 --- a/lib/ip.php +++ b/lib/ip.php @@ -111,7 +111,7 @@ class ip { return false; } - function addSubnet($subnet) + function addSubnet($name, $subnet, $mask, $desc, $super) { } diff --git a/lib/www.php b/lib/www.php index 2ec7c73..70274f5 100644 --- a/lib/www.php +++ b/lib/www.php @@ -1,7 +1,10 @@ // now we search for sub's echo "
"; } + + echo "dump database restore database"; } function printError() @@ -132,7 +137,7 @@ function www_ip_addSuperRange() } } -function www_ip_allocateSubRange() +function www_ip_allocateRange() { global $db, $wwwConnector; @@ -146,12 +151,12 @@ function www_ip_allocateSubRange() $wwwConnector->header(); $wwwConnector->printError(); ?> -sql is
+ - +
Subnet Name
Subnet IP
Subnet Mask
Subnet Mask
Description
@@ -161,4 +166,30 @@ sql is
$wwwConnector->footer(); } +function www_ip_allocateSubRange() +{ + global $db, $wwwConnector; + + $superid = $_REQUEST["superid"]; + $name = $_REQUEST["subname"]; + $subip = $_REQUEST["subip"]; + $mask = $_REQUEST["submask"]; + $desc = $_REQUEST["subdesc"]; + + $myip = new ip(); + if($myip->addSubnet($name, $subip, $mask, $desc, $superid)) { + header("Location: index.php?notice=range added"); + } else { + header("Location: index.php?error=invalid ipaddress"); + } +} + +function www_db_dumpdb() +{ +} + +function www_db_restoredb() +{ +} + ?> \ No newline at end of file -- 1.7.0.4