[求助]如何替换掉非法字符,我在论坛上没有搜索到就来请教了
高手可以举例吗
还有就是替换非法字符的代码一般是放在处理信息的文件里还是放在输出信息的文件里呢
新手上路问题多多
那个是什么 这样写对吗
<%
function con(contentTemp,length)
length=Cint(length)
contentTemp=replace(contentTemp,"'","''")
contentTemp=replace(contentTemp,chr(34),"""")
contentTemp=replace(contentTemp,"&","&")
contentTemp=replace(contentTemp," "," ")
contentTemp=replace(contentTemp,"<","<")
contentTemp=replace(contentTemp,">",">")
if len(contentTemp)>length then
contentTemp=left(contentTemp,length)
end if
com=contentTemp
end function
%>
<%
dim title,con
title=request.form("title")
con=request.form("con")
if trim(title)="" or trim(con)="" then
response.write"所填标题和内容不能为空"
else
set rs= Server.CreateObject("adodb.recordset")
sql= "select * from guestbook"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("con")=con
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write("<A HREF=list.asp>返回</A>")
end if
%>
[此贴子已经被作者于2006-1-25 15:20:57编辑过]