满意答案
db="data.mdb"
set conn=server.createobject("Adodb.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db)
conn.open connstr
set rs=server.createobject("adodb.recordset")
sql="select * from 表"
rs.open sql,conn,1,3
do while rs.eof=false
rs("字段一")=Html2Ubb(rs("字段一")) '在这里使用Html2Ubb函数将字段的数据转换成纯文本形式后写入数据库
rs("字段二")=Html2Ubb(rs("字段二"))
rs("字段三")=Html2Ubb(rs("字段二"))
rs.update
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
Public Function Html2Ubb(ByVal strContent)
On Error Resume Next
If Len(strContent) > 0 Then
Dim re
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
'--清除script脚本
If CInt(ArrayCodes(0)) = 1 Then
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有iframe框架
If CInt(ArrayCodes(1)) = 1 Then
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有object对象
If CInt(ArrayCodes(2)) = 1 Then
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有java applet
If CInt(ArrayCodes(3)) = 1 Then
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有div标签
If CInt(ArrayCodes(4)) = 1 Then
re.Pattern = "(
strContent = re.Replace(strContent, "")
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有font标签
If CInt(ArrayCodes(5)) = 1 Then
re.Pattern = "()|()"
strContent = re.Replace(strContent, "")
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有span标签
If CInt(ArrayCodes(6)) = 1 Then
re.Pattern = "()|()"
strContent = re.Replace(strContent, "")
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有A标签
' If CInt(ArrayCodes(7)) = 1 Then
re.Pattern = "()|()"
strContent = re.Replace(strContent, "")
re.Pattern = "()"
strContent = re.Replace(strContent, "")
' End If
'--清除所有img标签
If CInt(ArrayCodes(8)) = 1 Then
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有FORM标签
If CInt(ArrayCodes(9)) = 1 Then
re.Pattern = "(
)|()"strContent = re.Replace(strContent, "")
re.Pattern = "()"
strContent = re.Replace(strContent, "")
End If
'--清除所有HTML标签
If CInt(ArrayCodes(10)) = 1 Then
re.Pattern = "]*)>"
strContent = re.Replace(strContent, "")
End If
re.Pattern = "(" & Chr(8) & "|" & Chr(9) & "|" & Chr(10) & "|" & Chr(13) & ")"
strContent = re.Replace(strContent, vbNullString)
re.Pattern = "()"
strContent = re.Replace(strContent, vbNullString)
re.Pattern = "(
)"strContent = re.Replace(strContent, "")
re.Pattern = "()"
strContent = re.Replace(strContent, "")
re.Pattern = "(
strContent = re.Replace(strContent, "
re.Pattern = "(" & Chr(37) & ">)"
strContent = re.Replace(strContent, "%>")
Set re = Nothing
Html2Ubb = strContent
Else
Html2Ubb = ""
End If
Exit Function
End Function
%>
00分享举报