-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathinit.php
30 lines (26 loc) · 988 Bytes
/
init.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
<?php
defined('BASEPATH') OR exit('Access denied.');
/**
* Make sure the server can run a function
*
* @author Juno_okyo <[email protected]>
* @link https://junookyo.blogspot.com/
* @param string $name Function to check for
* @return bool
*/
function function_usable($name) {
$disable_funcs = get_cfg_var('disable_functions');
$disable_funcs = ($disable_funcs === FALSE OR empty($disable_funcs)) ? ini_get('disable_functions') : $disable_funcs;
if ($disable_funcs === FALSE OR empty($disable_funcs)) {
return TRUE;
} else {
if (strpos($disable_funcs, ',') === FALSE) {
return strtolower($disable_funcs) !== $name;
}
$disable_funcs = str_replace(' ', '', $disable_funcs);
$disable_funcs = explode(',', strtolower($disable_funcs));
return ! in_array($name, $disable_funcs);
}
}
// Test exec()
function_usable('exec') OR exit('Error: The firewall cannot run on this server. Please remove "exec" from "disable_functions" in php.ini');