<!--#include file="../Include/Conno.asp" -->
<!--#include file="../Include/char.asp" -->
<!--#include file="../Include/const.asp" -->
<!--#include file="IsLogin.asp" -->
<%
mUserID = Session("CurUserID")
m_username= Session("CurUserName")
'Auto Create Category
'm_Sql = "Select * From AL_Category Where F_UserID="&mUserID
'Set rs = conn.Execute(m_Sql) 
'if rs.eof then
 ' m_Sql = "Insert Into AL_Category(F_UserID,F_Value)Values("&mUserID&",'我的好友')"
 ' conn.Execute(m_Sql)
'end if
'rs.Close
M_Flag=request("flag")
cname="黑名单"
if M_Flag<>"0" then
M_Flag="1"
cname="我的好友"
end if
If Request.ServerVariables("REQUEST_METHOD")="POST" then
  If Request.QueryString("action") = "insert" then
    'Insert    
    mCategoryID = Request.Form("selCategory")
	if mCategoryID = "" then 
      response.write "<script>alert('对不起,请创建通讯录的组别！');history.back();</Script>"
	  Response.end
	end if
    mWebSiteName = checkStr(Trim(Request.Form("txtWebSiteName")))
    mURL = checkStr(Trim(Request.Form("txtURL")))
    mSql = "Insert Into BM_Bookmark(F_CategoryID,F_WebSiteName,F_URL,F_Addtime)"
    mSql = mSql + " Values('"&mCategoryID&"','"&mWebSiteName&"','"&mURL&"','"&now()&"')"
    conn.Execute(mSql)
    Response.Redirect "myfriends.asp"
  else
    m_Delete=request.form("hidDelete")
    m_MoveTO=request.form("btnMoveTO")
    if request.form("box").count < 1 then
      response.write "<script>alert('对不起,请选择你要操作的链接！');history.back();</Script>"
    else
	
	  if m_Delete = "删除" then
	    'Delete
		for each m_LinkID in Request.form("box")
	      mSql = "Delete from my_friend where F_ID=" & m_LinkID
	      response.write mSql
		  conn.execute(mSql)
	    next
	    response.redirect "myfriends.asp"
	  else '进行移动到操作
	    'MoveTo
		m_CategoryID = Request.Form("selMoveTO")
	    for each m_linkID in request.form("box")
	      mSql="update my_friend set F_CategoryID=" & m_CategoryID & " where F_ID=" & m_linkID
	      response.write mSql
		  conn.execute(mSql)
	    next
	    Response.Redirect "myfriends.asp"
	  end if
	  
    end if
  end if
End if
%>

<HTML><HEAD><TITLE>会员俱乐部通讯录</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<link href="../css/member.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="../Include/function.js"></script>
<script language="javascript">
<!--
function PerDelete2()
{
  if((confirm("警告:请确认是否要删除该组别?\n删除后该组相关的记录也会全部删除!"))==true) 
  {
    document.form3.hidDelete2.value="删除";
    document.form3.submit();
	return false
   }
}

function CheckData2()
{
  if (document.form3.txtTypeName.value=="")
  {
    alert("对不起，类别名称不能为空！");
	document.form3.txtTypeName.focus();
	return false;
   }
}

function CheckAll()
{     
  for (var k=0;k<document.form2.elements.length;k++)
    {
      var e = document.form2.elements[k];
      if (e.name != 'allbox')
	e.checked = document.form2.allbox.checked;
    }
}

function PerDelete(){
var tmptotal = 0;
  for(var i=0;i<document.form2.elements.length;i++)
  {
    var e=document.form2.elements[i];
    if(e.name=='box') 
    {
      if(e.checked==true){tmptotal++;
    }
  }
}
if( tmptotal > 0 ) {
if((confirm("确定要永久删除这 "+tmptotal+" 条记录吗?"))==true) {
document.form2.hidDelete.value="删除";
document.form2.submit();
}
} else {
alert( "你还没有选择任何记录!" );
}
}


//-->
</script>
</HEAD>
<BODY leftMargin=0 topMargin=0>
<!--#include file="../include/top.asp" -->
<!--#include file="../include/member_top.asp" --><!--#include file="club_top.asp" -->
<!--#include file="Top.asp" -->
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td width="183" height="400" align="center" valign="top"> 
      <!--#include file="left.asp" -->
    </td>
    <td align="center" valign="top"><table width="96%"  border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="100%" height="40" align="right" valign="bottom"><img src="../Images/member/jl_07.gif" width="180" height="65"></td>
        </tr>      
      </table>
      <TABLE width="96%" 
      border=0 align="center" cellPadding=0 cellSpacing=0 
      borderColor=#111111 bgcolor="#FFFFFF" id=AutoNumber7 style="BORDER-COLLAPSE: collapse">
        <TBODY>
          <TR valign="top"> 
            <TD colSpan=2>
    
              <table width="100%" border=0 cellpadding=0 cellspacing=0>
                <tbody>
                  <tr> 
                    <td height="280" align="center" valign="top"> <form name="form2" action="myfriends.asp" method="POST">
                        <TABLE cellSpacing=1 cellPadding=0 width=560 bgColor=#b4b4b4 border=0>
        <TBODY>
        <TR>
          <TD 
          style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px" 
          vAlign=top align=middle bgColor=#ffffff>
		  <%
					dim PerPage
				set rs_c=server.createobject("adodb.recordset")
				'	sql_c="select f_id,f_username,f_content,f_regtime from t_club_board where f_club_id="&rs_a("f_id")&"  order by f_regtime desc"
					mSql = "Select f_id,f_username From my_friend where F_flag='"&M_flag&"' and F_userid="&mUserID&" order by f_id desc"
					'Set rs_c = conn.Execute(mSql)
					rs_c.open msql,conn,1,1
					'flag="尚未处理"
                    PerPage=20
				
                   '假如没有数据时
                 ' If rs_c.eof and rs_c.bof then
                  ' response.write "<p align='center'><font color='#ff0000'>还没任何新闻</font></p>"
                 ' response.end
                 ' End if
					'取得页数,并判断用户输入的是否数字类型的数据，如不是将以第一页显示
                    text="0123456789"
                    Rs_c.PageSize=PerPage
					
                    for i=1 to len(request("page"))
                    checkpage=instr(1,text,mid(request("page"),i,1))
                    if checkpage=0 then
                    exit for
                    end if
                    next

                  If checkpage<>0 then
                  If NOT IsEmpty(request("page")) Then
                  CurrentPage=Cint(request("page"))
                  If CurrentPage < 1 Then CurrentPage = 1
                  If CurrentPage > Rs_c.PageCount Then CurrentPage = Rs_c.PageCount
                  Else
                  CurrentPage= 1
                  End If
                 If not Rs_c.eof Then Rs_c.AbsolutePage = CurrentPage end if
                 Else
                 CurrentPage=1
                 End if					
				%>
            <TABLE cellSpacing=3 cellPadding=0 width=548 border=0>
                                  <TBODY>
                                    <TR> 
                                      <TD align=middle colSpan=7 height=20>您总共有 
                                        <B><%=Cstr(rs_c.RecordCount)%></B>&nbsp;位<%=cname%>，每页&nbsp;<B><%=PerPage%></B>&nbsp;位，共&nbsp;<B><%=Cstr(rs_c.pagecount)%></B>&nbsp;页，当前是第&nbsp;<b><%=CurrentPage%></b>&nbsp;页</TD>
                                    </TR>
                                    <TR bgcolor="#f2f2f2"> 
                                      <TD align=middle width=24 height=20>&nbsp;</TD>
                                      <TD align=middle width=122>会员名</TD>
                                      <TD align=middle width=46>性别</TD>
                                      <TD align=middle width=34>年龄</TD>
                                      <TD align=middle width=50>学历</TD>
                                      <TD width=138 align=middle>所在区域</TD>
                                      <TD align=middle width=110>操作</TD>
                                    </TR>
                                    <%
if not rs_c.eof then
i=0
do while not rs_c.eof

msql="select f_grade,f_sex,f_birthday,f_edu from t_member where f_username='"&rs_c("f_username")&"'"
set user_rs=conn.execute(mSql)
if not user_rs.eof then
if user_rs("f_sex")="1" then
n_sex="男"
else
n_sex="女"
end if
if user_rs("f_birthday")<>"" then
n_age=cint(year(now()))-cint(year(user_rs("f_birthday")))+1
end if
n_grade=user_rs("f_grade")
n_edu=user_rs("f_edu")
end if
user_rs.close
set user_rs=nothing
%>
                                    <TR bgcolor="#f5f5f5"> 
                                      <TD height=20 align=middle> <input type="checkbox" name="box" value="<%=rs_c("F_ID")%>"></TD>
                                      <TD>&nbsp;<A 
            href="club_member.asp?username=<%=rs_c("f_username")%>" 
            target=_blank><U><%=rs_c("F_username")%></U></A> <% if cint(n_grade)=1 then %> <IMG src="../Images/member/nbcard.gif" width="23" height="10" hspace="1" border=0 align=absMiddle title=VIP卡会员> 
                                        <% end if %> </TD>
                                      <TD align=middle><%=n_Sex%></TD>
                                      <TD align=middle><%=n_age%></TD>
                                      <TD align=middle><%=n_edu%> </TD>
                                      <TD align=middle><%=n_area%></TD>
                                      <TD align=middle><A 
                  onclick="return confirm('您确定要给“<%=rs_c("F_username")%>”发送短讯吗？')" 
                  href="message_send.asp?re_username=<%=rs_c("F_username")%>"><IMG 
                  height=18 src="../Images/member/club_messagebutton.gif" width=37 
                  align=absMiddle border=0></A>&nbsp;</TD>
                                    </TR>
                                    <%
i=i+1
if i >= Perpage then exit do
rs_c.movenext
loop
end if
%>
                                    <TR> 
                                      <TD align=middle colSpan=7 height=25> <% If currentpage > 1 Then  %> &nbsp;<a href='myfriends.asp?flag=<%=M_Flag%>&page=<%=cstr(1)%>'><SPAN style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">9</SPAN></a> 
                                        &nbsp;<a href='myfriends.asp?flag=<%=M_Flag%>&page=<%=Cstr(currentpage-1)%>'><SPAN style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">7</SPAN></a> 
                                        &nbsp; <% Else  %> &nbsp;<SPAN style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">9</SPAN> 
                                        &nbsp;<SPAN style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">7</SPAN> 
                                        <% end if %> <%
			  if rs_c.pagecount>8 then
			  n_star=currentpage
			  n_end=currentpage+7
			  else
			  n_star=1
			  n_end=rs_c.pagecount			  
			  end if
			  %> <% FOR n=n_star to n_end %> <% if n>rs_c.pagecount then  exit for  end if%> &nbsp;<a href='myfriends.asp?flag=<%=M_Flag%>&page=<%=n%>'><FONT color=#ff0000><B><%=n%></B></FONT></a> <%
			  next
			 %> <% If currentpage < Rs_c.PageCount Then %> &nbsp;<a href='myfriends.asp?flag=<%=M_Flag%>&page=<%=Cstr(currentPage+1)%>'><SPAN  style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">8</SPAN></a> 
                                        &nbsp;<a href='myfriends.asp?flag=<%=M_Flag%>&page=<%=Cstr(Rs_c.PageCount)%>'><SPAN  style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">:</SPAN></a> 
                                        <% else %> &nbsp;<SPAN  style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">8</SPAN> 
                                        &nbsp;<SPAN  style="FONT-SIZE: 15px; COLOR: #000000; FONT-FAMILY: webdings">:</SPAN> 
                                        <% end if %> </TD>
                                    </TR>
                                  </TBODY>
                                </TABLE></TD></TR></TBODY></TABLE>
                        <table width="100%" border="0" align="center">
                          <tr> 
                            <td align="center"> [<a href="myfriends.asp?flag=1">查看我的好友</a>]&nbsp;&nbsp;[<a href="myfriends.asp?flag=0">查看黑名单</a>]&nbsp;&nbsp; 
                              <input type="hidden" name="hidDelete"> 
                              <input type="checkbox" name="allbox" value="Check All" onClick="CheckAll();">
                              选中所有&nbsp;&nbsp;&nbsp;&nbsp; 
                              <input onClick="javascript:PerDelete();" type="button"  value="删除" name="btnDelete1" style="width:50;height:18;border:1 solid #9a9999; font-size:9pt; background-color:#f8f8f8">
                            </td>
                          </tr>
                        </table>
                      </form></td>
                  </tr>
                </tbody>
              </table>
              
            </TD>
          </TR>
      </TABLE> </td>
  </tr>
</table>
<!--#include file="../include/bottom.asp" -->
</BODY></HTML>
