you are here: codestackercodes [RSS]sanitize function

sanitize function

<?
function sanitize($data)
{
	$data = trim($data); 
	if(get_magic_quotes_gpc())
	{
		$data = stripslashes($data);
	}
	$data = mysql_real_escape_string($data);
	return $data;
}

//example
$username = sanitize($_POST['username']);
?>

Comments