delete.asp

来自「实现对图片的基本处理:打开、增加、删除等。」· ASP 代码 · 共 41 行

ASP
41
字号
<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<% 
  id=Request.Querystring("id")
  if id="" or isnull(id) then
     Response.Redirect("login.asp")
  end if
  sql="select news_content from [imgbook] where ID=" & id
  set rs=server.CreateObject("Adodb.recordset")
  rs.open sql,conn,1,1
  if instr(rs("news_content"),"[uploadimg]") then
	   imgpath=Replace(Replace(rs("news_content"),"[uploadimg]",""),"[/uploadimg]","")
	   imgpath=trim(imgpath)
	   'response.Write(imgpath)
	   set fso = Server.Createobject("Scripting.FileSystemObject") 
	   path = server.MapPath("../upload/" & imgpath)
	   fso.DeleteFile(path)
	   set fso = nothing 
	   conn.execute("delete * from imgbook where ID=" & id)
  else
       conn.execute("delete * from imgbook where ID=" & id)
  end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="refresh" content="1;URL=manage.asp?page=<%=request.Querystring("page")%>">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div align="center"><br>
  <br>
  <br>
  <br>
  <br>
  <a href="javascript:history.back()"><br>
  <font color="#990000" size="2">此图片已被您删除了。请返回! </font></a></div>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?