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

php 防sql注入过滤代码

WBOY
Release: 2016-06-13 10:11:36
Original
1057 people have browsed it

我们提供了三个函数不来过滤一些特殊的字符,主要是利用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;
}

source:php.cn
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template