From 61303915feb8e5f833205722e91138d6224a2240 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Mon, 18 Nov 2019 18:26:36 -0800 Subject: [PATCH] Check for magic quotes only when running running on PHP pre-5.3 Fixes #92 --- imgboard.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/imgboard.php b/imgboard.php index 2366619..cfb21fb 100644 --- a/imgboard.php +++ b/imgboard.php @@ -14,17 +14,19 @@ if (function_exists('ob_get_level')) { } } -if (get_magic_quotes_gpc()) { - foreach ($_GET as $key => $val) { - $_GET[$key] = stripslashes($val); +if (version_compare(phpversion(), '5.3.0', '<')) { + if (get_magic_quotes_gpc()) { + foreach ($_GET as $key => $val) { + $_GET[$key] = stripslashes($val); + } + foreach ($_POST as $key => $val) { + $_POST[$key] = stripslashes($val); + } } - foreach ($_POST as $key => $val) { - $_POST[$key] = stripslashes($val); + if (get_magic_quotes_runtime()) { + set_magic_quotes_runtime(0); } } -if (get_magic_quotes_runtime()) { - set_magic_quotes_runtime(0); -} function fancyDie($message) { die('
' . $message . '


- Click here to go back -');