rs2("badwords") 这个字段在数据库怎么存储的?也就是以什么样是存储的。
varchar
yms123------------------我就是按你给的代码写的! 表:badword 有2列:ID,badwords(varchar)如(1 aaa)
Sqltr="select badwords from badword"
Set rs2= Server.CreateObject("ADODB.RecordSet")
rs2.open Sqltr,Conn,1,1
dim bad
bad=rs2("badwords")
function IsRoll(BodyStr)
dim RollStr,Ibound,tBody
RollStr=array(bad)
Ibound=Ubound(RollStr)
for i=0 to Ibound
tBody=Replace(BodyStr,RollStr(i),"")
next
If tBody=BodyStr Then
IsRoll=True
Else
IsRoll=False
End IF
end function
Set rs= Server.CreateObject("ADODB.RecordSet")
if request.Form("Tag")="1" then
InformationID=request.Form("CaseID")
GBookTitle="'"&tosql(request.Form("GBookTitle"))&"'"
GBookBody="'"&tosql(request.Form("GBookBody"))&"'"
webaddress="'"&tosql(request.Form("webaddress"))&"'"
email="'"&tosql(request.Form("email"))&"'"
GBookType=tosql(request.Form("GBookType"))
ip="'"&request.ServerVariables("REMOTE_ADDR")&"'"
UserName="'"&tosql(request.Form("UserName"))&"'"
Relation="'"&tosql(request.Form("Relation"))&"'"
if IsRoll(GBookBody) or IsRoll(GBookTitle) then
response.Write("<script language='JavaScript'>alert('有违规内容')</script>")
else
'保存留言
SQLStr="Insert Into InformationGBook(InformationID,GBookTitle,GBookBody,webaddress,email,GBookType,ip,Relation,UserName)"
SQLStr=SQLStr&" Values("&InformationID&","&GBookTitle&","&GBookBody&","&webaddress&","&email&","&GBookType&","&ip&","&Relation&","&UserName&");"
SQLStr=SQLStr&"Update InformationBody Set InformationReply=InformationReply+1 "
SQLStr=SQLStr&"Where ID ="&CStr(InformationID)
Conn.execute(SQLStr)
response.Write("<script language='JavaScript'>alert('留言成功')</script>")
end if
end if
CaseID=request("CaseID")
if isnull(request("CaseID")) or isEmpty(request("CaseID")) or request("CaseID")="" then
CaseID=0
end if
SQLStr="Select * From EnterpriseBody Where ID="&CStr(CaseID)
rs.Open SQLStr,Conn,1,1
太感谢了!这个没问题!我是asp菜鸟!以后跟你多学的!