0

I need to store mysql database access details in a flat file format. I.e 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');
Somk
  • 11,869
  • 32
  • 97
  • 143
  • 1
    put that file out of root (WWW) so that no one can access it via URL. –  Aug 19 '13 at 13:23

1 Answers1

0

In your htaccess file you can add

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

Which will prevent people accessing that file

Cjmarkham
  • 9,484
  • 5
  • 48
  • 81