不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
PJBlog2 v2.6 build 02 的一些修改
编辑:dnawo 日期:2007-04-18
在使用PJBlog2 v2.6 build 02过程中发现了一些问题,大都是字符过滤不严,下边针对这些问题提出一些修改方法:
一、搜索关键字没有过滤<和>
程序对搜索关键字使用CheckStr函数(位于common/function.asp)进行过滤,CheckStr函数却没有对<和>进行过滤,在给CheckStr增加<和>过滤后发现发表文章就出问题了,浏览时出现了很多的<br>,只能直接修改search.asp文件了,在第44句:SearchContent=CheckStr(Request.QueryString("SearchContent"))后增加如下代码即可。
二、评论关键字过滤严
对评论内容程序中采用了JS进行过滤,使用的是CheckPost函数(位于common/common.js),但实际中并未起到作用,比如很多垃圾广告留言格式都是[ url]www.mzwu.com[ /url],CheckPost都通过了,增强了它的过滤功能后却发表不了文章了:(,看来发表文章时也是用这个函数过滤的,一种思路是写过一个函数,但我很快就发现程序中竟没阻止外部提交!只有前台验证根本不够,打开blogcomm.asp修改如下:
一、搜索关键字没有过滤<和>
程序对搜索关键字使用CheckStr函数(位于common/function.asp)进行过滤,CheckStr函数却没有对<和>进行过滤,在给CheckStr增加<和>过滤后发现发表文章就出问题了,浏览时出现了很多的<br>,只能直接修改search.asp文件了,在第44句:SearchContent=CheckStr(Request.QueryString("SearchContent"))后增加如下代码即可。
复制内容到剪贴板
程序代码

SearchContent = Replace(SearchContent,">",">")
SearchContent = Replace(SearchContent,"<","<")
SearchContent = Replace(SearchContent,"<","<")
二、评论关键字过滤严
对评论内容程序中采用了JS进行过滤,使用的是CheckPost函数(位于common/common.js),但实际中并未起到作用,比如很多垃圾广告留言格式都是[ url]www.mzwu.com[ /url],CheckPost都通过了,增强了它的过滤功能后却发表不了文章了:(,看来发表文章时也是用这个函数过滤的,一种思路是写过一个函数,但我很快就发现程序中竟没阻止外部提交!只有前台验证根本不够,打开blogcomm.asp修改如下:
复制内容到剪贴板
程序代码

'增加函数firestr
function firestr(strContent)
firestr = false
if instr(strContent,"www")<>instrRev(strContent,"www") then
firestr = true
exit function
end if
if instr(strContent,"url")<>instrRev(strContent,"url") then
firestr = true
exit function
end if
if instr(strContent,"http")<>instrRev(strContent,"http") then
firestr = true
exit function
end if
end function
'postcomm函数内找到post_Message=CheckStr(request.form("Message")),在其后面增加下边语句
If firestr(post_Message)=true then
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>内容中含有非法字符!</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
function firestr(strContent)
firestr = false
if instr(strContent,"www")<>instrRev(strContent,"www") then
firestr = true
exit function
end if
if instr(strContent,"url")<>instrRev(strContent,"url") then
firestr = true
exit function
end if
if instr(strContent,"http")<>instrRev(strContent,"http") then
firestr = true
exit function
end if
end function
'postcomm函数内找到post_Message=CheckStr(request.form("Message")),在其后面增加下边语句
If firestr(post_Message)=true then
ReInfo(0)="评论发表错误信息"
ReInfo(1)="<b>内容中含有非法字符!</b><br/><a href=""javascript:history.go(-1);"">请返回重新输入</a>"
ReInfo(2)="ErrorIcon"
postcomm=ReInfo
exit function
end if
评论: 1 | 引用: 0 | 查看次数: 4800
发表评论
请登录后再发表评论!