Originally posted by slcash
View Post
PHP Code:
$browser = isset($_SERVER['HTTP_USER_AGENT']); // this is just one for this example
$browser = trim($browser); // remove new line
$browser = htmlentities($browser, ENT_QUOTES, 'UTF-8'); // convert html symbols into their entities including both quotes and force utf8 encoding
if (get_magic_quotes_gpc()) $browser = stripslashes($browser); // check if is magic quotes enabled and strip their slashes if is so the data wont be escaped twice
$browser = mysql_real_escape_string($browser); // escape it
but yeah, you will find it usefull for sure..
Leave a comment: