| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 591 人关注过本帖
标题:[求助]正文255字符限制
只看楼主 加入收藏
txrock
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-21
收藏
 问题点数:0 回复次数:1 
[求助]正文255字符限制

以下是添加文件后保存页面的源码 请帮忙看看哪里有限制字符的地方吗???谢谢

!--#include file="articleconn.asp"-->
<%
function changechr(str) '将字符转换成网页能识别的字符
changechr=replace(replace(replace(replace(str,"<","&lt;"),">","&gt;"),chr(13),"<br>")," ","&nbsp;")
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>&nbsp;&nbsp; <a href="mymanage.asp">否</a><br>
<br>
</p>
</td>
</tr>
</table></div>

搜索更多相关主题的帖子: replace 字符 正文 changechr 
2005-12-21 15:02
txrock
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2005-12-21
收藏
得分:0 

这是模板源码 :


<!--#include file="../top1.asp" -->
<title>H_Title</title><html>
<head>
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
font.yytei {
line-height: 20pt;
font-size: 12pt;
}
-->
</style>
</head>

<body leftmargin="0" topmargin="0">
<br>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td></td>
<td valign="top">您的位置: <a href="../">首页</a> - lx</td>
<td></td>
<td rowspan="6" valign="top">
<!--#include file="../topright1.asp" -->
</td>
</tr>
<tr>
<td width="20"> </td>
<td width="529" valign="top"><div align="center"><font color="#000066" size="4"><strong><font color="#000099"><br>
H_Title</font></strong></font></div></td>
<td width="20"> </td>
</tr>
<tr>
<td> </td>
<td valign="top"><div align="right"><br><font class="yyteidate">
Date From Fname</font> </div>
<hr size="1" color="#003300" noshade> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><font class="yytei">H_Memo</font></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right" valign="top"> <hr size="1" color="#006600" noshade>
【<a href="../addreview.asp?id=H_Title">发表评论</a>】 【<a href="../review.asp?title=H_Title">查看评论</a>】
【<a href="../sendmail.asp?num=H_Title">发给好友</a>】 【<a href="javascript:window.close()">关闭窗口</a>】</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td valign="top"> <script language="javascript" src="../about.asp?about=labout&title=H_Title"></script>
</td>
<td> </td>
</tr>
</table>
</body>
</html>
<!--#include file="../topy.asp"-->

2005-12-21 15:04
快速回复:[求助]正文255字符限制
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.041071 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved