From: paulr Date: Fri, 12 Nov 2010 15:28:11 +0000 (+1100) Subject: various bits a pieces X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=HEAD;p=otpcentral.git various bits a pieces --- diff --git a/doc/README b/doc/README index 91c61a6..20e0ece 100644 --- a/doc/README +++ b/doc/README @@ -16,4 +16,8 @@ Primary, this website will only do three things: 2) admin users - i.e. assign tokens to users - it would be nice if the backend were something else (i.e. ldap/AD) 3) allow users to manage their tokens i.e. synchronize them - assign them to themselves, etc. \ No newline at end of file + assign them to themselves, etc. + +This system will also include a auth daemon called authd. +Authd is primarily a data broker, spoken to via shared memory +from the website. \ No newline at end of file diff --git a/php/authd/authd.php b/php/authd/authd.php new file mode 100644 index 0000000..bf3b1fd --- /dev/null +++ b/php/authd/authd.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/php/config/config.php b/php/config/config.php index 15c5adc..1d8a6f4 100644 --- a/php/config/config.php +++ b/php/config/config.php @@ -1,3 +1,8 @@ \ No newline at end of file diff --git a/php/lib/db.php b/php/lib/db.php new file mode 100644 index 0000000..027ce53 --- /dev/null +++ b/php/lib/db.php @@ -0,0 +1,62 @@ +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 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 PRIMARY KEY AUTOINCREMENT,"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"); + } 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 = ""; + + function dump() { + $sql = "select * from supernet"; + $res = $this->dbobject->query($sql); + + foreach($res as $row) { + echo "sn:".$row["sn_id"].":".$row["sn_name"].":".$row["sn_ip"].":".$row["sn_mask"].":".$row["sn_desc"]."\n"; + } + $sql = "select * from subnet"; + $res = $this->dbobject->query($sql); + + foreach($res as $row) { + echo "sbn:".$row["sn_id"].":".$row["snid_id"].":".$row["sn_name"].":".$row["sn_ip"].":".$row["sn_mask"].":".$row["sn_desc"]."\n"; + } + $sql = "select * from hosts"; + $res = $this->dbobject->query($sql); + + foreach($res as $row) { + echo "hst:".$row["ho_id"].":".$row["ho_sn_id"].":".$row["ho_ip"].":".$row["ho_name"].":".$row["ho_desc"]."\n"; + } + } + + function restore($restorefile) { + + } +} + +?> \ No newline at end of file diff --git a/php/lib/lib.php b/php/lib/lib.php index dc10d56..59e1f60 100644 --- a/php/lib/lib.php +++ b/php/lib/lib.php @@ -1,4 +1,10 @@ \ No newline at end of file