以下是添加文件后保存页面的源码 请帮忙看看哪里有限制字符的地方吗???谢谢
!--#include file="articleconn.asp"-->
<%
function changechr(str) '将字符转换成网页能识别的字符
changechr=replace(replace(replace(replace(str,"<","<"),">",">"),chr(13),"<br>")," "," ")
changechr=replace(replace(replace(replace(changechr,"[image]","<img width=516 height=389 src="),"","<b>"),"[red]","<font color=CC0000>"),"[big]","<font size=7>")
changechr=replace(replace(replace(replace(changechr,"[/image]","></img>"),"","</b>"),"[/red]","</font>"),"[/big]","</font>")
end function
function makefilename(fname) '生成文件名函数
fname = now()
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename=fname & ".asp"
end function
%>
<%
'判断是否正确登陆
IF not(Session("KEY")="super" or session("KEY")="check" or Session("KEY")="input") THEN
response.redirect "mymanage.asp"
response.end
END IF
'判断文章标题是否为空
if request("txttitle")="" then
response.write "错误提示:请输入文章标题!"
response.end
end if
'判断文章内容是否为空
if request("txtcontent")="" then
response.write "错误提示:请未输入文章内容!"
response.end
end if
dim title
dim content
dim sql
dim rs
dim articleid
dim classid,Nclassid
dim from
title=request("txttitle")'获取文章标题
from=request("Nfrom")'获取文章的来源
zznews=request("zznews")'获取作者信息
typeid=request("typeid")'获取栏目编号
about=request("about")'获取相关信息关键字
dim sql1
dim rs1
dim typename1
'查询此栏目编号的信息
sql1="select * from type where typeid="&typeid
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,1,1
typename1=rs1("type")
filepath=rs1("typename")
'判断是否为推荐新闻
if request("checkbox1")="1" then
tjnews=1
else
tjnews=2
end if
'判断文章里时候包含图片
if request("checkbox3")="1" then
selectpic=1
else
selectpic=0
end if
'根据登陆时的不同级别,赋予shenhe不同的值
if Session("KEY")="input" then
shenghe=2
else
if request("checkbox2")="1" then
shenghe=2
else
shenghe=1
end if
end if
'将输入框中的文章内容转换成网页格式的内容
content=changechr(request("txtcontent"))
%>
<%
'查询模板表,将选择的模板调出来
set rs = server.CreateObject("ADODB.RecordSet")
StrSql = "select E_Memo from Example where id="+request("Example")
set rs = conn.Execute (StrSql)
'生成新闻文件名
fname = makefilename(now())
dddd = year(now()) & "-" & month(now()) & "-" & day(now())
'将模板内容赋给pencat
pencat=rs("E_Memo")
'将模板中lx替换为类型名称typename1
pencat=replace(pencat,"lx",typename1)
'将模板中Data替换为实际日期dddd
pencat=replace(pencat,"Date",dddd)
if from="" then
pencat=replace(pencat,"From","吉首助学网") '若来源为空,则将模板中的From替换为吉首助学网
else
pencat=replace(pencat,"From",from)'若不为空,则将输入的文章来源替换模板中的From
end if
if zznews="" then
pencat=replace(pencat,"Fname","jszxw") '若作者为空,则将模板中的Fname替换为网站管理员
else
pencat=replace(pencat,"Fname",zznews)'若不为空,则将输入的作者名替换模板中的Fname
end if
'将模板中H_Title替换为实际文章标题
pencat=replace(pencat,"H_Title",title)
'将模板中H_Memo替换为实际文章内容
pencat=replace(pencat,"H_Memo",content)
'将模板中labout替换为实际关键字
pencat=replace(pencat,"labout",about)
%>
<%
'将替换好的模板写进文件中
Set fso = CreateObject("Scripting.FileSystemObject")
gg=server.mappath(filepath)
Set MyFile = fso.CreateTextFile(gg&"\"&fname, True)
MyFile.WriteLine(pencat)
MyFile.Close
response.Write(gg&"\"&fname)
%>
<%
'在数据库中增加一条文章记录
set rs=server.createobject("adodb.recordset")
sql="select * from article where (newsid is null)"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("path")=filepath
rs("content")=content
rs("Nfrom")=from
rs("selectpic")=selectpic
rs("typeid")=typeid
rs("typename")=typename1
rs("tjnews")=tjnews
rs("shenghe")=shenghe
rs("N_Fname")=fname
rs("zznews")=zznews
rs("about")=about
rs.update
articleid=rs("newsid")
rs1.close
set rs1=nothing
rs.close
set rs=nothing
conn.close
set conn=nothing
response.Write("ok")
%><head>
</head>
<div align="center">
<table border="0" cellspacing="1" width="50%" bgcolor="#000000" bordercolorlight="#11B1FF"
bordercolordark="#F0F8FF" cellpadding="0">
<tr bgcolor="#000066">
<td width="100%" height="20" bgcolor="#006633">
<p align="center"><font color="#FFFFFF"><b>添加文章成功</b></font>
</td>
</tr>
<tr>
<td width="100%" bgcolor="#FFFFFF">
<p align="left"><br>
其文件名为:<%=fname%><br>
文件标题为:<%response.write title%></p>
<p align="center">是否继续添加?<br>
<br>
<a href="myaddarticle.asp">
是</a> <a href="mymanage.asp">否</a><br>
<br>
</p>
</td>
</tr>
</table></div>