Password on php file?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mettlehead
Forum Newbie
Posts: 15
Joined: Fri Oct 11, 2002 11:03 am
Location: Canada

Password on php file?

Post by mettlehead »

I have a file that no one really knows tha address but incase someone stumbles on it, I'd like to place a password on it. My question is can you have the user enter a password and just check it in the code? Or is it possible for someone to access the php code and find out. I just need a quick simple way.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

php code should not be revealed as long as your webserver is configured properly (that is: it handles php code as script)

using this search http://www.google.de/search?sourceid=navclient&hl=de&q=%2Ehtaccess the first two matches were
rev
Forum Commoner
Posts: 52
Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA

Post by rev »

If you must *sigh* put a password in a clear text file, I suggest that you do not place the text file in your web root, rather put it outside of the web root. Thus, using another script include the file with the password string.

This is by no means safe, but it's a bit more safe than having the actual file in your web root so a user could possibly browse it.
Post Reply