凈化網絡環境:ASP程序實現過濾臟話 - asp語言 -

凈化網絡環境:ASP程序實現過濾臟話

時間:2013-05-09 12:44:05   來源:   評論:加載中...   點擊:加載中...
<!--#include file="../conn/dbconn1.asp"--><!--#include file="../...

<!--#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>

請作者聯系本站,及時附注您的姓名。聯系郵箱:edu#chinaz.com(把#改為@)。



相關熱詞搜索:

 
上一篇:如何用ASP生成XML數據文檔
下一篇:用ASP+XMLHTTP編寫一個天氣預報程序
收藏 將此文推薦給朋友
分享到:
10个数复式三中三多少组公式