2009-09-19, 02:16 AM
to check a file extension
the get used in the example above is for test on my localhost
the actual place this code is used has $t being filled via POST through $mybb->input and then "basename".
can this be beat
example
name.txt --- ok
name.exe.txt ---nope
if its not any suggestions --- get_extension in mybb functions.php is very complex
$t = $_GET['name'];
$y = explode(".",$t);
if(count($y) > 2)
{
die()
}
else
{
//do my thing
}
the get used in the example above is for test on my localhost
the actual place this code is used has $t being filled via POST through $mybb->input and then "basename".
can this be beat
example
name.txt --- ok
name.exe.txt ---nope
if its not any suggestions --- get_extension in mybb functions.php is very complex