<!--#include file="inc_const.asp"-->
<%Response.CacheControl = "Private"
response.expires=0
Set Conn=Server.CreateObject("ADODB.Connection")
conn.open Application(ConstStr & "_connstr")

sUserName=left(request("username"),10)
set cschat=server.createobject("ffcschat.cssbchat")

sPass = cschat.trpass(request("sPass"))
set cschat=nothing

sErrText=""
sql="SELECT username,passwd,user_level,saved FROM user WHERE username='"&sUserName&"'"
set rs=conn.Execute(sql)

if rs.bof or rs.eof then
  sErrText="<br><font color=green>执行错误</font>：用户名尚未注册！"
elseif rs("saved") or rs("user_level")-application(ConstStr & "_superlevel")=0 then
  sErrText="<br><font color=green>执行错误</font>：用户名为保留帐号，不能自杀！"
else
  sUserName=rs("username")
  if instr(Application(ConstStr & "_user_list"),"<$"&sUserName&"$>")<>0 then
    sErrText="<br><font color=green>执行错误</font>：该用户目前正在聊天室中！"
  elseif rs("passwd")=sPass then
     conn.Execute("DELETE FROM user WHERE username='"&sUserName&"'")
     sErrText="<font color=green>操作成功</font>：你成功地删除了用户"&sUserName&"！"
  else
    sErrText="<br><font color=green>执行错误</font>：你输入了错误的密码！"
  end if
end if
response.redirect("showerr.asp?errtext="&serrText)
conn.close
set conn=nothing%>