Got a question for you.
I've read a lot of articles on security before I began development on my new project, and after a lot of reading, I saw that both htmlspecialchars() and mysql_real_escape_string() are both good for stopping SQL injections and XSS attacks.
So I put the two together to get this function:
//--------------------
// Security Function for inputs
//--------------------
function escape($str) {
return htmlspecialchars(mysql_real_escape_string($str));
}
Then I use them when using POST and GET, ect.Just out of curiosity, as I know there are some good PHP developers here... is this a good function to use? Any input or enhancements on this would be good to hear.
Look forward to a reply.
- Chris.
