There are a lot of ways here to secure your code from SQL injection attack. But what I require is How to log sql injection attack so that we can add him(the attacker-user) in the blacklist-users database.
What I need here, is a kind of function which will return true if there's a sql injection.
<?php
if(isset($_POST['username'])){
// need a function here which will return true if there's
// a sql injection else false
}
?>