<%Response.CacheControl = "Private" response.expires=0 myid=Session("myid") myname=Session("myname") application.lock call get_guests call get_maxuser if myid="" or myname="" then response.end if myname<>guests(myid,0) or Session("mytemp")<>guests(myid,1) then response.end sub newsay(who,towho,secret,room_id,mess,c1,c2,act) say_id=says(current,0)+1 current=current+1 if current>MaxTalk then current=0 says(current,0)=say_id says(current,1)=who says(current,2)=towho says(current,3)=secret says(current,4)=room_id if secret then tt=1 else tt=0 end if says(current,5)="'"&mess&"','"&who&"','"&towho&"',"&tt&",'"&c1&"','"&c2&"',"&act&",'"&time()&"'," end sub ID=cint(request.querystring("ID")) if request("answer")="yes" then answer=true else answer=false end if errstr="" set rs=conn.execute("select * from friendrq where towho='"&myname&"' and ID="&ID) if rs.eof or rs.bof then errstr="没有找到好友申请的记录,加入好友失败!" else username=trim(rs("who")) if username=myname then errstr="你不能成为你自己的好友!" else set rs=conn.execute("SELECT friends FROM user WHERE username='" & username & "'") if rs.eof or rs.bof then errstr=username&"还没有被注册呢!" else usernamefriends=" "&trim(rs("friends"))&" "&myname&" " if len(usernamefriends)>250 then errstr=username&"的好友名单已经满了!不允许在添加新的好友!" else set rs=conn.execute("SELECT friends FROM user WHERE username='" & myname & "'") if instr(rs("friends")," "&username&" ")<>0 then errstr=username&"已经在你的好友名单里面了!" else mynamefriends=" "&trim(rs("friends"))&" "&username&" " if len(mynamefriends)>250 then errstr="你的好友名单已经满了!不允许在添加新的好友!" else EXflag=false for i=0 to maxuser if guests(i,0)=username then EXflag=true exit for end if next if answer then conn.execute("update user set friends='"&usernamefriends&"' where username='"&username&"'") conn.execute("update user set friends='"&mynamefriends&"' where username='"&myname&"'") errstr="你和"&username&"正式成为好友!恭喜!" callmess="你好!很高兴能和你成为好友!" else errstr="你拒绝了"&username&"的好友申请!" callmess="对不起!我现在还不能和你成为好友!" end if conn.execute("insert into calls (who,towho,callmess,calltime,read) values ('"&myname&"','"&username&"','"&callmess&"','"&now()&"',false)") if EXflag then call get_says call newsay(username,username,true,-2,"<\script>window.open(\'getcall.asp\',\'\',\'width=550,height=300,scrollbars=1\');","#","#",-5) call put_says end if end if end if end if end if end if end if conn.execute("delete from friendrq where towho='"&myname&"' and ID="&ID) response.write "" rs.close set rs=nothing conn.close set conn=nothing%>