简体   繁体   English

平面文件存储数据库详细信息

[英]Flat file storage of database details

I need to store mysql database access details in a flat file format. 我需要以平面文件格式存储mysql数据库访问详细信息。 Ie in a .txt and the details on separate lines. 即在.txt中,并在单独的行中包含详细信息。 I can easily do this, but then there is a big security flaw that the details .txt file can easily be navigated to and read by anyone. 我可以很容易地做到这一点,但是存在一个很大的安全漏洞,细节.txt文件可以轻松地被任何人浏览和读取。

How can I make it so that this is not possible. 我如何才能做到这一点。

I tired to save the files as a .php but then it does not read the lines with the command. 我厌倦了将文件另存为.php,但随后它不读取命令行。

$lines = file('details.php');

In your htaccess file you can add 在您的htaccess文件中,您可以添加

<Files "database.txt">
    Order Allow,Deny
    Deny from all
</Files>

Which will prevent people accessing that file 这将阻止人们访问该文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM