Home >Backend Development >PHP Tutorial >他是怎么绕过注册10字符限制的?

他是怎么绕过注册10字符限制的?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:51:101031browse

我看到是很多空格。。。
但是正常的输入空格没道理会成功的。。

有爱好者来帮我找找原因吧。
链接地址
http://bbs.youyax.com/Content-5511

关于过滤的写法

public function transform($txt)    {        $txt = trim($txt);        $txt = addslashes(htmlspecialchars($txt, ENT_QUOTES, "UTF-8"));        if (preg_match_all("/\          <p class="yy">           Quote:       (.+?)\[\/quote]/is", $txt, $match)) {             $txt = preg_replace('/\s*\r\n\s*/', '', $txt, 1);         }         $huanhang = array(             "\r\n",             "\n",             "\r"         );         $txt      = str_replace($huanhang, '<br>', $txt);             </p>


回复讨论(解决方案)

csdn的代码高亮有问题

public function transform($txt)    {        $txt = trim($txt);        $txt = addslashes(htmlspecialchars($txt, ENT_QUOTES, "UTF-8"));        if (preg_match_all("/\          <p class="yy">           Quote:       (.+?)\[\/quote]/is", $txt, $match)) {             $txt = preg_replace('/\s*\r\n\s*/', '', $txt, 1);         }         $huanhang = array(             "\r\n",             "\n",             "\r"         );         $txt      = str_replace($huanhang, '<br>', $txt);             </p>

public function transform($txt)
    {
        $txt = trim($txt);
        $txt = addslashes(htmlspecialchars($txt, ENT_QUOTES, "UTF-8"));
        if (preg_match_all("/\

Quote: (.+?)\[\/quote]/is", $txt, $match)) {
            $txt = preg_replace('/\s*\r\n\s*/', '', $txt, 1);
        }
        $huanhang = array(
            "\r\n",
            "\n",
            "\r"
        );
        $txt      = str_replace($huanhang, '
', $txt);

你为什么会认为是 n 个半角空格呢?

你为什么会认为是 n 个半角空格呢?


我在最后输出来的时候又加了这个
$txt = preg_replace('/\s{2,}/', ' ', $txt);
不知道行不行了?

说错了,不是注册10字符,是发帖回帖10字符

图片显示:文字到省略号间有一段空白
连浏览器都不认为是半角空格,你还 \s 有何用?

再说你的 transform 方法也没有检查长度

图片显示:文字到省略号间有一段空白
连浏览器都不认为是半角空格,你还 \s 有何用?


多谢版主指点,果然是全角空格,以前这种过滤都没留意过,涨知识了
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