Strip Tags & Protect Against Injection Attacks

Whilst this is not a perfect way to protect against attacks, it is a step.

function clean_input($input) {
	// note, needs a MySQL connection
	$clean = strip_tags($input);
	$cleaner = mysql_real_escape_string($clean);
	
	return $cleaner;
}

Best used wrapped around a string. e.g. clean_input($string);

Posted at 3:01 on 2 th July 2009