Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a passwords.php file which contains my root password, username and other secret information. I have placed this file in my "include" directory. But I think it is not secure there. Some one told me that you can secure this file by either

- putting this file out of the root directory OR
- using .htaccess technique.

I don't know which one of them is more secure. I don't know how to use any of these method. Can some one guide me which of them should I use to secure my passwords.php file and how to use?
Posted

No matter how well you secure the file itself, never store any passwords. PHP is particularly vulnerable: if you PHP script can read the file, it is in principle accessible to the HTTP client. The risk is not so high (in particular, the file name is completely hidden from the client) but still should be considered as risk.

You can always store passwords in ciphered form. You never need password itself. Also, the common practice is: nobody should know anyone's passwords, including system administrators; this is the only reasonable policy.

When you perform authentication, you should always compare the ciphered password with the stored ciphered password, never the original passwords. The details depend on the ciphering technology your use.

—SA
 
Share this answer
 
Comments
rashidfarooq 26-Mar-11 13:32pm    
Thanks a lot for answering me
Sergey Alexandrovich Kryukov 26-Mar-11 14:25pm    
You're welcome.
Thank your for accepting this Answer.
Good luck,
--SA
Encrypt the php file code , you can get many encripter from net , just encrypt that php file and use
 
Share this answer
 
Comments
rashidfarooq 26-Mar-11 13:32pm    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900