-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex-secure.php.txt
41 lines (30 loc) · 1012 Bytes
/
index-secure.php.txt
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
<?php
////////////////////////////////////////////////////////////////////////////////
// VERIFY FILE OWNERSHIP AND GROUP MATCHES
////////////////////////////////////////////////////////////////////////////////
function is_owner($path) {
static $owner = NULL;
static $group = NULL;
if ($owner === NULL || $group === NULL) {
$owner = fileowner(__FILE__);
$group = filegroup(__FILE__);
return;
}
$pathx = @stream_resolve_include_path($path);
if ($pathx === false) {
throw new Exception(
'Error finding source code file: ' . $path
);
}
if (@fileowner($pathx) !== $owner || @filegroup($pathx) !== $group) {
throw new Exception(
'File ownerships do not match: ' . $path
);
}
return $path;
}
is_owner(NULL);
////////////////////////////////////////////////////////////////////////////////
// VERIFY FILE OWNERSHIP AND GROUP MATCHES
////////////////////////////////////////////////////////////////////////////////
require_once(is_owner(__DIR__.'/_altaform/_index.php'));