-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (42 loc) · 1.06 KB
/
index.php
File metadata and controls
56 lines (42 loc) · 1.06 KB
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
<?php
//controller file
//error reporting
ini_set('display_errors',1);
error_reporting(E_ALL);
//requirements
require('model/request.php');
require_once('vendor/autoload.php');
// Start session
session_start();
//instantiate base F3 base class
$f3 = Base::instance();
$con = new Controller($f3);
$query = new Query();
//define default route
$f3->route('GET|POST /', function() {
$GLOBALS['con']->homePage();
});
//route to play a game
$f3->route('GET|POST /game', function($f3){
$GLOBALS['con']->game();
});
$f3->route('GET|POST /victory', function($f3) {
$GLOBALS['con']->victory();
});
$f3->route('GET|POST /defeat', function($f3) {
$GLOBALS['con']->defeat();
});
$f3->route('GET|POST /login', function() {
$GLOBALS['con']->login();
});
$f3->route('GET|POST /signup', function() {
$GLOBALS['con']->signup();
});
$f3->route('GET|POST /guest', function() {
$GLOBALS['con']->guest();
});
$f3->route('GET|POST /logout', function() {
$GLOBALS['con']->logout();
});
//run fat free
$f3->run();