<!--#include file="conn.asp"-->
<!--#include file="chkadmin.asp"-->
<!--#include file="inc/char.asp"-->
<%dim id,classid,sType
id=CInt(Trim(Request.QueryString("id")))
classid=Trim(Request.QueryString("classid"))
sType=Trim(Request.QueryString("type"))

dim errmsg,founderr
founderr=false

if chkadmin=false or power(1)="0" then
	founderr=true
	errmsg=errmsg+"<li>您没有删除软件的权限</li>"
end if

dim sql,rs
sql="select Poster from Software where ID="&id
set rs=conn.execute(sql)
if chkadmin=false or (power(4)="0" and rs(0)<>session("adm_usr")) then
	founderr=true
	errmsg=errmsg+"<li>您没有删除他人软件的权限</li>"
end if
set rs=nothing

if founderr=false then
	conn.execute("delete from Software where ID=" & id)
	conn.execute("delete from Review where SoftID=" & id)
	dim gourl,msg
	if sType<>"" then
		gourl="soft_"&sType&".asp"
	else
		gourl="soft_list.asp?id="&cint(classid)
	end if
	msg="此软件已删除！"
	call ok()
else
	call error()
end if

conn.close
set conn=nothing
%>