| 1 | <?php |
| 2 | |
| 3 | // May contain query params |
| 4 | $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2); |
| 5 | $pieces = array_values(array_filter( |
| 6 | explode('/', $request_uri[0]), |
| 7 | function($exploded) { return $exploded; } |
| 8 | )); |
| 9 | |
| 10 | if (empty($pieces)) { |
| 11 | require './app.php'; |
| 12 | die; |
| 13 | } |
| 14 | |
| 15 | $path = array_shift($pieces); |
| 16 | |
| 17 | switch ($path) { |
| 18 | case '': |
| 19 | require './app.php'; |
| 20 | break; |
| 21 | case 'pic': |
| 22 | require './pic.php'; |
| 23 | break; |
| 24 | case 'upload': |
| 25 | require './upload.php'; |
| 26 | break; |
| 27 | case 'unauthorized': |
| 28 | require './unauthorized.php'; |
| 29 | break; |
| 30 | default: |
| 31 | header('HTTP/1.0 404 Not Found'); |
| 32 | die('404 Not Found'); |
| 33 | } |