someone only include onetime(ngnix), so read file

pull/4/head
qkqpttgf 2020-01-23 17:05:56 +08:00 committed by GitHub
parent 3013647556
commit bff00187da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -203,16 +203,20 @@ function ConfigWriteable()
function RewriteEngineOn()
{
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$tmpurl=$http_type . $_SERVER['SERVER_NAME'] . path_format($_SERVER['base_path'] . '/config.php');
$tmpurl = $http_type . $_SERVER['SERVER_NAME'];
//if $_SERVER['SERVER_PORT']
$tmpurl .= path_format($_SERVER['base_path'] . '/config.php');
$tmp = curl_request($tmpurl);
if ($tmp['stat']==200) return false;
if ($tmp['stat']==201) return true; //when install return 201, after installed return 404 or 200;
return false;
}
function getConfig($str)
{
include 'config.php';
//$s = file_get_contents('config.json');
//include 'config.php';
$s = file_get_contents('config.php');
$configs = substr($s, 18, -2);
if ($configs!='') {
$envs = json_decode($configs, true);
if (isset($envs[$str])) return $envs[$str];