我在我的根目錄中有以下config.php.inc文件,我想知道是否安全或不安全將配置文件放入網站的根目錄並且我的配置文件是否安全。安全檢查我的php配置文件
如果它不安全我該如何使它更安全?
<?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/");
}
?>
,如果你要隱藏的文件。您的擴展名更改任何人或添加爲頁提到它filematch試試這個.. http://stackoverflow.com/questions/2860019/how- to-hide-certain-file-type-using-apache-htaccess – Dinesh