aboutsummaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorArno Richter <oelna@oelna.de>2017-12-20 00:32:30 +0100
committerArno Richter <oelna@oelna.de>2017-12-20 00:32:30 +0100
commit603d4cc48dbd5db29e45cc2a3c5245e1c00384f3 (patch)
tree070919dd16dac5a745d8031babbbff4f7aab6c29 /index.php
downloadmicroblog-603d4cc48dbd5db29e45cc2a3c5245e1c00384f3.tar.gz
microblog-603d4cc48dbd5db29e45cc2a3c5245e1c00384f3.tar.bz2
microblog-603d4cc48dbd5db29e45cc2a3c5245e1c00384f3.zip
initial commit
Diffstat (limited to 'index.php')
-rw-r--r--index.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..747b803
--- /dev/null
+++ b/index.php
@@ -0,0 +1,30 @@
+<?php
+ require_once(__DIR__.DIRECTORY_SEPARATOR.'config.php');
+
+
+ if(is_numeric(path(0))) {
+ // show a single blog post
+ require_once(ROOT.DS.'single.inc.php');
+ } elseif(mb_strtolower(path(0)) === 'login') {
+ // show login form
+ require_once(ROOT.DS.'login.inc.php');
+ } elseif(mb_strtolower(path(0)) === 'new') {
+ if(isset($_COOKIE['microblog_login']) && $_COOKIE['microblog_login'] === sha1($config['url'].$config['admin_pass'])) {
+ // show the post form
+ require_once(ROOT.DS.'postform.inc.php');
+ } else {
+ header('Location: '.$config['url'].'/login');
+ die();
+ }
+ } else {
+ // redirect everything else to the homepage
+ if(!empty(path(0)) && path(0) != 'page') {
+ header('Location: '.$config['url']);
+ die();
+ }
+
+ // show the homepage
+ require_once(ROOT.DS.'timeline.inc.php');
+ }
+
+?> \ No newline at end of file