Home > Article > Backend Development > Very useful php function to prevent SQL injection_PHP tutorial
Very useful sql injection function
function inject_check($sql_str) {
return eregi(select| insert|update|delete||/*|*|../|./|union|into|load_file
|outfile, $sql_str); // Filter
> $check=eregi(select|insert|update|delete||/*|*|../|./|union|into|load_file|outfile, $sql_str); // Filter
if($check){
echo "Enter illegal injection content!";
exit();
}else{
return $sql_str;
}
}
PHP built-in functions can be used addslashes() implements the same function as the above function.
http://www.bkjia.com/PHPjc/486218.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/486218.html
TechArticle
Very useful sql injection function?php function inject_check($sql_str) { return eregi(select|insert|update |delete||/*|*|../|./|union|into|load_file |outfile, $sql_str); // Filter}...