<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
if session("username")="" then
  call mb("对不起，您还没有登陆！","login.asp",1)
end if

dim id
id=request("id")
if not isinteger(id) then
  call mb("请指定要删除的Flash的ID参数！","",0)
end if
set rs=server.createobject("adodb.recordset")
sql="select * from flash where id="&id
rs.open sql,conn,1,3

if rs.bof and rs.eof then
  call mb("对不起，找不到您要删除的Flash！","",0)
elseif rs("username")<>session("username") then
  call mb("对不起，您无权删除别人发布的作品！","",0)
else
  '重新统计大类Flash数
  conn.execute("update bigclass set flashcount=flashcount-1 where bigclassid="&rs("bigclassid")&" and flashcount>0")
  '重新统计小类Flash数
  conn.execute("update smallclass set flashcount=flashcount-1 where smallclassid="&rs("smallclassid")&" and flashcount>0")
  
  '统计作者Flash数
  conn.execute("update author set flashnum=flashnum where username='"&rs("username")&"' and flashnum>0")
  
  '删除Flash
  rs.delete
  rs.update
end if
rs.close
set rs=nothing
conn.close
set conn=nothing

call mb("删除Flash成功！","user_index.asp",1)
%>
