校园学生学习娱乐资源第一门户 校园第一站 源于校园 服务于校园 分享资源和快乐 网站地图 高级搜索 RSS订阅 收藏本站 设为首页
首页 | 校园 | 教育 | 考试 | 电脑 | 英语 | 读书 | 就业 | 论文 | 体育 | 健康 | 图片 | 分类信息
Q Q | 下载 | 游戏 | 音乐 | 影视 | 专题 | 祝福 | 百科 | 问答 | 博客 | 会员 | 社区 | 校园论坛
·偶像剧免费在线收看
·DEDECMS免费模板规则下载
·
·全能空间、网站建设仅200
XML | 文章搜索:
  当前位置: 主页>电脑>网络编程>ASP> 文章正文

用文本+ASP打造新闻发布系统

http://www.xydyz.com 来源:校园第一站 2007-11-12 阅读: 评论



'Fields("xxx").ContentType 如果是file Object 取得文件的类型
'Fields("xxx").Length 取得Form中xxx(Form Object)的数据长度
'Fields("xxx").Value 取得Form中xxx(Form Object)的数据内容
Dim FormData,FormSize,gnote,bnote,notes,binlen,binstr
FormSize=Request.TotalBytes
FormData=Request.BinaryRead(FormSize)
Set Fields = GetUpload(FormData)
'############判断输入错误
dim news_title,news_content,news_src,mysession

mysession=Fields("mysession").value
if len(mysession)=0 then
Response.Write "非法登陆或超时请重新登陆"
Response.End
end if

news_title=Fields("news_title").value
news_title=replace(news_title,"|","|")
news_content=Fields("news_content").value
news_src=Fields("news_src").value
news_src=replace(news_src,"|","|")
if len(news_title)=0 then%〉
〈script〉
alert("出错!新闻标题不能为空");
history.go(-1);
//window.location="news_add.asp";
〈/script〉
〈%Response.end
end if

if len(news_content)=0 then%〉
〈script〉
alert("出错!新闻内容不能为空");
history.go(-1);
〈/script〉
〈%end if

if len(news_src)=0 then%〉
〈script〉
alert("出错!新闻来源不能为空");
history.go(-1);
〈/script〉
〈%Response.end
end if

dim varchar
varchar=right(Fields("server1").value,3)
if len(varchar)〈〉0 then
if varchar〈〉"gif" and varchar〈〉"jpg" then
%〉
〈script〉
alert("出错!不能上传该图片类型");
history.go(-1);
〈/script〉
〈% Response.end
else
end if
end if
'###########将图片写入文件夹

set file_O=Server.CreateObject("Scripting.FileSystemObject")

'##########当前时间做图片名
dim newname,mytime,newfile,filename,id,image
endname=right(fields("server1").value,4)
mytime=now()
id=Year(mytime)&Month(mytime)&Day(mytime)&Hour(mytime)&Minute(MyTime)&Second(MyTime)
imageid=id&endname

'#############写入图片
newfile="client1"
filename=Fields("server1").value

If Fields(newfile).FileName〈〉"" Then
file_name=Server.MapPath("./images/"&imageid&"")
set outstream=file_O.CreateTextFile(file_name,true,false)
binstr=Fields(newfile).Value
binlen=1
varlen=lenb(binstr)
for i=1 to varlen
clow = MidB(binstr,i,1)
If AscB(clow) = 255 then
outstream.write chr(255)
binlen=binlen+1
if (i mod 2)=0 then
notes=gnote
exit for
end if
elseif AscB(clow) 〉 128 then
clow1=MidB(binstr,i+1,1)
if AscB(clow1) 〈64 or AscB(clow1) =127 or AscB(clow1) = 255 then
binlen=binlen+1
'if (binlen mod 2)=0 then
binlen=binlen+1
outstream.write Chr(AscW(ChrB(128)&clow))
'end if
notes=bnote
exit for
else
outstream.write Chr(AscW(clow1&clow))
binlen=binlen+2
i=i+1
if (i mod 2)=0 then
notes=gnote
exit for
end if
end if
else
outstream.write chr(AscB(clow))
binlen=binlen+1
if (i mod 2)=0 then
notes=gnote
exit for
end if
end if
next
outstream.close
set outstream=file_O.OpenTextFile(file_name,8,false,-1)
outstream.write midb(Fields(newfile).Value,binlen)
outstream.close
if notes=bnote then notes=notes&(binlen-1)&"字节处。"

End If

'###################################################################################### 把新闻数据结构写入newslist文件
dim mappath,mytext,myfso,contenttext,news_addtime,news_point
news_point=1
news_addtime=mytime
set myfso=createobject("scripting.filesystemobject")
mappath=server.mappath("./")

set mytext=myfso.opentextfile(mappath&"\new_list.asp",8,-1)

dim mytext2
if len(varchar)〈〉0 then
mytext2=trim(id&","&news_title&","&id&".txt"&","&news_src&","&news_point&","&news_addtime&","&imageid&"|")
else
mytext2=trim(id&","&news_title&","&id&".txt"&","&news_src&","&news_point&","&news_addtime&"|")
end if
mytext.writeline(mytext2)
mytext.close

'##############把新闻内容写入相应的文件中
set contenttext=myfso.OpenTextFile(mappath&"\news_content\"&id&".txt",8,-1)



【责任编辑:admin 】




评论
用户名: 新注册) 密码: 匿名评论
评论内容:不能超过250字,请自觉遵守互联网相关政策法规。
  相关文章
为自己的ASP网站系统构建一套标记语言
ASP中Request对象获取客户端数据的顺序
彻底解决“Microsoft JET Database Engine 错误 80004005”
一段用ASP查看ASP文件源码的程序
Web在线代理(Asp版)
  最新图片
为自己的ASP网站系统构建一套标记语言
为自己的ASP网站系统
24小时TOP
   
·AspJpeg组件下载注册码及用途
·“Operation Must Use an Updateable Query
·Web在线代理(Asp版)
·asp分页代码
·ASP二进制流方法隐藏图片文件真实地址
·ASP函数库
·彻底解决“Microsoft JET Database Engine
·UTF-8怎么转GB2312?
热门图片
  更多>>>
为自己的ASP网站系统构建一套标记语言
为自己的ASP网站系
焦点聚焦
  更多>>>
 
论坛精华
  更多>>>
·真钱斗地主轧金花龙虎板玖和百家乐http://c
·22岁女大学生要嫁48岁乞丐(图)
·一条短信毁了一种水果 “蛆橘”传言流变调
·蒙古风情十四怪 (一)
·《中国高新技术企业》--www.txrb.com--科信
·东莞大金空调官方介绍 13559702882卢生
·乐众国际最新博彩游戏!真实!新鲜!刺激!
·快国庆了大家怎么安排
最新图片
  更多>>>
为自己的ASP网站系统构建一套标记语言
为自己的ASP网站系
推荐文章
  更多>>>
·为自己的ASP网站系统构建一套标记语言
关于我们 - 版权声明 - 免责声明 - 欢迎投稿 - 广告服务 - 友情链接 - 网站建设 - 诚聘英才 - 联系我们 - -
Copyright @2007-2009 www.xydyz.com © All rights reserved.
校园第一站 版权所有 客服E-Mail:hyperblue@163.comn 点击这里给我发消息
Site design by hyperblue 鄂ICP备07009403号 Powered by DedeCms