-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
62 lines (54 loc) · 1.24 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
// start session
session_start();
require "actions/functions.php";
// echo $test . "<br>"; // sanity check
require "actions/OOP_auth.php";
require "actions/OOP_todo.php";
// // current session credentials
// if (isLoggedIn()) {
// print_r($_SESSION["user"]);
// }
// Uniform Resource Identifier requested by prior page i.e. header("Location: X");
$path = $_SERVER["REQUEST_URI"];
// var_dump($_SERVER["REQUEST_URI"]); // current route
// // // remove query from URL in GET scenario
// $path = parse_url($path, PHP_URL_PATH);
// remove starting slash
$path = trim($path, "/");
$auth = new Auth();
$todo = new Task();
switch ($path) {
// actions
case "signup_action":
$auth -> signup();
break;
case "login_action":
$auth -> login();
break;
case "logout_action":
$auth -> logout();
break;
case "add_todo":
$todo -> add();
break;
case "complete_todo":
$todo -> complete();
break;
case "delete_todo":
$todo -> delete();
break;
// pages
case "signup":
$subpage_title = "Sign Up";
require "pages/signup.php";
break;
case "login":
$subpage_title = "Login";
require "pages/login.php";
break;
default:
$subpage_title = "Home";
require "pages/home.php";
break;
}