<object runat=server id=conn1 progid="adodb.connection"></object>
<%application.Lock
conn1.Open Application("p_jyzx")
Application.UnLock
%>
<%

sql="select * from myfriend where user_name='"&session("Current_user")&"'"
sql=sql&" and friend_name='"&Request("user_name")&"'"

set rs=server.CreateObject ("ADODB.recordset")
 rs.Open sql,conn1,3
if rs.RecordCount <>0 then
 
%>

<html>
<head>
<title>加为好友</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>
<LINK href="/css/default.css" rel=stylesheet>
<body bgcolor="#FFF8E1" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="400" border="0" cellspacing="0" cellpadding="0" >
  <tr> 
    
  <td width="395"   height="25"><font size="4" color="#FF9933"><b><img src="images/a0.gif" width="18" height="18" align="absmiddle"> 
      加为好友</b></font> </td>
  </tr>
  <tr> 
    <td  align="center"> 
<br><br><br><br><br>
<center><font color=red><b>“<%=Request("nickname")%>”</font>已经是您的好友拉！不用再加了，8-）!</b></font></center>
<br><br><br><br><br>
<br><br>
     
    </td>
  </tr>
  <tr>
    <td  align=center><a href="javascript:window.close()">[关闭窗口]</a></td>
  </tr>
</table>
</body>
</html>

<%
else
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open "myfriend",conn1,3,2
	rs.addnew
	rs("user_name")=session("Current_user")
	rs("friend_name")=Request("user_name")
	rs("time")=now()
	rs.update

%>
<html>
<head>
<title>加为好友</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>
<LINK href="/css/default.css" rel=stylesheet>
<body bgcolor="#FFF8E1" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="400" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    
  <td width="395"   height="25"><font size="4" color="#FF9933"><b><img src="images/a0.gif" width="18" height="18" align="absmiddle"> 
      加为好友</b></font> </td>
  </tr>
  <tr> 
    <td  align="center"> 
<br><br><br><br><br>
<center>您已经成功地将<font color=red><b>“<%=Request("nickname")%>”</b></font>加为您的好友啦！</center>
<br><br><br><br><br>
<br><br><br>
     
    </td>
  </tr>
   <tr>
    <td  align=center><a href="javascript:window.close()">[关闭窗口]</a></td>
  </tr>
</table>
</body>
</html>
<%

end if 
 %>
 
