From c7ede0038e98b386cbd1ef333d89faa2568b1cb1 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Thu, 12 May 2011 17:37:31 -0700 Subject: Now we have some basic functionality --- htdocs/postings.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 htdocs/postings.php (limited to 'htdocs/postings.php') diff --git a/htdocs/postings.php b/htdocs/postings.php new file mode 100644 index 0000000..c6f53d5 --- /dev/null +++ b/htdocs/postings.php @@ -0,0 +1,51 @@ + + * + */ + +require_once "src/base.inc.php"; + +require_once "src/header.inc.php"; + + +// Make sure we had a path info +if (!isset($_SERVER['PATH_INFO'])) { + errorNotFound(); +} + +// Clean up the id in the path info. +$id = substr($_SERVER['PATH_INFO'], 1, strpos($_SERVER['PATH_INFO'], '.') - 1); + +if (!is_numeric($id)) { + errorNotFound(); +} + +// Get the post. +$post = Post::getById($id); + +if (!$post) { + errorNotFound(); +} + +// Display the post. + +echo "

". $post->getName() ."

"; + +echo "

". $post->getDescription() ."

"; + + + +require_once "src/footer.inc.php"; + +function errorNotFound() { + // TODO: Better 404 error + echo "404"; + exit; +} + +?> -- cgit v1.2.3