From: paulr Date: Fri, 10 Sep 2010 03:28:20 +0000 (+1000) Subject: Lots of changes X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=bb7eb6654bf2983a7c9d45ad22b0ddbc5608dbe5;p=PHPIPManager.git Lots of changes --- diff --git a/db/db.sqlite b/db/db.sqlite new file mode 100644 index 0000000..e3f5ace Binary files /dev/null and b/db/db.sqlite differ diff --git a/db/schema.sql b/db/schema.sql new file mode 100644 index 0000000..b7db164 --- /dev/null +++ b/db/schema.sql @@ -0,0 +1,21 @@ +CREATE TABLE sqlite_sequence(name,seq); +CREATE TABLE "hosts" ( + "ho_id" INTEGER PRIMARY KEY AUTOINCREMENT, + "ho_sn_id" INTEGER, + "ho_ip" TEXT, + "ho_name" TEXT, + "ho_desc" TEXT +); +CREATE TABLE subnet ( + "sn_id" INTEGER, + "snid_id" INTEGER, + "sn_ip" TEXT, + "sn_mask" TEXT, + "sn_name" TEXT +, "sn_desc" TEXT); +CREATE TABLE supernet ( + "sn_id" INTEGER, + "sn_name" TEXT, + "sn_ip" TEXT, + "sn_mask" TEXT +, "sn_desc" TEXT); diff --git a/lib/auth.php b/lib/auth.php new file mode 100644 index 0000000..6220a79 --- /dev/null +++ b/lib/auth.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/lib/config.php b/lib/config.php new file mode 100644 index 0000000..b12b2b5 --- /dev/null +++ b/lib/config.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/lib/db.php b/lib/db.php new file mode 100644 index 0000000..afa6679 --- /dev/null +++ b/lib/db.php @@ -0,0 +1,44 @@ +dbobject->query($sql); + + $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);'; + $this->dbobject->query($sql); + + $sql = 'CREATE TABLE supernet ("sn_id" INTEGER,"sn_name" TEXT,"sn_ip" TEXT,"sn_mask" TEXT,"sn_desc" TEXT);'; + $this->dbobject->query($sql); + } + + function connect() { + global $DB_URI; + + try { + $this->dbobject = new PDO("$DB_URI"); + error_log("channy is a poof"); + } catch(PDOException $exep) { + error_log("execpt on db open"); + } + + if(!$this->dbobject->query("select * from hosts")) { + error_log("db open for init"); + $this->init(); + } + } + + public $dbobject = ""; +} + + + +$db = new db(); +global $db; + +?> \ No newline at end of file diff --git a/lib/ip.php b/lib/ip.php new file mode 100644 index 0000000..e07eb30 --- /dev/null +++ b/lib/ip.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/lib/lib.php b/lib/lib.php index b3d9bbc..5190d28 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -1 +1,11 @@ \ No newline at end of file diff --git a/lib/www.php b/lib/www.php new file mode 100644 index 0000000..c45de8a --- /dev/null +++ b/lib/www.php @@ -0,0 +1,105 @@ +connect(); + //if($db->connect()!=0) { + //$this->doInstaller(); + //exit(0); + //} + + // its up to auth as to wether "this" url requires auth. + $authThis = new auth(); + $authThis->Go(); + + if(isset($_REQUEST["action"])) { + $this->doAction($_REQUEST["action"]); + } else { + $this->mainAction(); + } + } + + function doAction($actionName) + { + global $actionRegister; + + error_log("im here"); + if(isset($actionRegister[$actionName])) { + $func = $actionRegister[$actionName]; + error_log("im here 2"); + $func(); + } else { + error_log("im here 3"); + $this->mainAction(); + } + } + + function mainAction() + { + // we build a frame of framey's + $this->header(); + $this->mainPage(); + $this->footer(); + } + + function mainPage() + { + global $db; + + echo "

Welcome to PHPIPManager

"; + ?> +
+Create Supernet: name +Subnet Address +Mask +Description + +
+ + + + + + + + dbobject->query($sql); + + header("Location: index.php"); +} + +?> \ No newline at end of file diff --git a/www/index.php b/www/index.php index f8a86e6..353a053 100644 --- a/www/index.php +++ b/www/index.php @@ -1,7 +1,8 @@ Go(); +$wwwConnector = new www(); +$wwwConnector->Go(); ?>