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
--- /dev/null
+<?php
+class db {
+ function init() {
+
+ $sql = 'CREATE TABLE sqlite_sequence(name,seq);';
+ $this->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