delete.asp
来自「功能的增加及完善 1.完善了上次不能读写房源编号的错误; 2.增加了不是会员」· ASP 代码 · 共 29 行
ASP
29 行
<!--#include file="conn.asp"-->
<!--#include file="pass.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"),"upload/") then
imgpath=Replace(Replace(rs("news_content"),"upload",""),"/","")
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
Response.Write"<script language=JavaScript>"
Response.Write"alert(""恭喜!图片删除成功"");"
Response.Write"window.location='add.asp';"
Response.Write"</script>"
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?