<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/md5.asp"-->
 <%
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交易助手管理操作平台_<%=webname%></title>
<link rel="stylesheet" href="/css.css" type="text/css">
</head>
<body><!--#include file="../../top.asp"-->
<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
    <td width="970"><table width="970"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="10"><img src="/img/m_left.gif" width="10" height="20"></td>
          <td width="950" bgcolor="#FFFFFF"></td>
          <td width="10"><img src="/img/m_right.gif" width="10" height="20"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="188" colspan="3"><table width="950"  border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="1" bgcolor="efefef"></td>
                <td width="200" height="77" valign="top"><!--#include file="../left.asp"--></td>
                <td width="1" bgcolor="efefef"></td>
                <td valign="top"><p>&nbsp;</p>
                    <BR>
                    <p>
                      <%							  
			user=nosql(request("user"))
			if user<>"" then
			sql="select username from snsn_user where username='"&user&"'"
			Set rs= Server.CreateObject("ADODB.Recordset")
			rs.open sql,conn,1,1
if rs.eof or rs.bof then
		response.write"<TABLE width=578 border=0 class=content_border align='center' cellPadding=0 cellSpacing=0>"
		response.write"<TR><td Class=C><Br>"
		response.write"<ul>"
		response.write"<li><FONT color='ff0000'><B> 错误：<b><br>亲爱的会员，您要添加的好友是："&user&"，但交友中心不存在这个会员</font><br>"
		response.write"</li>"
		response.write"</ul>"
		response.write"</TR></td></table>"
		flo=1
elseif user=session("user") then
		response.write"<TABLE width=578 border=0 class=content_border align='center' cellPadding=0 cellSpacing=0>"
		response.write"<TR><td Class=C><Br>"
		response.write"<ul>"
		response.write"<li><FONT color='ff0000'><B> 错误：<b><br>亲爱的会员，请不要将自己添加为好友</font><br>"
		response.write"</li>"
		response.write"</ul>"
		response.write"</TR></td></table>"
		flo=1
end if
sql2="select * from snsn_myfriend where (username='"&session("user")&"' and friend_name='"&user&"') or (username='"&user&"' and friend_name='"&session("user")&"')"
set rs2=conn.execute(sql2)
if not rs2.eof then
	response.write"<TABLE width=578 border=0 class=content_border align='center' cellPadding=0 cellSpacing=0>"
	response.write"<TR><td Class=C><Br>"
	response.write"<ul>"
	response.write"<li><FONT color='ff0000'><B> 错误：<b><br>亲爱的会员，您已经添加过该好友，请不要重复添加！<br>添加时间："&rs2("addtime")&"</font><br>"
	response.write"</li>"
	response.write"</ul>"
	response.write"</TR></td></table>"
	flo=1
end if
		sql="select * from snsn_friendlist where username='"&user&"' and friend_name='"&session("user")&"'"
		set rs3=conn.execute(sql)
	if not rs3.eof then
		response.write"<TABLE width=578 border=0 class=content_border align='center' cellPadding=0 cellSpacing=0>"
	response.write"<TR><td Class=C><Br>"
	response.write"<ul>"
	response.write"<li><FONT color='ff0000'><B> 错误：<b><br>亲爱的会员，"&user&"已经向你发出了好友请求<br>"
	response.write"</li>"
	response.write"</ul>"
	response.write"</TR></td></table>"
	flo=1
	end if
end if

relation=nosql(request.form("relation"))
if flo<>1 then
if relation<>"" then
	user1=rs("username")
	sql="select * from snsn_friendlist where username='"&session("user")&"' and friend_name='"&user1&"'"
	set rs=conn.execute(sql)
if rs.eof then
	title="好友请求"
	content=session("user")&"向你发出了好友请求<br><b color=red><a href=/my/love/friendlist.asp>点击查看</a></b>"
	sql="select * from snsn_user where username='"&user1&"'"
	set rs_user=conn.execute(sql)
	sql="insert into snsn_getprice (title,content,sendemail,sendcontact,checkdate,mycid,sendcid,datetime) values('"&title&"','"&content&"',0,0,0,"&rs_user("id")&","&session("id")&",'"&now&"')"
	conn.execute(sql)
	set rs_waj=Server.CreateObject("ADODB.Recordset")
	rs_waj.open "select * from snsn_friendlist",conn,1,3
	rs_waj.addnew
	rs_waj("username")=session("user")
	rs_waj("friend_name")=user1
	rs_waj("relation")=relation
	rs_waj("AddTime")=now()
	rs_waj.update
	response.Write("<script>alert('请求已经发出,请等待对方回应')</script>")
else
	response.Write("<script>alert('您之前已经向这位好友发出了请求,\n请等待对方回应')</script>")
end if
end if
end if
			del=request.QueryString("del")
			acc=request.QueryString("acc")
			sayno=request.QueryString("sayno")
			listid=request.QueryString("listid")
		if del=1 and isChkInteger(listid) then
				sql="select * from snsn_friendlist where id="&listid
				set rs=conn.execute(sql)
			if not rs.eof then
				if cstr(rs("username"))=session("user") then
					sql="delete from snsn_friendlist where id="&listid
					conn.execute(sql)
				else
					response.Write("<script>alert('你没有权利执行此条记录命令')</script>")
				end if
				else
					response.Write("<script>alert('没有找到这一条记录')</script>")
				end if
				response.write("<script>window.location.href='friendlist.asp'</script>")
				response.End()
			end if
			if acc=1 and isChkInteger(listid) then
				title="<b color=red>系统消息</b>"
				content="<b>"&session("user")&"已经接受了你的好友请求</>"
				sql="select * from snsn_friendlist where id="&listid
				set rs_friend=conn.execute(sql)
				if not rs_friend.eof then
				if  cstr(rs_friend("friend_name"))=session("user") then
sql="insert into snsn_myfriend(username,friend_name,relation,AddTime) values('"&rs_friend("username")&"','"&rs_friend("friend_name")&"','"&rs_friend("relation")&"','"&now&"')"
conn.execute(sql)
sql="insert into snsn_myfriend(friend_name,username,relation,AddTime) values('"&rs_friend("username")&"','"&rs_friend("friend_name")&"','"&rs_friend("relation")&"','"&now&"')"
conn.execute(sql)
				sql="select * from snsn_user where username='"&rs_friend("username")&"'"
				set rs_user=conn.execute(sql)
				sql="insert into snsn_getprice (title,content,sendemail,sendcontact,checkdate,mycid,sendcid,datetime) values('"&title&"','"&content&"',0,0,0,"&rs_user("id")&","&session("id")&",'"&now&"')"
				conn.execute(sql)
				sql="delete from snsn_friendlist where id="&listid
				conn.execute(sql)
				rs_user.close
				set rs_user=nothing
				rs_friend.close
				set rs_friend=nothing
				else
				response.Write("<script>alert('你没有权利执行此条记录命令')</script>")
				end if
				else
				response.Write("<script>alert('没有找到这一条记录')</script>")
				end if
				response.write("<script>window.location.href='friendlist.asp'</script>")
				response.End()
			end if
			if sayno=1 and isChkInteger(listid) then
				title="<b color=red>系统消息</b>"
				content="<b>"&session("user")&"已经拒绝了你的好友请求</>"
				sql="select * from snsn_friendlist where id="&listid
				set rs_msn=conn.execute(sql)
				if not rs_msn.eof then
				if cstr(rs_msn("friend_name"))=session("user") then
				sql="select * from snsn_user where username='"&rs_msn("username")&"'"
				set rs_user=conn.execute(sql)
sql="insert into snsn_getprice (title,content,sendemail,sendcontact,checkdate,mycid,sendcid,datetime) values('"&title&"','"&content&"',0,0,0,"&rs_user("id")&","&session("id")&",'"&now&"')"
				conn.execute(sql)
				sql="delete from snsn_friendlist where id="&listid
				conn.execute(sql)
				rs_msn.close
				set rs_msn=nothing
				else
				response.Write("<script>alert('你没有权利执行此条记录命令')</script>")
				end if
				else
				response.Write("<script>alert('没有找到这一条记录')</script>")
				end if
				response.write("<script>window.location.href='friendlist.asp'</script>")
				response.End()
			end if
%>
                    </p>
                    <TABLE width="578" border=0 align="center" cellPadding=0 cellSpacing=0>
                      <TBODY>
                        <TR>
                          <TD vAlign=top align=middle>
                            <TABLE class=fbg1 width="100%" board="0">
                              <TBODY>
                                <TR>
                                  <TD>
                                    <DIV id=nav><strong></strong></DIV></TD>
                                </TR>
                              </TBODY>
                            </TABLE>
                            <TABLE width="100%" 
                  border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#BBD7FF">
                              <TBODY>
                                <TR>
                                  <TD height="30" bgcolor="#e8f4ff"><B><font color="#Ff6600">&nbsp;<A 
                          href="haoyou.asp">回到“我的好友”</A></font></B></TD>
                                </TR>
                                <TR>
                                  <TD height="30" bgcolor="#e8f4ff"><B><font color="#Ff6600">&nbsp;<A 
                          href="addfriend_new.asp">再增加一个好友</A></font></B></TD>
                                </TR>
                                <TR bgColor=#FFFFFF>
                                  <TD height="14" class=C style="LINE-HEIGHT: 150%"><strong><span class="M"><B><font color="#Ff6600"> &nbsp;以下是你所发出的请求列表:<b onClick="cc()" onMouseOver="this.style.cursor='hand'">点击查看/隐藏</b></font></B></span></strong></TD>
                                </TR>
                                <TR bgColor=#FFFFFF>
                                  <TD id="aa" height="15" class=C style="LINE-HEIGHT: 150%">
								 <%
							sql="select * from snsn_friendlist where username='"&session("user")&"'"
							set rs=conn.execute(sql)
							if rs.eof then
							response.Write("<table width='100%'  border=0 align=center cellPadding=0 cellSpacing=1 bgcolor='#BBD7FF'><tr><td>对不起,没有任何你所要查看的消息</td></tr></table>")
							else
								 %>
								 
							<table width="100%"  border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#BBD7FF">
							<tr>
							<td width="49%" height="21" align="center" bgcolor="#EFF7FF">请求对象</td>
							<td width="24%" height="21" align="center" bgcolor="#EFF7FF">请求时间</td>
							<td width="14%" height="21" align="center" bgcolor="#EFF7FF">是否同意</td>
							<td width="13%" height="21" align="center" bgcolor="#EFF7FF">删除请求</td>
							</tr>
						<%while not rs.eof%>
	<tr>
	<td height="21" align="center" bgcolor="#FFFFFF"><%=rs("friend_name")%></td>
	<td height="21" align="center" bgcolor="#FFFFFF"><%=rs("Addtime")%></td>
	<td height="21" align="center" bgcolor="#FFFFFF"><%if rs("topro")=1 then%>已经同意
														<%elseif rs("topro")=0 then%>尚未回复
														<%elseif rs("topro")=-1 then%>已经拒绝
									  <%end if%></td>
	<td height="21" align="center" bgcolor="#FFFFFF"><a href="friendlist.asp?del=1&listid=<%=rs("id")%>">取消请求</a></td>
	</tr>
																								
						<%
						rs.movenext
						wend%>
						 </table>
						 </td></tr>
						 <%end if%>
						 <TR bgColor=#FFFFFF>
                                  <TD height="14" class=C style="LINE-HEIGHT: 150%"><strong><span class="M"><B><font color="#Ff6600"> &nbsp;以下是别人对你所发出的请求列表:<b onClick="gg()" onMouseOver="this.style.cursor='hand'">点击查看/隐藏</b></font></B></span></strong></TD>
                                </TR>
								<TR bgColor=#FFFFFF>
                                  <TD height="15" id="nn" class=C style="LINE-HEIGHT: 150%">
								 <%
							sql="select * from snsn_friendlist where friend_name='"&session("user")&"'"
							set rs=conn.execute(sql)
							if rs.eof then
							response.Write("<table width='100%'  border=0 align=center cellPadding=0 cellSpacing=1 bgcolor='#BBD7FF'><tr><td>对不起,没有任何你所要查看的消息</td></tr></table>")
							else
								 %>
								 
							<table width="100%"  border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#BBD7FF">
							<tr><td width="49%" height="21" align="center" bgcolor="#EFF7FF">请求人</td>
							<td width="24%" height="21" align="center" bgcolor="#EFF7FF">请求时间</td>
							<td width="27%" height="21" align="center" bgcolor="#EFF7FF">是否同意</td>
							</tr>
						<%while not rs.eof%>
	<tr><td height="21" align="center" bgcolor="#FFFFFF"><%=rs("username")%></td><td height="21" align="center" bgcolor="#FFFFFF"><%=rs("Addtime")%></td><td height="21" align="center" bgcolor="#FFFFFF"><%if rs("topro")=1 then%>已经同意
		<%elseif rs("topro")=0 then%><a href="friendlist.asp?acc=1&listid=<%=rs("id")%>">接受</a>/
					<a href="friendlist.asp?sayno=1&listid=<%=rs("id")%>">拒绝</a>
														<%elseif rs("topro")=-1 then%>已经拒绝
														<%end if%>
										</td></tr>
																								
						<%
						rs.movenext
						wend
						%>
						 </table>
						 </td></tr>
						 <% end if%>
	
                                <TR bgColor=#FFFFFF>
                                  <TD height="30" class=C style="LINE-HEIGHT: 150%"><B><font color="#Ff6600">&nbsp;</font></B> <IMG src="../images/icon_3.gif"
      align=absMiddle> <A 
            href="../../index.asp">返回<%=webname%>首页</A> </TD>
                                </TR>
                              </TBODY>
                          </TABLE></TD>
                        </TR>
                      </TBODY>
                    </TABLE>
                </td>
              </tr>
          </table></td>
        </tr>
    </table></td>
    <td valign="top"><img src="/img/index_img.jpg" width="10"></td>
  </tr>
</table>
<script language="javascript">
	function cc(){
		if(document.all.aa.style.display=="none"){
			document.all.aa.style.display=""
		}else{
			document.all.aa.style.display="none"
		}
	}
	function gg(){
		if(document.all.nn.style.display=="none"){
			document.all.nn.style.display=""
		}else{
			document.all.nn.style.display="none"
		}
	}
</script>
<!--#include file="../../end.asp"-->
</body>
</html>
