User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,637 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,139 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

'Private' directory practical use

Join Date: Jul 2008
Posts: 1
Reputation: alphaseinor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
alphaseinor alphaseinor is offline Offline
Newbie Poster

Re: 'Private' directory practical use

  #7  
Jul 6th, 2008
Most of the time the "private" directory on a web server is where you would store your login information to a database or other sensitive information. Drawbacks include if someone gets access to your website (control panel, or FTP) and can see things outside of your http. If the DB account has more than just select access on a few meaningless tables (read... menus, content, etc.) then you can most likely just put it into your normal www directory.

about 80% of the time they are accessed by other php scripts (internal to your site) using this:
require("home/webname/private/file.php");

I personally like to put in a connection.php file that holds all of the information to the database (host, username, password, etc). I also like to hold my security check for the host there as well... which looks something like this:

if (($_SERVER['SERVER_NAME']!="your host name")){
	 echo "you are not authorized to access this page"; 
	die(); 
} 

you can always get your host name by using
echo $_SERVER['SERVER_NAME'];

remember that a lot of ISPs are now using something like localhost:temp/mysql5.sock file for a little added security on your DB. just check with your ISP and they'll let you know.
Reply With Quote  
All times are GMT -4. The time now is 10:15 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC