mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Added inputSantize function to trim SQL escape and Strip Tags when string enter the database and to tidy up the code
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user