当前位置: 首页 > 图文教程 > 网络编程 > ASP > 净化网络环境:ASP程序实现过滤脏话

ASP
ASP编程中15个非常有用的例子 (二)
ASP与JSP的比较(一)
ASP与JSP的比较(二)
ASP中五种连接数据库的方法
从ASP调用SQL中的图像
用排序串字段实现树状结构(例程:连接字串)
用排序串字段实现树状结构(例程:删除贴子)
用排序串字段实现树状结构(例程:回复表单)
用排序串字段实现树状结构(例程:显示贴子内容)
用排序串字段实现树状结构(例程:显示树)
用排序串字段实现树状结构(存储过程)
用排序串字段实现树状结构(库结构)
用排序串字段实现树状结构(原理)
remote script文档(转载自微软)(一)
remote script文档(转载自微软)(二)
remote script文档(转载自微软)(三)
remote script文档(转载自微软)(四)
remote script文档(转载自微软)(五)
remote script文档(转载自微软)(六)
remote script文档(转载自微软)(七)

净化网络环境:ASP程序实现过滤脏话


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 122 ::
收藏到网摘: n/a

<!--#include file="../conn/dbconn1.asp"-->
<!--#include file="../inc/safe.asp"-->
<%
content=Replace_Text(request.Form("content"))
content=replace(content,"<","[")
content=replace(content,">","]")

newsid=Replace_Text(request.Form("newsid"))
ip=request.Form("ip")
rname=Replace_Text(request.Form("rname"))
rname=replace(rname,"<","[")
rname=replace(rname,">","]")
'username=Replace_Text(request.Form("username"))
'username=replace(username,"<","[")
'username=replace(username,">","]")

'处理发表内容是脏话
set rs=server.CreateObject("adodb.recordset")
sql="select * from badword"
rs.open sql,conn,3,3
if rs.eof then
response.Write("mei ziliao!")
else

on error resume next
do while not rs.bof and not rs.eof
content=replace(content,rs.fields("word").value,"**")
rname=replace(rname,rs.fields("word").value,"**")
rs.movenext
loop
end if
rs.close
set rs=nothing

''''''''''''''''''''''''''''''

set rs=server.CreateObject("ADODB.RecordSet")
sql="select * from pl"
rs.open sql,conn,3,3
rs.addnew
rs("content")=content
rs("newsid")=newsid
rs("ip")=ip
rs("rname")=rname
rs("username")=username
rs.update
rs.close
%>
<%
set rsn=server.CreateObject("adodb.recordset")
sqln="select newsid,plnum,plbz from news where newsid="&newsid&""
rsn.open sqln,conn,1,3
rsn("plnum")=rsn("plnum")+1
rsn("plbz")=1
rsn.update
rsn.close
%>
<script>
alert("成功发布!")
parent.location.href="shownews.asp?newsid=<%=newsid%>"
</script>