forked from Alex-Tsvetanov/AT-Judge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter.php
51 lines (50 loc) · 1.27 KB
/
router.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
<?php
if ($_SERVER["REQUEST_URI"] == '/queue')
{
include (__DIR__ . "/lib/queue.php");
print_queue ();
return false;
}
else if (preg_match("/\/verify\/cert\/.*\/.*/i", $_SERVER["REQUEST_URI"]))
{
include (__DIR__ . "/lib/get/cert.php");
print_cert ();
return true;
}
else if (preg_match("/\/quiz\/.*\/results/i", $_SERVER["REQUEST_URI"]))
{
include (__DIR__ . "/lib/quiz/result.php");
print_quiz_results ($_SERVER["REQUEST_URI"]);
return false;
}
else if (preg_match("/\/quiz\/.*/i", $_SERVER["REQUEST_URI"]))
{
include (__DIR__ . "/lib/get/quiz.php");
print_quiz ($_SERVER["REQUEST_URI"]);
return false;
}
else if (preg_match("/\/contests\/.*\/results/i", $_SERVER["REQUEST_URI"]))
{
include (__DIR__ . "/lib/get/result.php");
print_results ();
return false;
}
else if (preg_match("/\/submit\/.*/i", $_SERVER["REQUEST_URI"]))
{
$_REQUEST ["id"] = substr ($_SERVER["REQUEST_URI"], 8);
include (__DIR__ . "/lib/get/submission.php");
return false;
}
else if (substr ($_SERVER["REQUEST_URI"], 0, 10) == '/contests/')
{
include (__DIR__ . "/lib/get/contest.php");
print_contest ($_SERVER["REQUEST_URI"]);
//echo "Contest is not ready!";
return false;
}
else
{
$_GET['_uri'] = $_SERVER['REQUEST_URI'] . '.php';
return false;
}
?>