<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf Request("username")="" or RegExpTest("[^A-Za-z0-9]",Request("username")) or len(Request("username"))<3 Then
	ef=True
	ec="会员名没有写/或会员名中有非法字符/或会员名长度小于3个字符！"
elseIf session("candeluser")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set ds = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username = '"&Request("username")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		ds.Open Sql,conn,1,3
if ds.Eof then
	ef=True
	ec="用户不存在！"
end if
end if

if not ef then
if Application("hpsystem")=true then
Set dsphemail = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Homepage where username='"&ds ("username")&"'"
	dsphemail.Open Sql,conn,1,1
if not dsphemail.Eof then
	ef=True
	ec="此用户有已开通的个人主页产品，请先删除个人主页产品！"
end if
end if
end if

if not ef then
Set dsphemail = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Email where username='"&ds ("username")&"'"
	dsphemail.Open Sql,conn,1,1
if not dsphemail.Eof then
	ef=True
	ec="此用户有已开通的邮箱产品，请先删除邮箱产品！"
end if
end if

if not ef then
Set dsph = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Host where username='"&ds("username")&"'"
	dsph.Open Sql,conn,1,1
if not dsph.Eof then
	ef=True
	ec="此用户有已开通的虚拟主机产品，请先删除虚拟主机产品！"
end if
end if

if not ef then
Set dsphSql = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Sql where username='"&ds ("username")&"'"
	dsphSql.Open Sql,conn,1,1
if not dsphSql.Eof then
	ef=True
	ec="此用户有已开通的数据库产品，请先删除数据库产品！"
end if
end if

if not ef then
Set dsphSql = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_VPS where username='"&ds ("username")&"'"
	dsphSql.Open Sql,conn,1,1
if not dsphSql.Eof then
	ef=True
	ec="此用户有已开通的云服务器产品，请先删除云服务器产品！"
end if
end If

if not ef then
Set dsphSql = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_cdn where username='"&ds ("username")&"'"
	dsphSql.Open Sql,conn,1,1
if not dsphSql.Eof then
	ef=True
	ec="此用户有已开通的cdn产品，请先删除cdn产品！"
end if
end If

if not ef then
Set dsphSql = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_idc where username='"&ds ("username")&"'"
	dsphSql.Open Sql,conn,1,1
if not dsphSql.Eof then
	ef=True
	ec="此用户有已开通的IDC产品，请先删除IDC产品！"
end if
end if



if not ef then
Set dsphDomain = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_Product_Domain where username='"&ds ("username")&"' and status='正常'"
	dsphDomain.Open Sql,conn,1,1
if not dsphDomain.Eof then
	ef=True
	ec="此用户有已开通的域名产品，请先删除域名产品！"
end if
end if


if not ef then
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html8")%>
 　删除用户
 <%=htmlwrite("html9")%>

<br><br><br>
用户 <%=ds ("username")%>，删除成功！

<%

'删除
Sql="delete from FreeHost.FreeHost_online_aws where username='"&ds("username")&"'"
if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
    conn.Execute Sql

'删除
Sql="delete from FreeHost.FreeHost_Loginlog where username='"&ds("username")&"'"
if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
    conn.Execute Sql




ds.delete
ds.update
ds.Close
set ds=nothing
conn.Close 
set conn=nothing
%>
<%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
