<!--#include file="../inc/Bll.asp"-->
<!--#include file="../inc/Constant.asp"-->
<!--#include file="../inc/Md5.asp"-->
<!--#include file="../inc/App.asp"-->

<%

'uroomid,uface,unick,upaylevelcalss,upaynum
if Request.QueryString("ac")="AddFriend" then 
	RS_End
	dim SumPay,SumIncome,CurrentPage,k,Re,RID,isManager,UID,RoomID
	if Session(Session_UserID_Arg)="" then RW "var addfriendRe='游客无法添加好友！';":REND
	if Request.QueryString("uid")="" then RW "var addfriendRe='参数错误！';":REND
	if not IsNumeric(Request.QueryString("uid")) then RW "var addfriendRe='无法添加游客为好友！';":REND
	UID = Request.QueryString("uid")
	if Request.QueryString("rid")="" then RW "var addfriendRe='参数错误！';":REND
	if not IsNumeric(Request.QueryString("rid")) then RW "var addfriendRe='参数错误！';":REND
	RoomID = Request.QueryString("rid")
	if Clng(Session(Session_UserID_Arg))=Clng(UID) then RW "var addfriendRe='无法对自己操作！';":REND
	Set RS = DB_CONN.EXECUTE("select CharIndex('|"&UID&"|',[i_Sys_Room_ManagerUsers]) as 'ismanager' from [i_Sys_Room] where [i_Sys_Room_ID]="&RoomID)
	'if RS("ismanager")<1 then RW "var addfriendRe='您不是管理员，无权限进行操作！';":REND
	if Clng(Session(Session_UserID_Arg))=Clng(UID) then RW "var addfriendRe='无法对自己操作！';":REND
	RS_End
	RS.OPEN "select top 1 * from [i_User_Friends] where [i_User_Friends_GUID]="&UID&" and [i_User_Friends_UID]="&Session(Session_UserID_Arg) , DB_CONN , 1 , 3
	if RS.recordcount>0 then RW "var addfriendRe='已向对方发送过好友申请！';":REND
	RS.addnew()
	RS("i_User_Friends_UID")=Session(Session_UserID_Arg)
	RS("i_User_Friends_GUID")=UID
	RS("i_User_Friends_Note")="对方希望把您加为好友"
	RS.update()
	RS_End
	RW "var addfriendRe=true;"
	Rend
end if



%>