Created
February 9, 2018 18:35
-
-
Save matthijs166/bef78f09149323ffefc0f8b1e7f4ea9b to your computer and use it in GitHub Desktop.
Escape a string make it save for saving
This file contains 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
function MakeSafe($unsafestring) | |
{ | |
$unsafestring= htmlentities($unsafestring, ENT_QUOTES); | |
if (get_magic_quotes_gpc()) | |
{ | |
$unsafestring= stripslashes($unsafestring); | |
} | |
$unsafestring= mysql_real_escape_string(trim($unsafestring)); | |
$unsafestring= strip_tags($unsafestring); | |
$unsafestring= str_replace("\r\n", "", $unsafestring); | |
return $unsafestring; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment