forked from NSS-IITPatna/NSS-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
43 lines (39 loc) · 1.02 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
<?php
header('Access-Control-Allow-Origin: *');
define('TIMEZONE', 'Asia/Kolkata');
date_default_timezone_set(TIMEZONE);
// //Your DB Connection - sample
// $db = new PDO('mysql:host=localhost;dbname=test', 'dbuser', 'dbpassword');
// $db->exec("SET time_zone='$offset';");
/**
* New request lands in this class.
* After that it is routed accordingly to the respective controller.
*/
class Routing
{
function __construct()
{
return null;
}
public function Redirect($url)
{
return null;
}
}
// echo "check";
$url = $_SERVER['REQUEST_URI'];
preg_match('@(.*)index.php(.*)$@', $_SERVER['PHP_SELF'], $mat );
$base = '@^'. $mat[1] ;
if (preg_match($base . '$@', $url, $match)) {
require ('controller/index.html');
} elseif (preg_match('/request/', $url, $match)) {
require ('controller/request_blood.php');
}/* elseif (preg_match($base . 'request/?$@', $url, $match)) {
require ('controller/request_blood.php');
}*/else {
http_response_code(404);
require ('controller/404.php');
// die('invalid url ' . $url);
die();
}
?>