<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/char.asp" -->
<!--#include file="../Include/const.asp" -->
<!--#include file="IsLogin.asp" -->
<%
m_username=CheckStr(request("username"))
m_flag=request("flag")

if IsNumeric(m_flag)=false then
  Call Msgbox("对不起，发生ID号错误！",1)
   Response.end
end if
m_UserID = Session("CurUserID")
m_username_a=Session("CurUserName")
m_Sql = "SELECT f_realname,f_sex,f_birthday,f_edu,f_area,f_grade,f_email FROM T_Member WHERE F_username='" &m_username&"'" 
set rs=server.createobject("adodb.recordset")
rs.open m_sql,conn,1,1
 if rs.Eof then
   Call Msgbox("对不起，无此会员！",1)
   Response.end
 end if
 m_Name=rs("F_Realname")
 if rs("F_Sex")=1 then
 m_Sex="男"
 else
 m_Sex="女"
 end if
 m_age=year(date()-year(rs("F_birthday"))+1)
 m_edu=rs("F_edu")
 m_area=rs("F_area")
 m_Email=rs("F_Email")
 m_grade=rs("F_grade")

 rs.close
 set rs=nothing
  m_sql="select f_flag from my_friend where f_userid="&m_UserID&" and f_username='"&m_username&"'"
  Set rs = conn.Execute(m_Sql)
 
 if rs.Eof then
  mc_Sql = "Insert Into my_friend(F_UserID,f_username_a,F_Name,F_Sex,F_age,F_edu,F_Email,F_area,F_grade,F_flag,f_username)"
  mc_Sql =  mc_Sql + " Values("&m_UserID&",'"&m_username_a&"','"&m_Name&"','"&m_Sex&"','"&m_age&"','"&m_edu&"','"&m_Email&"','"&m_area&"',"&m_grade&","&m_flag&",'"&m_username&"')"
  conn.Execute(mc_Sql)
  
  '系统日志

if m_flag="0" then
  m_logcontent1="您已经将[<a href=club_member.asp?username="&m_username&" target=_blank>"&m_username&"</a>]加入了[黑名单]"
  m_logcontent2="您已经被[<a href=club_member.asp?username="&m_username_a&" target=_blank>"&m_username_a&"</a>]加入了[黑名单]"
   
   if syslog_function(m_username_a,m_logcontent1) <> "OK" then
      response.write "系统有错误！"	
   end if
  if syslog_function(m_username,m_logcontent2) <> "OK" then
    response.write "系统有错误！"	
   end if

end if
'/////////////////////

if m_flag="1" then
  m_logcontent1="您已经将[<a href=club_member.asp?username="&m_username&" target=_blank>"&m_username&"</a>]加入了[我的好友]"
  m_logcontent2="您已经被[<a href=club_member.asp?username="&m_username_a&" target=_blank>"&m_username_a&"</a>]加入了[我的好友]"
   if syslog_function(m_username_a,m_logcontent1) <> "OK" then
      response.write "系统有错误！"	
   end if
  if syslog_function(m_username,m_logcontent2) <> "OK" then
      response.write "系统有错误！"	
   end if
end if
  
  
  Call Msgbox("操作添加成功！",1)
  response.end 
  
  else   '0574--------------------------------------------
  
   if  cint(rs("f_flag"))=cint(m_flag)  then
	  	Call Msgbox("注：请不要重复操作！",1)		
		response.end 
	else
	m_sql="update my_friend set f_flag="&m_flag&" where f_userid="&m_UserID&" and f_username='"&m_username&"'"
	conn.Execute(m_Sql)
	
	  '系统日志
  if m_flag="0" then
    m_logcontent1="您已经将[<a href=club_member.asp?username="&m_username&" target=_blank>"&m_username&"</a>]加入了[黑名单]"
    m_logcontent2="您已经被[<a href=club_member.asp?username="&m_username_a&" target=_blank>"&m_username_a&"</a>]加入了[黑名单]"
    if syslog_function(m_username_a,m_logcontent1) <> "OK" then
      response.write "系统有错误！"	
    end if
    if syslog_function(m_username,m_logcontent2) <> "OK" then
      response.write "系统有错误！"	
   end if
   
  end if
  if m_flag="1" then
       m_logcontent1="您已经将[<a href=club_member.asp?username="&m_username&" target=_blank>"&m_username&"</a>]加入了[我的好友]"
      m_logcontent2="您已经被[<a href=club_member.asp?username="&m_username_a&" target=_blank>"&m_username_a&"</a>]加入了[我的好友]"
     if syslog_function(m_username_a,m_logcontent1) <> "OK" then
      response.write "系统有错误！"	
      end if
     if syslog_function(m_username,m_logcontent2) <> "OK" then
      response.write "系统有错误！"	
     end if
  end if
	Call Msgbox("您的操作成功！",1)
	
	response.end
  end if 
	
	
  end if
%>

