-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·97 lines (83 loc) · 2.63 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/*/
* index.php
* Bernie the suggestion engine for your kids, this is the file
* that the website is run through, in theory this should do as little
* as possible, the less it has to do the faster the site
*
* Usage: N/a
*
* Devs: Pez, Elise, Florin, Niki, Stephen, Adam
*
/*/
/* ===== God like code from here on in ===== */
/* Show us errors */
ini_set('display_errors', 0);
ini_set('log_errors', 0);
ini_set('mysql.connect_timeout', 15);
/* Allow tracking sessions (logins) */
session_start();
/* Include our systems main parts, these are just varibles and functions */
include_once('config.php');
include_once('inc/database.php');
include_once('inc/lib.php');
include_once('globals/global.php');
include_once('globals/page.php');
include_once('globals/user.php');
include_once('inc/parse.php');
/* Template parse, in case someone needs it */
include_once('inc/pegParse.class.php');
/* Database */
connectMe('11_COMP10120_D1'); //We always need a database connection
/* If the user isn't logged in yet */
if(!isLoggedIn()) {
//If they are trying to access something they are not allowed to
switch($GLOBAL['page']) {
case "login":
case "signup":
case "lostpassword":
case "demopegparse":
case "ajaxusername":
case "ajaxemail":
case "lostpassword":
case "confirmation":
break;
default:
$GLOBAL['page']="home"; //Send them home
break;
}
if($GLOBAL['page']=="ajaxusername") {
include_once("inc/check_username_availability.php");
die();
} elseif($GLOBAL['page']=="ajaxemail") {
include_once("inc/check_email_availability.php");
die();
}
} else { //They are logged in
//Lets grab that users information
include_once("inc/getUserInfo.php");
if($GLOBAL['page']=="ajax") {
include_once("inc/ajax.php");
die();
}
}
/* What page has the user requested? */
switch ($GLOBAL['page']) {
case "bernie": include_once('pages/bernie.php'); break;
case "login": include_once('pages/login.php'); break;
case "logout": include_once('pages/logout.php'); break;
case "likes": include_once('pages/likes.php'); break;
case "profile": include_once('pages/profile.php'); break;
case "lostpassword": include_once('pages/lostPassword.php'); break;
case "signup": include_once('pages/signup.php'); break;
case "editinterests": include_once('pages/editInterests.php'); break;
case "confirmation": include_once('pages/confirmation.php'); break;
case "demopegparse": include_once('pages/demoPegParse.php'); break;
default: include_once('pages/home.php'); break;
}
/* Database */
disconnectMe(); //Last thing we do is close the DB
/* Parse Template Here */
echo parse('master.html');
/* Short and sweet :-) */
?>