程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> ASP技巧 >> 淨化網絡環境 ASP程序實現過濾髒話

淨化網絡環境 ASP程序實現過濾髒話

編輯:ASP技巧

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


 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved