X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;ds=sidebyside;f=index.php;h=700f69a182a9cb0d81bd7b72821a8dbc57195337;hb=f870b65ad60d8ea7456384d38f8db6fd01275990;hp=026be61b90a4edd0ddd1ebfa760c88d5aabf2d16;hpb=2304c986361178b61ea7637d845c09322a2c1179;p=dylansserver.git
diff --git a/index.php b/index.php
index 026be61..700f69a 100644
--- a/index.php
+++ b/index.php
@@ -1,59 +1,453 @@
-
+config_file);
+ $this->db = new mysqli(
+ $config['domain'],
+ $config['user'],
+ $config['password'],
+ $config['database']);
+ if (mysqli_connect_errno()) {
+ echo "Problem connecting to database: ";
+ echo mysqli_connect_error();
+ exit();
+ }
+ 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';
+ }
+ }
+
+ public function query() {
+ $args = func_get_args();
+ $statement = $this->db->prepare($args[0]);
+ $args = array_slice($args, 1);
+ call_user_func_array(array($statement, 'bind_param'), &$args);
+ $statement->execute();
+ $return = array();
+ $statement->store_result();
+ $row = array();
+ $data = $statement->result_metadata();
+ $fields = array();
+ $fields[0] = &$statement;
+ while($field = $data->fetch_field()) {
+ $fields[] = &$row[$field->name];
+ }
+ call_user_func_array("mysqli_stmt_bind_result", $fields);
+ $i = 0;
+ while ($statement->fetch()) {
+ foreach ($row as $key1=>$value1) $return[$i][$key1] = $value1;
+ $i++;
+ }
+ $statement->free_result();
+ return $return;
+ }
+
+ public function display_head($title = "dylanstestserver",
+ $home_link = "/") {
+ $scripts = "";
+ $stylesheets = "";
+ if (cms::determine_type() == "index") {
+ $scripts = "
-
-
+
+
+
+
+END_OF_HEAD;
+ }
+
+ public function display_contact() {
+ echo <<
@psu.edu
+
+END_OF_CONTACT;
+ }
+
+ public function display_close($show_contact = true) {
+ if ($show_contact) {
+ $this->display_contact();
+ }
+ echo <<
+