PDA

View Full Version : [PHP] CLEAN FUNCTION



Dentafrice,
01-10-2007, 10:44 PM
Could someone provide me a function that will clean through posted text. I will add it to my class.

Invent
02-10-2007, 12:03 AM
class misc
{

function clean($var)
{

$var = htmlspecialchars( $var, ENT_QUOTES );

if( get_magic_quotes_gpc( ) ) {

$var = stripslashes( $var );

}

$var = str_replace( "\"", "", $var );
$var = htmlentities( $var );
$var = mysql_real_escape_string( $var );

return $var;

}
}


Don't know why I posted it in a class...but there you go.

Invent
02-10-2007, 12:06 AM
Sorry, internet messed up and I didn't think the post was made -.-

Dentafrice,
02-10-2007, 12:14 AM
It was :)

Thanks mate +REP

Want to hide these adverts? Register an account for free!