<!--#include file= "news_session.asp"-->
<%
Dim id
Id=request.querystring ("id")
Dim Myfso
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
Dim mytext2,myread2
Set Myread2=myfso.opentextfile (Server.MapPath ("./new_list.asp"), 1,0)
If Myread2.atendofstream Then
Response.Write "No news content"
Myread2.close
Response.End
End If
Mytext2=myread2.readall
Myread2.close
Dim listarray,i,h,count,sf,title
Listarray=split (mytext2, "|") ' ######## #读取记录并以 # split into Listarray arrays
Count=ubound (Listarray)
For i=0 to count ' ########## #根据ID找到该新闻实现删除功能
Sf=split (Listarray (i), ",")
If Right (SF (0), 7) =right (id,7) Then
Dim thisid
Thisid=i
' ###### #为6说明上传了图片, delete the news picture and the list record
If UBound (SF) =6 Then
Myfso.deletefile (server. MapPath ("./images/" &SF (6)))
End If
Exit For
End If
Next
Dim Mytext,mappath
Mappath=server.mappath ("./")
Set Mytext=myfso.createtextfile (mappath& "\new_list.asp", -1,0)
For i=0 to Thisid-1 ' ######### #把所有数据重新写入文件
Mytext.write Listarray (i) & "|"
Next
For I=thisid+1 to UBound (Listarray)
If I=ubound (Listarray) Then
Mytext.write Listarray (i)
Exit For
Else
Mytext.write Listarray (i) & "|"
End If
Next
Mytext.close
%>
<script language= "JavaScript" >
Alert ("Delete succeeded");
Location.href = ("news_admin1.asp");
</script>
---------------
News_view.asp
<% response.expires=0
Dim myid,myfso,myread,mytext1
Myid=request.querystring ("id")
If Len (myID) =0 Then
Response.Write "No Such news"
Response.End
End If
Set Myfso=createobject ("Scripting.FileSystemObject")
Set Myread=myfso.opentextfile (Server.MapPath ("./news_content/