-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
84 lines (79 loc) · 1.75 KB
/
Copy pathindex.php
File metadata and controls
84 lines (79 loc) · 1.75 KB
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
<?php
include("functions.php");
$path = dirname(__FILE__).'/';
$uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2);
$protocol = isset($_SERVER["HTTPS"]) ? 'https://' : 'http://';
$url = str_replace(SITE_URL, "", $protocol.$_SERVER['HTTP_HOST'].$uri_parts[0]);
$regex = '#^(?|([0-9a-zA-Z]+)(*MARK:open)
|v/([0-9a-zA-Z]+)(*MARK:manage)
|m/([0-9a-zA-Z]+)(*MARK:edit)
|s/([0-9a-zA-Z]+)(*MARK:remove)
|e/([0-9a-zA-Z]+)(*MARK:export)
)$#x';
$page_home = false;
$have_scan = false;
$no_session = false;
$is_link = false;
switch($url){
// NORMAL
case "":
$page_home = true;
$file = "home.php";
break;
case "scan/":
$no_session = true;
$have_scan = true;
$file = "scan.php";
break;
case "compte/":
$file = "account.php";
break;
case "c/":
$file = "edit.php";
break;
case "g/":
$file = "genqr.php";
break;
// MATCHES
default:
preg_match($regex, $url, $route);
switch($route['MARK']){
case "open":
$_GET['id'] = $route[1];
$no_session = true;
$is_link = true;
$file = "open.php";
break;
case "manage":
$_GET['id'] = $route[1];
$file = "manage.php";
break;
case "edit":
$_GET['id'] = $route[1];
$file = "edit.php";
break;
case "remove":
$_GET['id'] = $route[1];
$_GET['del'] = 1;
$file = "manage.php";
break;
case "export":
$_GET['id'] = $route[1];
$file = "export.php";
break;
case "recuperation":
$_GET['key'] = $route[1];
$file = "recuperation.php";
break;
default:
header('HTTP/1.0 404 Not Found');
$no_session = true;
$file = "404.php";
break;
}
}
if(!$no_session){
include($path."session.php");
}
include($path.$file);
?>