<?php $web_root = "origind"; require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $web_root . "/config.php"; $setTitle = "Page not found | ORIGIND"; $setStyle = ROOT_URL_PATH . CSS_FILE; $variables = array('setTitle' => $setTitle, 'setStyle' => $setStyle); renderLayoutWithContentFile("/common/error.php", $variables);
<?php require_once realpath(dirname(__FILE__) . "/../resources/config.php"); require_once LIBRARY_PATH . "/templateFunctions.php"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $question = $db->prepare('SELECT * FROM questions WHERE id = ?'); $question->execute(array($_POST['id'])); $row_count = $question->rowCount(); if ($row_count > 0) { $stmt = $db->prepare("UPDATE questions SET topic = ?, question = ?, name = ?, email = ? WHERE id = " . $_POST['id']); } else { $stmt = $db->prepare('INSERT INTO questions(topic, question, name, email) VALUES(?, ?, ?, ?)'); } $stmt->execute(array($_POST['topic'], $_POST['question'], $_POST['name'], $_POST['email'])); header('Location: /question.php?id=' . $_POST['id']); die; } else { if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['id'])) { $stmt = $db->prepare('SELECT * FROM questions WHERE id = ?'); $stmt->execute(array($_GET['id'])); $question = $stmt->fetch(); $variables = array('id' => $_GET['id'], 'name' => $question['name'], 'email' => $question['email'], 'topic' => $question['topic'], 'question' => $question['question']); renderLayoutWithContentFile("ask.php", $variables); } else { $variables = array('id' => '', 'name' => '', 'email' => '', 'topic' => '', 'question' => ''); renderLayoutWithContentFile("ask.php", $variables); } }
<?php $web_root = "origind"; require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $web_root . "/config.php"; $setTitle = "ORIGIND | SQL Reports"; $setStyle = ROOT_URL_PATH . CSS_FILE; $setTemplateType = "index"; $variables = array('setTitle' => $setTitle, 'setStyle' => $setStyle, 'setTemplateType' => $setTemplateType); renderLayoutWithContentFile("home.php", $variables);
<?php $web_root = "origind"; require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $web_root . "/config.php"; $setTitle = "Login | ORIGIND"; $setStyle = ROOT_URL_PATH . CSS_FILE; $variables = array('setTitle' => $setTitle, 'setStyle' => $setStyle); renderLayoutWithContentFile("/common/login.php", $variables);
<?php require_once realpath(dirname(__FILE__) . "/../resources/config.php"); require_once LIBRARY_PATH . "/templateFunctions.php"; if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['id'])) { $stmtq = $db->prepare('SELECT * FROM questions WHERE id = ?'); $stmtq->execute(array($_GET['id'])); $question = $stmtq->fetch(); $stmta = $db->prepare('SELECT * FROM answers WHERE question_id = ?'); $stmta->execute(array($_GET['id'])); $answer = $stmta->fetchAll(); $variables = array('id' => $_GET['id'], 'question' => $question, 'answers' => $answer); renderLayoutWithContentFile("detail.php", $variables); } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $answer = $db->prepare('INSERT INTO answers(question_id, answer, name, email) VALUES(?, ?, ?, ?)'); $answer->execute(array($_POST['id'], $_POST['answer'], $_POST['name'], $_POST['email'])); header('Location: /question.php?id=' . $_POST['id']); die; } else { if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['q_id'])) { if ($_GET['vote'] == 'up') { $upvote = $db->prepare("UPDATE questions SET vote = vote + 1 WHERE id = ?"); } else { $upvote = $db->prepare("UPDATE questions SET vote = vote - 1 WHERE id = ?"); } $upvote->execute(array($_GET['q_id'])); $vote = $db->prepare('SELECT vote FROM questions where id = ?'); $vote->execute(array($_GET['q_id'])); $currentVote = $vote->fetch(); echo $currentVote[vote];
<?php $web_root = "origind"; require_once $_SERVER['DOCUMENT_ROOT'] . "/" . $web_root . "/config.php"; $setTitle = "SQL Report Editing | ORIGIND"; $setStyle = ROOT_URL_PATH . CSS_FILE; $setTemplateType = "index"; $variables = array('setTitle' => $setTitle, 'setStyle' => $setStyle, 'setTemplateType' => $setTemplateType); renderLayoutWithContentFile("/" . $web_root . "/edit-report.php", $variables);