File Upload Security Fix bei HTML-Tags in Filenamen

This commit is contained in:
Andreas Österreicher
2010-09-22 15:26:14 +00:00
parent 06e585916c
commit 9a80d09cf2
2 changed files with 109 additions and 86 deletions
+16
View File
@@ -761,4 +761,20 @@ function mb_str_replace( $needle, $replacement, $haystack )
}
return $haystack;
}
/**
*
* Prueft ob es sich um einen gueltigen Filenamen handelt
* Filenamen mit HTML-Tags oder sonstigem Schadcode sind nicht gueltig
*
* @param string $filename
* @return boolean true wenn gueltig, sonst false
*/
function check_filename($filename)
{
if(!preg_match('/^(\d|\w|\s|[-_.,ÄÜÖäüö!?])*$/',$filename))
return false;
else
return true;
}
?>