Home  >  Article  >  php教程  >  php 防sql注入过滤代码

php 防sql注入过滤代码

WBOY
WBOYOriginal
2016-06-13 10:11:361009browse

我们提供了三个函数不来过滤一些特殊的字符,主要是利用php把sql敏感字符串给过滤掉了,好了下面来看看这款代码吧。有需要的朋友拿去看看。

我们提供了三个函数不来过滤一些特殊的字符,主要是利用php教程把sql敏感字符串给过滤掉了,好了下面来看看这款代码吧。有需要的朋友拿去看看。

function phps教程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_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;
}

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