One of my websites has recently, and is (ongoing) continuously, under attack. A JavaScript script is being inserted into the MySQL database somehow.
I am using the following:
$unsafe_variable = addslashes(htmlspecialchars(strip_tags(mysql_real_escape_string($_POST['user_input']))));
mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')");
However, the hacker is still able to insert a "script" tag. I have no idea how. I have a word filter and blacklisted the word "script", which gets blocked when I post a test to the site. How is he/she able to get it through?
The above is a screenshot of the entry into the database. Anyone have any ideas on how I can prevent this?