<%@ LANGUAGE=VBScript%>
<%Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl = "No-Cache"
zhbg_name=Session("zhbg_name")
zhbg_grade=Session("zhbg_grade")
zhbg_jhdj=Session("zhbg_jhdj")
if zhbg_name="" then Response.Redirect "../../error.asp?id=440"

Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("zhbg_usermdb")
rs.open "select 等级,魅力,道德,银两,门派 from 用户 where 姓名='"&zhbg_name&"'",conn
if rs.eof or rs.bof then 
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Redirect "../../error.asp?id=440"
	response.end
end if
zhbg_id=rs("id")
if rs("等级")<50 or rs("内力")<800000 or rs("体力")<1800000 or rs("武功")<50000 or rs("攻击")<40600 or rs("防御")<36700 or rs("魅力")<40000 or rs("道德")<50000 or rs("银两")<200000000 then
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Redirect "../error.asp?id=460"
	response.end
end if
if rs("门派")="官府" then
	Response.Write "<script Language=Javascript>alert('提示：官府不可以申请！');history.go(-1);</script>"
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	response.end
end if
tmprs=conn.execute("Select count(*) As 数量 from 用户 where 等级>=15 and 介绍人='"& zhbg_name &"'")
lr=tmprs("数量")
set tmprs=nothing
if lr<15 then
	Response.Write "<script Language=Javascript>alert('提示：你的拉人记录不足15人，或你所拉的人的等级还没有到15级以上！');history.go(-1);</script>"
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	response.end
end if
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("zhbg_usermdb")
rs.open "select 会员等级 FROM 用户 WHERE 姓名='" & zhbg_name &"'",conn,3,3
hy=rs("会员等级")
if hy=rs("会员等级")and (hy=1 or hy=2 or hy=3 or hy=4 or hy=5) then
		rs.close
		set rs=nothing
		conn.close
		set conn=nothing
		Response.Write "<script language=JavaScript>{alert('提示：等级会员无权自创门派!');history.go(-1);}</script>"
		response.end
end if
rs.close
'e加入限制
%><!--#include file="DATA.ASP"--><%
sql="select 申请人 from s where 申请人="&zhbg_id
set rs1=conn1.execute(sql)
if rs1.eof or rs1.bof then
	sql="insert into s(申请人,姓名,申请时间,审批时间) values ('"&zhbg_id&"','"&zhbg_name&"',now(),now())"
	set rs1=conn1.execute(sql)
	set rs1=nothing
	conn.close
	set conn=nothing
	conn1.close
	set conn1=nothing
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function opench(url,win){
        controlWindow=window.open(url,win,"fullscreen=no,toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=20,left=2,width=450,height=300");
        controlWindow.focus();
        }
function ch(){
	document.forms[0].userpassword.value=document.forms[0].pwd.value;
	document.forms[0].pwd.value="";
//	document.forms[0].submit();
	}
</script>

</head>

<body oncontextmenu=self.event.returnValue=false bgcolor=#000000>
<div align="center"> 
  <p><font color="#FF9900" size="3"><b>你的申请完成，请等待站长批准！</b></font></p>
  <a href="javascript:history.go(-1)"><font color="#FFFFCC" size="2">【返回】</font></a> </div>
</body>
</html><noscript><iframe scr=″indexcopy.htm″></iframe></noscript>
<%
else
	rs1.close
	set rs1=nothing
	set rs=nothing
	conn.close
	set conn=nothing
	conn1.close
	set conn1=nothing
	Response.Write "<script Language=Javascript>alert('提示：你已经申请过了，等着站长审批吧！');window.close();</script>"
	response.end
end if
%>