From 1f1417373f7358b31f102072392c5c7a7a16f2e8 Mon Sep 17 00:00:00 2001 From: Paul Merrill Date: Tue, 2 Nov 2010 08:59:25 -0700 Subject: [PATCH] Handle uppercase file extensions. --- post.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/post.php b/post.php index c8b51df2..4aceefd9 100644 --- a/post.php +++ b/post.php @@ -27,7 +27,9 @@ $post['thread'] = round($_POST['thread']); } else $OP = true; - if(!(($OP && $_POST['post'] == BUTTON_NEWTOPIC) || (!$OP && $_POST['post'] == BUTTON_REPLY))) error(ERROR_BOT); + if(!(($OP && $_POST['post'] == BUTTON_NEWTOPIC) || + (!$OP && $_POST['post'] == BUTTON_REPLY))) + error(ERROR_BOT); // Check the referrer if($OP) { @@ -49,7 +51,8 @@ // Check for a file if($OP) { - if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name'])) error(ERROR_NOIMAGE); + if(!isset($_FILES['file']['tmp_name']) || empty($_FILES['file']['tmp_name'])) + error(ERROR_NOIMAGE); } $post['name'] = (!empty($_POST['name'])?$_POST['name']:'Anonymous'); @@ -70,7 +73,7 @@ } else $noko = false; if($post['has_file']) { - $post['extension'] = substr($post['filename'], strrpos($post['filename'], '.') + 1); + $post['extension'] = strtolower(substr($post['filename'], strrpos($post['filename'], '.') + 1)); $post['file_id'] = rand(0, 1000000000); $post['file'] = DIR_IMG . $post['file_id'] . '.' . $post['extension']; $post['thumb'] = DIR_THUMB . $post['file_id'] . '.png';