<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/char.jsp" -->
<!--#include file="../Include/const.jsp" -->
<!--#include file="IsLogin.jsp" -->
<%
m_username= Request.Cookies("aspxnet")("CurUsername")
ArticleID=trim(request("id"))
m_type=request("type")
meet_id=request("meetid")
if ArticleId="" or meet_id="" or isnumeric(articleid)=false or isnumeric(meet_id)=false then
	Call Msgbox("对不起，参数错误！",1)
	response.end
end if

sql1="select f_id from t_club where f_id="&articleid
set rs1=server.createobject("ADODB.Recordset")
rs1.open sql1,conn
if rs1.eof then
Call Msgbox("对不起，此子俱乐部已经不存在！",1)
response.end
end if
m_club_id=rs1("f_id")
rs1.close
set rs1=nothing

sql1="select f_id from t_club_meet where f_id="&meet_id
set rs1=server.createobject("ADODB.Recordset")
rs1.open sql1,conn
if rs1.eof then
Call Msgbox("对不起，此活动已经不存在！",1)
response.end
end if
rs1.close
set rs1=nothing


sql="select f_username,f_sex,f_birthday,f_edu,f_realname,f_email,f_qq,f_tel,f_grade from T_member where f_username='"&m_username&"'"
set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof then
Call Msgbox("对不起，会员不存在！",1)
response.end
end if
if rs("f_sex")=1 then
m_sex="男"
else
m_sex="女"
end if

m_age=int(year(date())-year(rs("f_birthday")))
m_edu=rs("f_edu")
m_realname=rs("f_realname")
m_email=rs("f_email")
m_qq=rs("f_qq")
m_tel=rs("f_tel")
m_grade=rs("f_grade")
rs.close
set rs=nothing

    if m_type="join" then
	set rs1=server.createobject("ADODB.Recordset")
	sql1="select * from t_club_meetmember where f_club_id="&m_club_id&" and f_meet_id="&meet_id&" and f_username='"&m_username&"'"
	rs1.open sql1,conn,1,3
	
	if not rs1.eof then	  
	  Call Msgbox("对不起，您已经参加了本活动！请不要重复操作！",1)
	  response.end	
	else
	rs1.addnew
	rs1("f_meet_id")=meet_id
	rs1("f_club_id")=m_club_id
	rs1("f_username")=m_username
	rs1("f_sex")=m_sex
	rs1("f_age")=m_age
	rs1("f_edu")=m_edu
	rs1("f_realname")=m_realname
	rs1("f_email")=m_email
	rs1("f_qq")=m_qq
	rs1("f_tel")=m_tel
	rs1("f_grade")=m_grade
	rs1("f_regtime")=now()
	rs1.update	
  ' conn.execute "update T_club set F_usercount=f_usercount+1 where F_ID=" &m_club_id
    url="club_lookmeet.jsp?id="&m_club_id&"&meetid="&meet_id
    response.redirect url  
	end if	
	rs1.close
   set rs1=nothing
   else
      if m_type="cancel" then
	  	set rs1=server.createobject("ADODB.Recordset")
	    sql1="select * from t_club_meetmember where f_club_id="&m_club_id&" and f_meet_id="&meet_id&" and f_username='"&m_username&"'"
	    rs1.open sql1,conn,1,3
         if not rs1.eof then	  
	     rs1.delete
	     rs1.update	  
	     else			  
	     Call Msgbox("对不起，您还未参加了本活动！请不要错误操作！",1)
	     response.end
	     end if
		  rs1.close
          set rs1=nothing
		  url="club_lookmeet.jsp?id="&m_club_id&"&meetid="&meet_id
          response.redirect url 	
      end if
   end if
   
   Call Msgbox("发生不可预见的错误！",1)
%>

