<!--#include file = "Startup.asp"-->
<!-- #include file="Function.asp" -->
<%
call adminer()
Call Header()
Call ComeUrl()

Dim UserID,delesql,FoundErr,ErrMsg
Dim zRs,zSql
UserID=Trim(Request("id"))
if UserID="" then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>参数不足</li>"
end if
if founderr=true then
	call WriteErrMsg()
End if
If IsNumeric(UserID) = False Then
	GoError "请通过页面上的链接进行操作，不要试图破坏此演示系统。"
End If

ssql="select * from admin where  id="&UserID
ors.open ssql,oconn,1,1
If Not oRs.Eof Then
	if ors("username")=session("username") then
		response.write "<script>"
		response.write "alert('您不能删除当前登陆中的用户！！');"
		response.write "history.back(1);"
		response.write "</script>"
		Response.End
	end if
	If oRs("userclass")=1 then
		Set zRs=Server.CreateObject("ADODB.Recordset")
		zSql="Select UserClass From Admin Where UserClass=1"
		zRs.Open zSql,oConn,1,1
		If Not zRs.Eof Then
			If zRs.recordcount<=1 Then
				'Response.Write zRs.recordcount
				response.write "<script>"
				response.write "alert('系统必须保留至少一个超级管理员,才能正常运行！！');"
				response.write "history.back(1);"
				response.write "</script>"
				Response.End
			End If
		End If
	End If

delesql="DELETE FROM admin WHERE id="&UserID
oconn.Execute delesql
Else
	response.write "<p align=center>无效的用户ID，请点页面上的链接进行操作！<script>window.setTimeout(""location.href='user.asp'"",2000);</script></p>"
End If 
response.write "<p align=center>用户删除成功，2秒后自动返回用户管理页！<script>window.setTimeout(""location.href='user.asp'"",2000);</script></p>"

%>