From bb7eb6654bf2983a7c9d45ad22b0ddbc5608dbe5 Mon Sep 17 00:00:00 2001 From: paulr Date: Fri, 10 Sep 2010 13:28:20 +1000 Subject: [PATCH] Lots of changes --- db/db.sqlite | Bin 0 -> 6144 bytes db/schema.sql | 21 +++++++++++ lib/auth.php | 11 ++++++ lib/config.php | 10 +++++ lib/db.php | 44 +++++++++++++++++++++++ lib/ip.php | 22 ++++++++++++ lib/lib.php | 10 +++++ lib/www.php | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ www/index.php | 5 ++- 9 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 db/db.sqlite create mode 100644 db/schema.sql create mode 100644 lib/auth.php create mode 100644 lib/config.php create mode 100644 lib/db.php create mode 100644 lib/ip.php create mode 100644 lib/www.php diff --git a/db/db.sqlite b/db/db.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..e3f5acee7f7284f28fb2b0d7b7b6b05874157f11 GIT binary patch literal 6144 zcmeHG-D<)x6i(Wzp!04}ybwY`P!x8t>%qDahD@F7IyNtcRLxkK)}Pdiv8(znKE+;P z54EJ#X*NM&S0g!)r0457$#=fw+}$?(kf7)BY~+RL6c_+PaE=fFAjbwbjSa{K_xbnQ zIChZbwFh9pCD3zlsr7YVe>*7cZ$a$LPhkfJd5P&td3F|X?nEL3l~_zF9y?bMsL(?Qp`gY0|vrru)7P26&8-{Caa z&e-7o#6m89+=>jm5&4M?2<<0WwxU0QBd#x7ji{8$n1updlw$UD-U~>W%xQstg01QA zBtrv#u!AFy6*)3w5%nBmy+q61bsq9R~LDU zKg;}(8q2IO0b&)n647xwV-|}rdS9t9A+uPAWHrPc=Lxz;i>-22m$gTT-$iq3%9H|1 w0XY@O^Rf*&Ygbh(1!Px1^}p;dK-Dj^0;>OIzI|1@> \ 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(); ?> -- 1.7.0.4