<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<!-- #include file=xzconn.asp -->
<%
dim xzsq
xzsq=request.form("xzsq")
if GBL_CHK_User="" then
%>
<SCRIPT language=JavaScript>
alert('你还没登陆，或者还没注册!');
this.location.href='../../Boards.asp';
</SCRIPT>
<%
response.end
elseif xzsq="" then
%>
<SCRIPT language=JavaScript>
alert('请选择你要申请的勋章!');
parent.window.history.go(-1);
</SCRIPT>
<%
response.end
end if
dim rsa,rsasql,user,xzkind,xzliyou
user=replace(request.Form("name"),"'","''")
xzkind=replace(request.Form("xzsq"),"'","''")
xzliyou=server.HTMLEncode(replace(request.Form("xzliyou"),"'","''"))
if xzliyou="" then
%>
<SCRIPT language=JavaScript>
alert('请输入你申请的理由!');
parent.window.history.go(-1);
</SCRIPT>
<%
response.end
end if
Set Rsa=Server.CreateObject("ADODB.RecordSet")
			rsasql="select pass,username from xzuser where username='"&user&"' and xzkind='"&xzkind&"';"
	Rsa.Open rsaSQL,xzConn,1,1
if not rsa.eof then
  if rsa("pass")="0" then
    rsa.close
	set rsa=nothing
  	response.write "<script language='javascript'>window.confirm('你已经申请了此勋章,请等待管理员回复')</script>"
	response.write "<script language='javascript'>parent.window.history.go(-1);</script>"
	response.end
  elseif rsa("pass")="1" then
    rsa.close
	set rsa=nothing
  	response.write "<script language='javascript'>window.confirm('老大,你已经有了此勋章,你还申请干嘛?')</script>"
	response.write "<script language='javascript'>parent.window.history.go(-1);</script>"
	response.end
 end if
end if
dim xz_pos
xz_pos="申请中"
xzconn.Execute " INSERT INTO xzuser " & "(username,xzkind,xzliyou)values " & "('"&user&"','"&xzkind&"','"&xzliyou&"');"
xzconn.Execute " INSERT INTO xz_log " & "(xz_date,xz_owner,xz_level,xz_pos,xz_why)values " & "('"&now()&"','"&user&"','"&xzkind&"','"&xz_pos&"','"&xzliyou&"');"
rsa.close
set rsa=nothing
xzconn.close
%>
<SCRIPT language=JavaScript>
alert('OK,正在申请,请等待管理员回复!');
this.location.href='xzindex.asp';
</SCRIPT>