Forum Moderators: coopster

Message Too Old, No Replies

Excluding by file type

Help Needed

         

dunhill

2:28 am on Apr 15, 2006 (gmt 0)

10+ Year Member



I found the code I need to change I just don't know how to change the code, I need your help please.

config.php has the following:
-----------------------------
$ban = "1"; //1 = yes, 0 = no

$which = array(".jpg",
".JPG",
".zip",
".ZIP",
".gif",
".GIF"
);
-----------------------------

This is in the upload script
-----------------------------
$ext = strrchr($name, '.');

if ((!empty($name)) && ($ban) &&!in_array($ext,$which))
-----------------------------

What I want to do is accept all of the file types in the array, but exclude any that have php in the file name for example.

aa.php.jpg or aa.php.zip etc etc.

Please help as I have a photo upload script but people are trying to hack me with php scripts, thank you.

dreamcatcher

6:45 am on Apr 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if ((!empty($name)) && ($ban) &&!in_array($ext,$which) &&!strstr(strtolower($name),'php'))

dc

dunhill

7:51 am on Apr 15, 2006 (gmt 0)

10+ Year Member



dreamcatcher, thank you very much your a savior, you will save me from many hack attempts.

Best Regards!

dreamcatcher

12:36 pm on Apr 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You`re welcome. Good luck. :)