Re: does this code look like it would check a file extensions, and disallow php files or exe files to be attached

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



why don't you run it and find out. with errors turned on you will have quickly found out if it worked or not

$filelinks=t3lib_div::_POST('file_name'); // the posting of the file name

ok Ive never seen syntax like that before, maybe some else can help, looks like your doing this code from within a class that inherits from another class.

$exttypes = "php3,php,exe";                                     // list of
extensions that shouldnt be used
$fileextension = substr($filelinks,0,strpos($filelinks,"."));     //get the

no should be:

fileextension =
substr($filelinks, strpos($filelinks,".")+1 , strlen($filelinks));

extension after the .
if ($fileextension == $exttypes['php']['php3']['exe']) {         //if the

hmm not sure about this either, you could do:

$exttypes = "|php3|php|exe|";
if (strstr( $exttypes, "|fileextension|")) {

} else {

}

or use explode() and in_array()

file extension equals php, php3, or exe
   echo "mime type doesn't work";                                 //if the
extension is php, php3, exe, than echo doesn't work
   }
   if ($fileextension != $extypes['php']['php3']['exe']) {     //if the
file extension doesn't equal php, php3, or exe than
                                                               // store the
file
       $filelinks = $this->storeFile();
       }

?>


{No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux