alejandro52 Posted September 15, 2010 Share Posted September 15, 2010 I have a folder with php includes files and one of them has the username and password of the database. Is there any way that i can lock the folder and unlock it with php. Or do it using the cpanel of my server? Quote Link to comment https://forums.phpfreaks.com/topic/213477-lock-includes-folder/ Share on other sites More sharing options...
rwwd Posted September 15, 2010 Share Posted September 15, 2010 Why would you want to lock them, you can do something similar through .htaccess - but wouldn't it be easier to store the sensitive files in a folder outside the root of your site; on most servers now there is a private_html folder of some description, this would mean then that only you have access to is as it is outside the public domain. Rw Quote Link to comment https://forums.phpfreaks.com/topic/213477-lock-includes-folder/#findComment-1111309 Share on other sites More sharing options...
PFMaBiSmAd Posted September 15, 2010 Share Posted September 15, 2010 Your database information in the form of php code in a .php file is inherently safe. If you browse to the file, you only get any output sent by that file, not the php code in the file. It would require someone to find a way of causing php code to not be parsed without also breaking the web server. What exactly are you trying to accomplish? Quote Link to comment https://forums.phpfreaks.com/topic/213477-lock-includes-folder/#findComment-1111328 Share on other sites More sharing options...
alejandro52 Posted September 15, 2010 Author Share Posted September 15, 2010 I want to have a folder with functions and my username and pasword inside. Then insead of rewriting the functions and user and pass to include it from outside. Quote Link to comment https://forums.phpfreaks.com/topic/213477-lock-includes-folder/#findComment-1111335 Share on other sites More sharing options...
PFMaBiSmAd Posted September 15, 2010 Share Posted September 15, 2010 What you described is exactly what you do. There are literally 10's of millions of php based web sites that put database settings and functions into files that the main file includes and then uses what was included. Quote Link to comment https://forums.phpfreaks.com/topic/213477-lock-includes-folder/#findComment-1111338 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.