delteacherok.asp
来自「一个关于学校网站教育资源的网站,能实现文件的上载,可以实现教育资源的共响」· ASP 代码 · 共 43 行
ASP
43 行
<!--#include file="conn.asp"-->
<!--#include file="isadmin.asp"-->
<%
id = trim(request("id"))
returnlist = trim(request("returnlist"))
if id = "" then
conn.close
set conn = nothing
response.write "<script>alert('请不要捣乱');top.window.location.href='adminmain.asp';</script>"
else
conn.execute "delete from teacher where teacherid="&id
'删除该教师上传的资料
sql = "select * from main where idofteacher="&id
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not (rs.bof and rs.eof) then
dim filepaths,objFSO
on error resume next
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
do while not rs.eof
fileurl = rs("fileurl")
if left(fileurl,6) = "files/" and mid(fileurl,7,len(id)+2) = id&"at" then
filepaths=Server.MapPath(""&fileurl&"")
if objFSO.fileExists(filepaths) then
objFSO.DeleteFile(filepaths)
end if
end if
rs.movenext
loop
set objFSO = nothing
end if
rs.close
set rs = nothing
conn.execute "delete from main where idofteacher="&id
conn.close
set conn = nothing
if returnlist = "yes" then
response.write "<script>alert('删除成功');window.location.href='unlock.asp';</script>"
else
response.write "<script>alert('删除成功');window.location.href='adminteacher.asp';</script>"
end if
end if
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?