<!--#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")
dim ArticleID,Action,sqlDel,rsDel,FoundErr,ErrMsg,ObjInstalled
ArticleID=trim(request("id"))
if ArticleId="" or IsNumeric(ArticleID)=false then
	Call Msgbox("对不起，ID参数错误！",1)
	response.end
end if

sql1="select f_id,f_name 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")
m_club_name=rs1("f_name")
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
	set rs1=server.createobject("ADODB.Recordset")
	sql1="select * from t_club_member where f_club_id="&ArticleID&" and f_username='"&m_username&"'"
	rs1.open sql1,conn,1,3
	
	if not rs1.eof then
	  if rs1("f_ischeck")=true then
	  Call Msgbox("对不起，您已经加入本小圈子！请不要重复操作！",1)
	  response.end	 
	  else	  
	  Call Msgbox("您已经向本小圈子提交申请了，请耐心等待审核！",1) 
	  response.end
	  end if
	else
	rs1.addnew
	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("f_ischeck")=0
	rs1("f_identity")="初级会员"
	rs1.update	
  ' conn.execute "update T_club set F_usercount=f_usercount+1 where F_ID=" &m_club_id
    m_logcontent="您已经提交申请加入[<a href=club_viewsub.jsp?id="&m_club_id&" target=_blank>"&m_club_name&"</a>]小圈子会员"
   if syslog_function(m_username,m_logcontent) <> "OK" then
   response.write "系统有错误！"	
   end if
   Call Msgbox("您申请加入小圈子，请等待审核！","club_viewsub.jsp?id="&m_club_id)
    response.end
	end if	
	rs1.close
	set rs1=nothing
   Call Msgbox("发生不可预见的错误！",1)



%>

