ASP程序实现过滤脏话代码

作者:海啸 来源:海啸博客 时间:2008-03-19 12:07:00 

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>

标签:过滤,asp
0
投稿

猜你喜欢

  • Web Forms 2.0

    2008-07-24 12:47:00
  • 利用Pandas和Numpy按时间戳将数据以Groupby方式分组

    2022-01-04 01:47:44
  • Win10系统下Pytorch环境的搭建过程

    2023-09-29 06:57:54
  • js 采用delete实现继承示例代码

    2023-07-17 09:06:52
  • SuperSocket 信息: (SpnRegister) : Error 1355。解决方法

    2024-01-17 22:54:02
  • Python取出字典中的值的实现

    2022-01-09 20:16:07
  • 12个对网页设计师非常有用的图片优化工具[译]

    2009-09-22 14:29:00
  • python @classmethod 的使用场合详解

    2023-08-02 20:50:35
  • 详解Python中的正斜杠与反斜杠

    2021-06-28 08:38:10
  • 效控制C#中label输出文字的长度,自动换行

    2023-07-22 04:02:49
  • python使用rpc框架gRPC的方法

    2021-02-28 06:28:37
  • python模拟登录百度代码分享(获取百度贴吧等级)

    2022-05-13 02:54:34
  • Oracle常见错误代码的分析与解决

    2024-01-14 20:28:51
  • python用BeautifulSoup库简单爬虫实例分析

    2022-04-02 21:42:00
  • Python使用matplotlib绘图无法显示中文问题的解决方法

    2023-07-30 22:16:30
  • python学习之whl文件解释与安装详解

    2021-11-01 18:09:14
  • js实现axios限制请求队列

    2024-05-10 13:59:31
  • python设置表格边框的具体方法

    2023-11-13 08:08:48
  • Python定义一个跨越多行的字符串的多种方法小结

    2022-08-04 03:34:27
  • Python在字典中查找元素的3种方式

    2023-08-07 21:33:35
  • asp之家 网络编程 m.aspxhome.com