X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=index.php;h=3f64a27ddede8d88af26808b788ebc95b0b9b0c6;hb=0a144953e57bf457df61e58a3f94b0178c1f9707;hp=0f23b809a0fe5c7f9e3e57d77e2732d19e869946;hpb=f7025d5e13262ba32a86b04ced7a3ed47cf70f18;p=dylansserver.git diff --git a/index.php b/index.php index 0f23b80..3f64a27 100644 --- a/index.php +++ b/index.php @@ -3,32 +3,41 @@ abstract class cms { private $config_file = '/etc/dylanstestserver.ini'; protected $db; + protected $recaptcha_publickey; + protected $recaptcha_privatekey; public function __construct() { - $config = parse_ini_file($this->config_file); + $config = parse_ini_file($this->config_file, true); $this->db = new mysqli( - $config['domain'], - $config['user'], - $config['password'], - $config['database']); + $config[database]['domain'], + $config[database]['user'], + $config[database]['password'], + $config[database]['database']); if (mysqli_connect_errno()) { echo "Problem connecting to database: "; echo mysqli_connect_error(); exit(); } + $this->recaptcha_publickey = $config[recaptcha]['publickey']; + $this->recaptcha_privatekey = $config[recaptcha]['privatekey']; ob_start(); } public static function determine_type() { if (isset($_GET['page']) && is_numeric($_GET['page'])) { return 'page'; + } else if (isset($_GET['year'])) { + return 'archive'; } else if (isset($_GET['note'])) { return 'note'; } else if ($_SERVER['REQUEST_URI'] == '/') { return 'index'; } else if (isset($_GET['project'])) { return 'project'; + } else if (isset($_GET['challenge'])) { + return 'captcha'; } + } public function query() { @@ -49,7 +58,7 @@ abstract class cms { call_user_func_array("mysqli_stmt_bind_result", $fields); $i = 0; while ($statement->fetch()) { - foreach ($row as $key1=>$value1) $return[$i][$key1] = $value1; + foreach ($row as $key=>$value) $return[$i][$key] = $value; $i++; } $statement->free_result(); @@ -61,8 +70,13 @@ abstract class cms { $scripts = ""; $stylesheets = ""; if (cms::determine_type() == "index") { - $scripts = ""; $home_link = "http://validator.w3.org/unicorn/check?ucn_uri=dylanstestserver.com&ucn_task=conformance#"; + } else if ($this->determine_type() == 'note') { + $scripts = ""; + $scripts .= ""; + $scripts .= ""; + $scripts .= ""; } echo <<