简体   繁体   中英

Flat file storage of database details

I need to store mysql database access details in a flat file format. Ie in a .txt and the details on separate lines. 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.

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.

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

In your htaccess file you can add

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

Which will prevent people accessing that file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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