diff --git a/functions.php b/functions.php index f48b587c..9c197841 100644 --- a/functions.php +++ b/functions.php @@ -625,3 +625,18 @@ function checkFileUpload($file, $allowed_extensions) return md5(time() . $name) . '.' . $extension; } + +function sanitizeInput($input) { + global $mysqli; + // Remove white space from beginning and end of input + $input = trim($input); + + // Remove HTML and PHP tags + $input = strip_tags($input); + + // Escape special characters + $input = mysqli_real_escape_string($mysqli, $input); + + // Return sanitized input + return $input; +} diff --git a/models/contact.php b/models/contact.php index 1a2af870..d9992c2c 100644 --- a/models/contact.php +++ b/models/contact.php @@ -1,16 +1,17 @@