Home  >  Article  >  Backend Development  >  Very useful php function to prevent SQL injection_PHP tutorial

Very useful php function to prevent SQL injection_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:40:26871browse

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}...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn