首 页免费资源建站技术源码下载软件下载精品淘吧客户留言
用户登陆 | 用户注册
您当前的位置:笃志小屋建站技术网站开发Asp相关 → 文章内容
用文本+ASP打造新闻发布系统
作者:佚名  来源:不详  发布时间:2007-9-18 22:47:50

〉"〉
〈INPUT type="hidden" name="server1"〉
〈input type="hidden" name="mysession" value="mysession"〉
〈/form〉
##########
news_updating.asp
〈!--#include file="news_session.asp"--〉
〈!--#include file="upload.inc"--〉
〈%
'Fields("xxx").Name 取得Form中xxx(Form Object)的名字
'Fields("xxx").FilePath 如果是file Object 取得文件的完整路径
'Fields("xxx").FileName 如果是file Object 取得文件名
'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 mytitle,content,src,id,mysession
mysession=Fields("newtitle").value
if len(mysession)=0 then
Response.Write "非法登陆或超时间,请重新登陆"
Response.End
end if
mytitle=Fields("newtitle").value
mytitle=replace(mytitle,"|","|")
mytitle=replace(mytitle,"〈br〉","")
content=Fields("newcontent").value
src=Fields("newssrc").value
src=replace(src,"|","|")
src=replace(src,"〈br〉","")
id=trim(right(Fields("myid").value,12))
if len(mytitle)=0 then
Response.Write "〈script〉"
Response.Write "alert('出错!新闻标题不能为空!');"
Response.Write"location.href=history.go(-1);"
Response.Write "〈/script〉"
end if
if len(content)=0 then
Response.Write "〈script〉"
Response.Write "alert('出错!新闻内容不能为空!');"
Response.Write"location.href=history.go(-1);"
Response.Write "〈/script〉"
end if
if len(src)=0 then
Response.Write "〈script〉"
Response.Write "alert('出错!新闻来源不能为空!');"
Response.Write"location.href=history.go(-1);"
Response.Write "〈/script〉"
end if

'############################################################################################图片更该功能的实现
newfile="client1"
If Fields(newfile).FileName〈〉"" Then
set file_0=Server.CreateObject("Scripting.FileSystemObject")
dim contextname
contextname=right(Fields("client1").FileName,4)
imageid=id&contextname
if contextname〈〉".gif" and contextname〈〉".jpg" then '#########判断上传文件格式
Response.Write "〈script〉"
Response.Write "alert('出错!上传文件格式不对 只能为jpg/gif图片格式!');"
Response.Write"location.href=history.go(-1);"
>Response.Write "〈/script〉"
end if
file_name=Server.MapPath("./images/"&imageid&"")
'#####################################如果原来有图片文件主名为id的则删除该图片
if file_0.fileexists(server.MapPath ("./images/"&id&".gif")) then
Set f3 = file_0.GetFile(server.MapPath ("./images/"&id&".gif"))
f3.Delete
end if
if file_0.fileexists(server.MapPath ("./images/"&id&".jpg")) then
Set f3 = file_0.GetFile(server.MapPath ("./images/"&id&".jpg"))
f3.Delete
end if
'########################################写入图片
set outstream=file_0.openTextFile(file_name,8,-1)
binstr=Fields("client1").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_0.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
'#######################################################################################################
dim myfso,mywrite '#######修改新闻详细内容
set myfso=createobject("scripting.filesystemobject")
if myfso.FileExists(server.mappath("./news_content/"&id&".txt")) then
myfso.DeleteFile (server.mappath("./news_content/"&id&".txt"))
end if
set mywrite=myfso.createtextfile(server.mappath("./news_content/"&id&".txt"),-1,0)
mywrite.write content

dim mytext2,myread2 '#########修改新闻的标题来源
set myread2=myfso.opentextfile(server.mappath("./new_list.asp"),1,

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]  下一页

2007-9-18 22:47:50免费资源duzhi.net

[ ] [返回上一页] [打 印]

【笃志小屋duzhi.net】

  技术文章导航
  技术文章排行
  精彩推荐
Copyright www.duzhi.net All Right Reserved.
设计制作:翼迅设计室 Equick Desgin Home 在线QQ:303471038
网络备案号:冀ICP备06008201号 站长信箱:webmaster#duzhi.net(将#换为@)
本站部分文章和图片来源于网络和内容提供伙伴,如果侵犯了您的权利,请留言告知,本站定会及时删除相关文件!