Added input checking for file include!

This commit is contained in:
laf
2014-06-14 23:46:17 +01:00
parent 911647d08c
commit f8eadb9b9a
+7 -3
View File
@@ -24,9 +24,13 @@ include_once("includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
if(file_exists('forms/'.$_POST['type'].'.inc.php'))
{
include_once('forms/'.$_POST['type'].'.inc.php');
if(preg_match("/^[a-zA-Z0-9\-]+$/", $_POST['type']) == 1) {
if(file_exists('forms/'.$_POST['type'].'.inc.php'))
{
include_once('forms/'.$_POST['type'].'.inc.php');
}
}
?>