我的根目录中有以下 config.php.inc 文件,我想知道将配置文件放入网站根目录是否安全,我的配置文件是否安全。
如果它不安全,我怎样才能让它更安全?
<?php
global $configVars;
$configVars['online'] = false;
if(($_SERVER['SERVER_NAME'])!='localhost' and ($_SERVER['SERVER_NAME'])!='abc')
{
$configVars['dbhost'] = "localhost"; // Database host address //
$configVars['dbuser'] = "dbuser"; // Database user name //
$configVars['dbpassword'] = "bq;^4"; // Database password //
$configVars['dbname'] = "dbname"; // Database name //
$configVars['dbport'] = 3306; // Database port //
define('SERVER_NAME', 'http://sitesurl/');
define("SITE_ABSOLUTE_PATH", SERVER_NAME."");
} else {
$configVars['dbhost'] = "localhost"; // Database host address //
$configVars['dbuser'] = "root"; // Database user name //
$configVars['dbpassword'] = ""; // Database password //
$configVars['dbname'] = "localdb"; // Database name //
$configVars['dbport'] = 3306; // Database port //
////////// Define Variables
define('SERVER_NAME', 'http://localhost');
define("SITE_ABSOLUTE_PATH", SERVER_NAME."/site/");
}
?>