<!--#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">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></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>
                    <TABLE width=90% 
border=0 align="center" cellPadding=0 cellSpacing=0 class=content_border>
                      <TBODY>
                        <TR>
                          <TD align=middle><BR>
                              <%
user=nosql(request.form("user"))

sql="select username from snsn_user where username='"&user&"'"
'response.write sql
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 align='center' cellPadding=0 cellSpacing=0>"
response.write"<TR><td Class=C>"
response.write"<ul>"
response.write"<li><FONT color='ff0000'> 亲爱的会员，您要添加的好友是："&user&"，但不存在这个会员</font><br>"
response.write"</li>"
response.write"</ul>"
response.write"</TR></td></table>"
else 

if rs("username")=session("user") then
response.write"<TABLE width=578 border=0 align='center' cellPadding=0 cellSpacing=0>"
response.write"<TR><td Class=C>"
response.write"<ul>"
response.write"<li><FONT color='ff0000'> 亲爱的会员，请不要将自已添加为好友</font><br>"
response.write"</li>"
response.write"</ul>"
response.write"</TR></td></table>"
else

sql2="Select AddTime from snsn_myfriend where username='"&session("user")&"' and friend_name='"&rs("username")&"'"
set rs2=conn.execute(sql2)
if not (rs2.eof and rs2.bof) then
response.write"<TABLE width=578 border=0 align='center' cellPadding=0 cellSpacing=0>"
response.write"<TR><td Class=C>"
response.write"<ul>"
response.write"<li><FONT color='ff0000'> 亲爱的会员，您已经添加过该好友，请不要重复添加！<br>添加时间："&rs2("addtime")&"</font><br>"
response.write"</li>"
response.write"</ul>"
response.write"</TR></td></table>"
else

relation=nosql(request.form("relation"))
if relation<>"" then
sql3="Insert into snsn_myfriend(username,friend_name,relation,AddTime) values('"&nosql(session("user"))&"','"&rs("username")&"',"&relation&",getdate())"
conn.execute(sql3)
response.redirect("addfriend_new_ok.asp")
end if

rs2.close
set rs2=nothing
end if
end if
end if
%>
                              <BR>
                              <TABLE cellSpacing=0 cellPadding=0 width="95%" border=0>
                                <TBODY>
                                  <TR>
                                    <TD class=tbg1>一、对方已经是会员了</TD>
                                  </TR>
                                </TBODY>
                              </TABLE>
                              <IMG height=8 
            src="../images/shim(1).gif" width=1><BR>
                              <TABLE class=bdr1 cellSpacing=0 cellPadding=0 width="95%" 
              border=0>
                                <TBODY>
                                  <TR>
                                    <TD>
                                      <TABLE class=bdr2 cellSpacing=0 cellPadding=0 width="100%" 
                  border=0>
                                        <TBODY>
                                          <TR>
                                            <TD class=lh15><SPAN 
                        class=M>·我还不知道对方的“会员登录名”</SPAN><BR>
                        从好友中心搜索我要增加的好友 </TD>
                                          </TR>
                                        </TBODY>
                                    </TABLE></TD>
                                  </TR>
                                </TBODY>
                              </TABLE>
                              <BR>
                              <TABLE class=bdr1 cellSpacing=0 cellPadding=0 width="95%" 
              border=0>
                                <TBODY>
                                  <TR>
                                    <TD>
                                      <TABLE class=bdr2 cellSpacing=0 cellPadding=0 width="100%" 
                  border=0>
                                        <TBODY>
                                          <TR>
                                            <TD class=lh15>
                                              <script Language="JavaScript">
function check()
{
  if (trim(form1.user.value)=="") {
		alert("对方会员登陆名不能为空！");
		form1.user.focus();		
		    return (false);
  }
  if (trim(form1.relation.value)=="") {
		alert("请选择要添加到的组！");
		form1.relation.focus();		
		    return (false);
  }
else
	document.form1.submit();
}
//-->
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 

//--> 
                      </script>
                                              <FORM name=form1 action="" method=post>
                                                <TABLE width="85%" border=0 align="center" cellPadding=0 cellSpacing=1 bgcolor="#BBD7FF">
                                                  <TBODY>
                                                    <TR>
                                                      <TD height="30" bgcolor="#FFFFFF" class=c>&nbsp;输入对方的“<B>会员登录名</B>”：
                                                          <INPUT maxLength=20 
                              size=12 name="user" class="wenbenkuang"></TD>
                                                    </TR>
                                                    <TR>
                                                      <TD height="30" bgcolor="#FFFFFF" class=c>&nbsp;添加到：
                                                          <select size=1 name="relation" class="wenbenkuang">
                                                            <option value="0">我的普通好友</option>
                                                            <option value=1>我的亲密好友</option>
                                                          </select>
                                                          <input type=submit value="提交添加" name=nextsubmit class="go-wenbenkuang"></TD>
                                                    </TR>
                                                  </TBODY>
                                                </TABLE>
                                            </form></TD>
                                          </TR>
                                        </TBODY>
                                    </TABLE></TD>
                                  </TR>
                                </TBODY>
                              </TABLE>
                              <BR>
                              <BR>
                              <TABLE cellSpacing=0 cellPadding=0 width="95%" border=0>
                                <TBODY>
                                  <TR>
                                    <TD class=tbg1>二、对方还不是会员</TD>
                                  </TR>
                                </TBODY>
                              </TABLE>
                              <IMG height=8 
            src="../images/shim(1).gif" width=1><BR>
                              <TABLE class=bdr1 cellSpacing=0 cellPadding=0 width="95%" 
              border=0>
                                <TBODY>
                                  <TR>
                                    <TD>
                                      <TABLE class=bdr2 cellSpacing=0 cellPadding=0 width="100%" 
                  border=0>
                                        <TBODY>
                                          <TR>
                                            <TD class=lh15>您邀请的对象还不是交友中心会员？</TD>
                                          </TR>
                                        </TBODY>
                                    </TABLE></TD>
                                  </TR>
                                </TBODY>
                              </TABLE>
                              <BR>
                              <BR>
                              <BR>
                              <BR></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>
<!--#include file="../../end.asp"-->
</body>
</html><%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
