Home > Backend Development > PHP Tutorial > PHP anti-sql injection filtering code_PHP tutorial

PHP anti-sql injection filtering code_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:09:44
Original
903 people have browsed it

We provide three functions to filter out some special characters. They mainly use PHP to filter out SQL sensitive strings. Let’s take a look at this code. Friends in need take it and take a look.

We provide three functions to filter out some special characters. We mainly use the PHP tutorial to filter out SQL sensitive strings. Let’s take a look at this code. Friends in need take it and take a look.

function phps tutorial ql_show($str){
$str = stripslashes($str);
$str = str_replace("\", "", $str);
$str = str_replace("/", "/", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace(",", ",", $str);
return $str;
}
function phpsql_post($str){
$str = stripslashes($str);
$str = str_replace("|", "|", $str);
$str = str_replace("<", "<", $str);
$str = str_replace(">", ">", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace("(", "(", $str);
$str = str_replace(")", ")", $str);
$str = str_replace("`", "`", $str);
//$str = str_replace("'", "'", $str);
$str = str_replace('"', """, $str);
$str = str_replace(",", ",", $str);
$str = str_replace("$", "$", $str);
$str = str_replace("", "\", $str);
$str = str_replace("/", "/", $str);
return $str;
}
function phpsql_replace($str){
$str = stripslashes($str);
$str = str_replace("'", "'", $str);
return $str;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629732.htmlTechArticleWe provide three functions to filter some special characters, mainly using php to filter sql sensitive strings It's been filtered out, okay let's take a look at this code. Take it to friends in need...
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template