forked from anweshaiitp/anwesha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·121 lines (110 loc) · 4.89 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
ini_set( "display_errors", 1);
ini_set('zlib_output_compression','On');
/**
* New request lands in this class. After that it is routed accordingly to the respective controller.
* Also provides basic functions for loading models.
* Also provides basic methods for HTTP responses and redirects.
*/
class Routing
{
function __construct()
{
return null;
}
public function Redirect($url)
{
return null;
}
}
require('global.php');
$url = $_SERVER['REQUEST_URI'];
preg_match('@(.*)index.php(.*)$@', $_SERVER['PHP_SELF'], $mat );
$base = '@^'. $mat[1] ;
if (preg_match($base . '(ca|register|)_?([0-9]{4}|)$@', $url, $match)) {
require ('view/index.php');
} elseif (preg_match($base . 'leaderboard/api/?$@', $url, $match)) {
require ('controller/leaderboardback.php');
} elseif (preg_match($base . 'ca/?$@', $url, $match)) {
require ('view/ca.php');
// header('Location: ../');
} elseif ('/anw/ca/?i=1' == $url) {
require ('view/ca.php');
// header('Location: ../');
} elseif (preg_match($base . 'register/?$@', $url, $match)) {
header('Location: ../');
} elseif (preg_match($base . 'index.php?$@', $url, $match)) {
header('Location: ./');
} elseif (preg_match($base . 'leaderboard/?$@', $url, $match)) {
require ('view/leaderboard.php');
} elseif (preg_match($base . 'team/$@', $url, $match)) {
require ('view/team.html');
} elseif (preg_match($base . 'auditions/$@', $url, $match)) {
require ('view/multiCityAuditions.html');
} elseif (preg_match($base . 'auditions/linefollow/$@', $url, $match)) {
require ('view/linefollow.html');
} elseif ( preg_match($base .'faq/?$@', $url, $match ) ) {
require ('view/faq.php');
} elseif (preg_match($base . 'gallery/$@', $url, $match)) {
require ('view/gallery.html');
} elseif (preg_match($base . 'sponsors/$@', $url, $match)) {
require ('view/spons.html');
} elseif (preg_match($base . 'switchca/$@', $url, $match)) {
require ('view/switchca.php');
// } elseif ( preg_match($base .'cssLoader/home/?$@', $url, $match ) ) {
// require ('controller/cssLoader.php');
} elseif ( preg_match($base .'events/?$@', $url, $match ) ) {
require ('controller/events.php');
} elseif (preg_match($base . 'allEvents/?$@', $url)) {
require ('controller/allEvents.php');
} elseif (preg_match($base . 'events/([0-9]{1,3})/?$@', $url, $match)) {
require ('controller/getSubEvents.php');
} elseif (preg_match($base . 'user/register/User/?$@', $url)) {
require ('controller/userRegistration.php');
} elseif (preg_match($base . 'user/CAcheck/([0-9]+)/?$@', $url, $match)) {
require ('controller/cacheck.php');
} elseif (preg_match($base . 'user/register/CampusAmbassador/?$@', $url)) {
require ('controller/campusAmbassadorRegistration.php');
} elseif (preg_match($base . 'user/switch/CampusAmbassador/?$@', $url)) {
require ('controller/campusAmbassadorSwitching.php');
} elseif (preg_match($base . 'verifyEmail/CampusAmbassador/([0-9]{4})/([A-Za-z0-9]{40})/?$@', $url, $match)) {
require ('controller/verifyEmail.php');
} elseif (preg_match($base . 'verifyEmail/User/([0-9]{4})/([A-Za-z0-9]{40})/?$@', $url, $match)) {
require ('controller/verifyEmail.php');
} elseif (preg_match($base . 'register/([0-9]{1,3})/?$@', $url, $match)) {
require ('controller/registerUser.php');
// } elseif (preg_match($base . 'register/group/([0-9]{1,2})/?$@', $url, $match)) {
// require ('controller/registerGroup.php');
} elseif (preg_match($base . 'login/?$@', $url)) {
require ('controller/loginUser.php');
} elseif (preg_match($base . 'logout/?$@', $url)) {
require ('controller/logout.php');
//For Changing Passwords
} elseif (preg_match($base . 'changePassword/?$@', $url)) {
require ('controller/changePassword.php');
}elseif (preg_match($base . 'viewRef/?$@', $url)) {
require ('view/viewRef.php');
} elseif (preg_match($base . 'reset/([a-zA-Z0-9_.+-]+\@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)/?$@', $url,$match)) {
require ('controller/forgetpasswdmail.php');
} elseif (preg_match($base . 'resetpassword/([0-9]{4})/([A-Za-z0-9]{40})/$@', $url,$match)) {
require ('view/reset.php');
} elseif (preg_match($base . 'resetpassword/([0-9]{4})/([A-Za-z0-9]{40})/now/?$@', $url,$match)) {
require ('controller/forgetpassword_token.php');
} elseif (preg_match($base . 'resend/([a-zA-Z0-9_.+-]+\@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)/?$@', $url, $match)) {
require ('controller/resendVerification.php');
} elseif (preg_match($base . 'download_records/(.*)$@', $url, $match)) {
require ('controller/download_records.php');
} elseif (preg_match($base . 'download_events/(.*)$@', $url, $match)) {
require ('controller/download_events.php');
} elseif (preg_match($base . 'download_logs/([0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4})/([0-9A-Za-z]{32})/?$@', $url, $match)) {
require ('controller/download_logs.php');
} elseif (preg_match($base . 'payload$@', $url)) {
require ('controller/payload.php');
//App
} elseif (preg_match($base . 'appversion/?$@', $url)) {
echo "1";
} else {
http_response_code(404);
die('invalid url ' . $url);
}
?>