Created
November 14, 2021 18:46
-
-
Save stevesohcot/66cf528d606e6449f59e6479b1b332b5 to your computer and use it in GitHub Desktop.
PHP SQL Injection Prevention - function to sanitize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function quote_smart($db_connection, $value) { | |
| if( get_magic_quotes_gpc() ) | |
| $value = stripslashes( $value ); | |
| $value = mysqli_real_escape_string($db_connection, $value ); | |
| $value = strip_tags($value); | |
| $value = htmlspecialchars($value); | |
| $value = trim($value); | |
| return $value; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment