|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。<!--#includefile="news_session.asp"-->
<%
dimid
id=Request.QueryString("id")
dimmyfso
setmyfso=createobject("scripting.filesystemobject")
ifmyfso.FileExists(server.mappath("./news_content/"&id&".txt"))then
myfso.DeleteFile(server.mappath("./news_content/"&id&".txt"))#############删除旧事内容
endif
dimmytext2,myread2
setmyread2=myfso.opentextfile(server.mappath("./new_list.asp"),1,0)
ifmyread2.atendofstreamthen
Response.Write"没有旧事内容"
myread2.close
Response.End
endif
mytext2=myread2.readall
myread2.close
dimlistarray,i,h,count,sf,title
listarray=split(mytext2,"|")#########读取纪录并以#支解成listarray数组
count=ubound(listarray)
fori=0tocount###########依据ID找到该旧事完成删除功效
sf=split(listarray(i),",")
ifright(sf(0),7)=right(id,7)then
dimthisid
thisid=i
#######为6申明上传了图片,删除旧事图片和该列表纪录
ifubound(sf)=6then
myfso.deletefile(server.MapPath("./images/"&sf(6)))
endif
exitfor
endif
next
dimmytext,mappath
mappath=server.mappath("./")
setmytext=myfso.createtextfile(mappath&"
ew_list.asp",-1,0)
fori=0tothisid-1##########把一切数据从头写进文件
mytext.writelistarray(i)&"|"
next
fori=thisid+1toubound(listarray)
ifi=ubound(listarray)then
mytext.writelistarray(i)
exitfor
else
mytext.writelistarray(i)&"|"
endif
next
mytext.close
%>
<scriptlanguage="javascript">
alert("删除乐成");
location.href=("news_admin1.asp");
</script>
---------------
news_view.asp
<%Response.Expires=0
dimmyid,myfso,myread,mytext1
myid=request.querystring("id")
iflen(myid)=0then
Response.Write"没有该旧事"
Response.End
endif
setmyfso=createobject("scripting.filesystemobject")
setmyread=myfso.opentextfile(server.mappath("./news_content/"&myid&".txt"),1,0)
ifmyread.atendofstreamthen
Response.Write"没有旧事内容"
Response.End
else
mytext1=myread.readall#######翻开对应的旧事内容文件,并读取用变量存储
functionhtmlencode2(str)###########字符处置函数
dimresult
diml
l=len(str)
result=""
dimi
fori=1tol
selectcasemid(str,i,1)
casechr(34)
result=result+""""
case"&"
result=result+"&"
casechr(13)
result=result+"<br>"
case""
result=result+""
casechr(9)
result=result+""
casechr(32)
result=result+""
ifi+1<=landi-1>0then
ifmid(str,i+1,1)=chr(32)ormid(str,i+1,1)=chr(9)ormid(str,i-1,1)=chr(32)ormid(str,i-1,1)=chr(9)then
result=result+""
else
result=result+""
endif
else
result=result+""
endif
caseelse
result=result+mid(str,i,1)
endselect
next
htmlencode2=result
endfunction
myread.close
endif
dimmytext2,myread2
setmyread2=myfso.opentextfile(server.mappath("./new_list.asp"),1,0)
ifmyread2.atendofstreamthen
Response.Write"没有旧事内容"
Response.End
else
mytext2=myread2.readall
myread2.close
dimlistarray,i,h
listarray=split(mytext2,"|")#########读取纪录并以#支解成listarray数组
dimcount,sf,title,src
count=ubound(listarray)
fori=0tocount###########依据ID找到该旧事并把文章点击次数加1
sf=split(listarray(i),",")
ifright(sf(0),7)=right(myid,7)then
title=sf(1)
src=sf(3)
sf(4)=sf(4)+1
#######为6申明上传了图片,存储为新的数组
ifubound(sf)=6then
listarray(i)=sf(0)&","&sf(1)&","&sf(2)&","&sf(3)&","&sf(4)&","&sf(5)&","&sf(6)
dimmypic
mypic=sf(6)
else
listarray(i)=sf(0)&","&sf(1)&","&sf(2)&","&sf(3)&","&sf(4)&","&sf(5)
endif
##################
exitfor
endif
next
dimk,m</p>缺点:安全性不是太差了,还行,只要你充分利用系统自带的工具;唯一缺点就是执行效率慢,如何进行网站优化以后,效果会比较好。 |
|