Re: does this code look like it would check a file extensions, and disallow php files or exe files to be attached
| From: | clive | Date: | Thu, 14 Jun 2007 12:41:10 +0000 |
| Subject: | Re: does this code look like it would check a file extensions, and disallow php files or exe files to be attached | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256987@lists.php.net to get a copy of this message | ||
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 nameok 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.
no should be: fileextension = substr($filelinks, strpos($filelinks,".")+1 , strlen($filelinks));$exttypes = "php3,php,exe"; // list ofextensions that shouldnt be used$fileextension = substr($filelinks,0,strpos($filelinks,".")); //get the
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{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.}echo "mime type doesn't work"; //if theextension is php, php3, exe, than echo doesn't work }if ($fileextension != $extypes['php']['php3']['exe']) { //if thefile extension doesn't equal php, php3, or exe than// store thefile$filelinks = $this->storeFile(); }?>