Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

MakeSafe

DZone's Guide to

MakeSafe

·
Free Resource
Make data safe...among other things


function makeSafe($variable) {
	$variable = htmlentities($variable, ENT_QUOTES);
  	
	if (get_magic_quotes_gpc()) { 
		$variable = stripslashes($variable); 
	}
  	
	$variable = mysql_real_escape_string(trim($variable));
 	$variable = strip_tags($variable);
	$variable = str_replace("\r\n", "", $variable);
 	
	return $variable;
}
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}