PDA

View Full Version : Security Risk in php



amberlong83
12-02-2009, 11:23 AM
Hello

Any one can please help me with my php security problem.

Actully I want to create an application that stores stuff in the same folder where the php script runs from.

I know that this could be quite a security risk, and any one please help me for minimize this risk.


Thanks in Advence!

xuxoxux
12-09-2009, 12:08 AM
Errrr....just strip all input of anything that can cause trouble.
That is all I can say without actually seeing the script......

tesco
12-09-2009, 12:12 AM
While I'm not an expert with the security of files, I am pretty sure that what you've heard about writing files in the same directory as your php script is true.

I'm not exactly sure what you're trying to do, since you didn't say, but have you considered just writing into a subfolder then using rewrite rules (apache mod_rewrite) to allow web access from the folder you want?

Example store file "dog.jpg" in root\uploads\, but allow access from root\dog.jpg in a user's browser

$SnoopDo2G$
12-11-2009, 01:05 PM
and sensible folders should have access only trough .htaccess .htpasswd ;)