First, the most basic SQL injection
Prevent SQL injection functions
Use this function to filter the data submitted to the server side
function Data_filter ($data) {
if (GET_MAGIC_QUOTES_GPC ()) {
return $data = Stripslashes ($data);
}else{
return $data = mysql_real_escape_string ($data);
}
}
Second, a form of their own platform submitted to the library, others can know you this address, he himself in another server to write a form script to the address of the For loop constantly submitted, this address if not to protect, it will cause the database crashes, so we have to think of a way, as follows:
/*
* PHP prevents data from being submitted outside the station to prevent someone from writing a cyclic attack database
* Domain name consistency judgment
*/
function Checkurl () {
$servername =$_server[' server_name ']; Current Server domain name
$sub _from=$_server["Http_referer"]; Server domain name of previous page
$sub _len=strlen ($servername);
$checkfrom =substr ($sub _from,7, $sub _len);
if ($checkfrom! = $servername) Die ("Kid, are you going to get my database through this way?") Think of other ways. F u c k! "); Checksum consistency can be
}
Third, through the browser, submitted the form, the database operation was successful, but he returned through the browser, return to the previous page, and another time to submit data, this will cause a message multiple filling, how to avoid, is simple as follows:
Window.history.forward (1); Added to JS inside, he will not go back,,, can't go back,,, we have become the past can not go back to ...
Some of the offensive issues that websites often encounter are defensive