forked from karpenoktem/old-knsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
40 lines (31 loc) · 763 Bytes
/
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
<?php
require 'config.default.php';
require 'lib/common.php';
$in = array_merge($_GET, $_POST);
// Get PATH
if(isset($_SERVER['ORIG_PATH_INFO']))
$path = $_SERVER['ORIG_PATH_INFO'];
elseif(isset($_SERVER['PATH_INFO']))
$path = $_SERVER['PATH_INFO'];
elseif(isset($_GET['path']))
$path = $_GET['path'];
elseif(isset($_POST['path']))
$path = $_POST['path'];
else
$path = '';
$bits = explode('/', $path);
if(count($bits) == 0 or
(empty($bits[0]) and count($bits) == 1) or
(empty($bits[0]) and empty($bits[1])))
$act = 'default';
elseif(empty($bits[0]))
$act = $bits[1];
else
$act = $bits[0];
$file = "actions/$act.php";
if(!is_file($file)) {
header('HTTP/1.0 404 Not Found');
die("$act: Action doesn't exist");
}
require_once($file);
?>