"We should never trust user's input", this is what I read from somewhere on the web.
Currently I have a web form, they enter their username and emails. For username field, how to control, check and prevent mysql injection?? Currently, in my php script I only do this:
$username = mysql_real_escape_string($_POST['username']); // prevent mysql injection
I saw some tutorials, before the mysql_real_escape_string function, they include other functions like, htmlentities, etc (could not remember what it is, and I cant found it now, sigh)
Is this a must to include the so called "htmlentities" function before mysql_real_escape_string??
What is your method you usually use for checking user's input data?
Oh ya, some other functions:
stripslashes();
serialize();
urlencode();
Must i include those?