<!--#include file="inc_const.asp"-->
<%response.expires=0
Response.CacheControl = "Private"
application.lock

set cschat=server.createobject("ffcschat.cssbchat")
my_level=cschat.getLevel(Session,Application(ConstStr & "_user_list"),Application(ConstStr & "_room_list"))
myname=cschat.myname
set cschat=nothing
application.unlock
if my_level=0 then  response.end

  Set Conn=Server.CreateObject("ADODB.Connection")
  conn.open Application( ConstStr & "_connstr")
  username=request("suser")
  set rs=conn.execute("SELECT friends FROM user WHERE username='" & myname & "'")
  if not (rs.eof or rs.bof) then
    mynamefriends=replace(" "&trim(rs("friends"))&" "," "&username&" "," ")
    conn.execute("update user set friends='"&mynamefriends&"' WHERE username='" & myname & "'")
  end if

  set rs=conn.execute("SELECT friends FROM user WHERE username='" & username & "'")
  if not (rs.eof or rs.bof) then
    usernamefriends=replace(" "&trim(rs("friends"))&" "," "&myname&" "," ")
    conn.execute("update user set friends='"&usernamefriends&"' WHERE username='" & username & "'")
  end if
  rs.close
  set rs=nothing
  conn.close
  set conn=nothing%>
<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'><meta content='text/html;charset=gb2312' http-equiv='content-type'>
<SCRIPT>parent.addsay(-1,'<\script>parent.cancelfriend(\'<%=username%>\')</\script>','','<%=myname%>',0,'green','',-5,'<%=time()%>');</script>