<!--#include file="../inc/DAL.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/page.asp"-->
<!--#include file="../inc/app.asp"-->
<!--#include file="Check.asp"-->
<%
Dim ConfigRS
Set ConfigRS=Server.CreateObject( "ADODB.Recordset" )

if request.QueryString("Method")="Del" then 
	RS_END
	dim ucname
	set Rs=DB_CONN.EXECUTE("select * from [i_User_Info] where [i_User_ID]="&request.QueryString("User_ID"))
	ucname=RS("i_User_Name")
	RS_END
    DB_CONN.EXECUTE("delete from [i_User_Info] where [i_User_ID]="&request.QueryString("User_ID"))
	i_Syn_Notify_DeleteUser ucname
    RW "<script>location.href='User_Manage.asp?t="&request("t")&"&page="&request("page")&"';</script>":response.end()
end if
if request.QueryString("Method")="Power" then 
    DB_CONN.EXECUTE("update [i_User_Info] set [i_User_Class]="&request.QueryString("V")&" where [i_User_ID]="&request.QueryString("User_ID"))
    RW "<script>location.href='User_Manage.asp?t="&request("t")&"&page="&request("page")&"';</script>":response.end()
end if
if request.QueryString("Method")="Check" then 
    DB_CONN.EXECUTE("update [i_User_Info] set [i_User_IsLock]="&request.QueryString("V")&" where [i_User_ID]="&request.QueryString("User_ID"))
    RW "<script>location.href='User_Manage.asp?t="&request("t")&"&page="&request("page")&"';</script>":response.end()
end if
dim keystr,keys
if request.QueryString("keys")<>"" then keys=request.QueryString("keys"):keystr=" where [i_sys_room_ID]  like '%"&keys&"%' or [i_User_ID] like '%"&keys&"%' or [i_User_Name] like '%"&keys&"%' or [i_User_nickname] like '%"&keys&"%' or [i_User_mail] like '%"&keys&"%' or [i_User_QQ] like '%"&keys&"%' "

if request.QueryString("t")="0" then
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID]  where [i_User_Sex]=0 order by [i_User_ID] desc")
elseif request.QueryString("t")="c" then
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID]  where [i_Sys_Room_ClassID]="&request.QueryString("CID")&" order by [i_User_ID] desc")
elseif request.QueryString("t")="1" then
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID]  where [i_User_Sex]=1 order by [i_User_ID] desc")
elseif request.QueryString("t")="s" then
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID]  where [i_User_Signing]=1 order by [i_User_ID] desc")
elseif request.QueryString("t")="r" then
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID]  where [i_User_IsRecommend]=1 order by [i_User_ID] desc")
elseif request.QueryString("t")="p" then
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID]  where [i_User_Class]="&request("PowerID")&" order by [i_User_ID] desc")
else
    Set ConfigRS=DB_CONN.EXECUTE("select * from [i_User_Info] a join [i_sys_room] b on a.[i_User_ID]=b.[i_Sys_Room_AdminUserID] "&keystr&" order by [i_User_ID] desc")
end if
ConfigRS.pagesize=20
if isempty(request("page")) or request("page")="" then curpage=1 else curpage=Cint(request("page")) end if
if not ConfigRS.eof then ConfigRS.absolutepage = curpage

Dim TitleStr:TitleStr=""
if request("PowerID")<>"" then TitleStr="用户类别"&request("PowerID")

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ImChat v1.5 Manage System</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/layoutContent.css" rel="stylesheet" type="text/css" />
<link href="themes/blue/styles.css" rel="stylesheet" type="text/css" />
<style>
.JSTB{border:#ccc solid 1px;border-right:none;border-bottom:none;margin-top:20px;}
.JSTB th,.JSTB td{border-bottom:#ccc solid 1px; border-right:#ccc solid 1px;}
</style>
</head>
<body>
<div class="contentcontainer">
    <div class="headings alt">
        <h2><font color=red><%=TitleStr%></font>&nbsp;&nbsp;·&nbsp;&nbsp;会员管理&nbsp;&nbsp;&nbsp;<a href="javascript:\\;" onclick="location.reload();" style="text-decoration:none;">刷新</a>&nbsp;&nbsp;&nbsp;<a href="User_Manage.asp?t=1" style="text-decoration:none;">男</a>&nbsp;&nbsp;&nbsp;<a href="User_Manage.asp?t=0" style="text-decoration:none;">女</a>&nbsp;&nbsp;&nbsp;<a href="User_Manage.asp" style="text-decoration:none;">所有用户</a>&nbsp;&nbsp;&nbsp;<a href="User_Manage.asp?t=s" style="text-decoration:none;">签约主播</a>&nbsp;&nbsp;&nbsp;<a href="User_Manage.asp?t=r" style="text-decoration:none;">推荐主播</a>&nbsp;&nbsp;&nbsp;关键词：<input type="text" id="keys" name="keys" value="">&nbsp;&nbsp;&nbsp;<input type="button" onclick="javascript:location.href='User_Manage.asp?keys='+document.getElementById('keys').value;" value="模糊查询"><span style="font-size:12px;"> 支持房间号，用户名，用户id，用户昵称</span></h2>
    </div>
    <div class="contentbox">
        <table class="JSTB" width="100%" cellpadding="0" cellspacing="0" border="0">
            <th colspan="12">用户列表</th>
            <tr>
                <td>ID</td>
                <td>账号</td>
                <td>昵称</td>
                <td>性别</td>
                <td>QQ</td>
                <td>头像</td>
                <td>房间</td>
                <td>类别</td>
                <td>金钱</td>
                <td>注册时间</td>
                <td>是否禁用</td>
                <td>操作</td>
            </tr>
            <script>
                function change(e,userid)
                {
                    location.href="User_Manage.asp?t=<%=request("t")%>&page=<%=request("page")%>&Method=Power&User_ID="+userid+"&V="+e.value;
                }
            </script>
            <%
            dim iPage 
            while (not ConfigRS.eof and iPage<ConfigRS.pagesize )%>
            <tr>
                <td>&nbsp;<%=ConfigRS("i_User_ID")%></td>
                <td><div style="float:left;width:100px;word-break:break-all;word-wrap: break-word;">&nbsp;<%=ConfigRS("i_User_Name")%></div></td>
                <td>&nbsp;<%=vbsUnEscape(ConfigRS("i_User_NickName"))%></td>
                <td>&nbsp;<%if Cstr(ConfigRS("i_User_Sex"))="1" then RW "男" else RW "女"%></td>
                <td>&nbsp;<%=ConfigRS("i_User_QQ")%></td>
                <td>&nbsp;<img src="<%=ConfigRS("i_User_Face")%>" onerror="this.src='/i/v1/images/face.png'" width="100" border="0"/></td>
                <td>&nbsp;<a href="/<%=ConfigRS("i_Sys_Room_ID")%>"><%=ConfigRS("i_Sys_Room_ID")%>直播间</a><br>&nbsp;<a href="EditRoom.asp?Room_ID=<%=ConfigRS("i_Sys_Room_ID")%>">编辑房间</a></td>
                <td>&nbsp;<select style="width:100px;" onchange="change(this,<%=ConfigRS("i_User_ID")%>);"><%
                dim GPRS
                set GPRS=Server.CreateObject( "ADODB.Recordset" )
                set GPRS=DB_CONN.EXECUTE("select * from [i_User_Class] order by [i_User_Class_Sort] desc")
                while not GPRS.eof
                    dim Selected
                    Selected=""
                    if Cstr(GPRS("i_User_Class_ID"))=Cstr(ConfigRS("i_User_Class")) then Selected="Selected='selected'"
                    RW "<option value='"&GPRS("i_User_Class_ID")&"' "&Selected&" >"&GPRS("i_User_Class_Name")&"</option>"
                GPRS.movenext()
                wend
                %>
                </select></td>
                <td>&nbsp;<%=ConfigRS("i_User_Money")%></td>
                <td>&nbsp;<%=ConfigRS("i_User_RegTime")%></td>
                <td>&nbsp;<a href="?Method=Check&t=<%=request("t")%>&page=<%=request("page")%>&V=<%if Cstr(ConfigRS("i_User_IsLock"))="0" then RW "1" else RW "0" end if %>&User_ID=<%=ConfigRS("i_User_ID")%>"><%if Cstr(ConfigRS("i_User_IsLock"))="0" then RW "正常" else RW "<font color=red>禁用</font>" end if %></a></td>
                <td align="center"><a href="?Method=Del&t=<%=request("t")%>&page=<%=request("page")%>&User_ID=<%=ConfigRS("i_User_ID")%>">删除</a><br><a href="EditUser.asp?UID=<%=ConfigRS("i_User_ID")%>">编辑</a><br><a href="PayInfo.asp?UID=<%=ConfigRS("i_User_ID")%>">消费明细</a><br><a href="IncomeInfo.asp?UID=<%=ConfigRS("i_User_ID")%>">收入明细</a></td>
            </tr>
            <%
            iPage=iPage+1
            ConfigRS.MoveNext
            wend
            %>
            <tr>
                <td colspan="12"><%=ExportPageInfo(ConfigRS,curpage,iPage,"User_Manage.asp?1=1"&replace(Request.QueryString,"page","1")&"&")%></td>
            </tr>
        </table>
        
    </div>
</div>
</body>
</html>
