PDA

View Full Version : Protecting .txt files


Desinc
02-15-2004, 10:47 PM
Is there a way of stopping a viewer from looking at .txt files yet still aloowing a PHP script to acces them? In case it matters I'm using Easyphp as my server, I think it's got Apache in it.

ygrouk
02-15-2004, 11:11 PM
Hey

What about chmodding them to 755, then the user wont be able to access them.

Just a though as we used to do that with perl.

Pete

Nightfire
02-15-2004, 11:13 PM
Best way is to upload your txt file above your document root, and then just using an include() to get the file.

ie

/var/username/public_html

upload your txt file to

/var/username

then use include() to get the file using

include("/var/username/file.txt");

No one can get that file without hacking

Desinc
02-15-2004, 11:18 PM
ygrouk;- I'm not sure but will that mean that my PHP scripts won't be able to acces the files? I'm a little hazy on the subject of CHOMDing

Nightfire; sounds good. I'll try that tommorw

ygrouk
02-15-2004, 11:29 PM
your php file will still be able to acces the file but the browser will not be able to