Possible Duplicate:
Best way to prevent SQL injection?
For logging in:
$username = mysql_real_escape_string(htmlspecialchars(strip_tags(trim($_POST['username'])), ENT_QUOTES));
$password = mysql_real_escape_string(htmlspecialchars(strip_tags(trim($_POST['password'])), ENT_QUOTES));
For inserting data I re-use the same mysql_real_escape_string(htmlspecialchars(strip_tags(trim(...
I feel like this is bad practice because I'm using so many functions... Is this the right way to protect against mysql injection & prevent xss injection? Or is it completely overboard? Everything works fine and nothing is broke--my question really is, am I using things that are obsolete when paired together? Is there only one function that I should use for the job?
Thanks.