<!-- #include file="conn.asp" -->
<!-- #include file="bbsuser.asp" -->
<%
id=request("id")
postuser=request("postuser")
   sql="select friend from clubuser where clubuser_name='"&request.cookies("name")&"'"
   set rs=server.createobject("adodb.recordset")
   rs.open sql,conn,1,1
   if rs("friend")<>"" and instr(rs("friend"),"|")>0 then
   myarray=split(rs("friend"),"|")
   for i=0 to UBound(myarray)
     if InStr(myarray(i),request("postuser"))>0 then
	    str="delete from sms where id="&id
        conn.execute(str)
        response.write "<script language='javascript'>"
        response.write "alert('你已经加入了该用户为好友！');"
        response.write "history.go(-1);"
        response.write "</script>"
        response.end
	 else
	    postuser=rs("friend")&request("postuser")&"|"
	 end if
   next
   else
      postuser=request("postuser")&"|"
   end if
   str="update clubuser set friend='"&postuser&"' where clubuser_name='"&request.cookies("name")&"'"
   conn.execute(str)
   str="delete from sms where id="&id
   conn.execute(str)
   conn.close
   response.write "<script language='javascript'>"
   response.write "alert('加入成功！');"
   response.write "history.go(-1);"
   response.write "</script>"
   response.end
%>