Home > php教程 > php手册 > body text

PHP "完美"的防XSS 防SQL注入的代码 喷

WBOY
Release: 2016-06-21 08:49:37
Original
1187 people have browsed it

哈哈,之前发过一段了,再来一段,单位认为这个项目中这两个代码很牛,可以防止一切代码类的攻击,在此发布出来。求破解,大家加紧破,

 

function gjj($str)
{
    $farr = array(
        "/\\s+/",
        "/]*?)>/isU",
        "/(]*)on[a-zA-Z]+\s*=([^>]*>)/isU",
    );
    $str = preg_replace($farr,"",$str);
    return addslashes($str);
}

function hg_input_bb($array)
{
    if (is_array($array))
    {
        foreach($array AS $k => $v)
        {
            $array[$k] = hg_input_bb($v);
        }
    }
    else
    {
        $array = gjj($array);
    }
    return $array;
}
$_REQUEST = hg_input_bb($_REQUEST);
$_GET = hg_input_bb($_GET);
$_POST = hg_input_bb($_POST);
Copy after login



Related labels:
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