<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="plus/xzplus/inc/DvADCharxz.asp" -->
<!-- #include file="inc/GroupPermission.asp" -->

<%
	Head()
	dim admin_flag,sqlstr,myrootid
	FoundErr=False 
	admin_flag=",14,"
	if dvbbs.UserGroupID>1 then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=admin_login.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
		dvbbs_error()
else

	'if not Dvbbs.master or instr(","&session("flag")&",",admin_flag)=0 then
	'	Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=admin_login.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
	'	dvbbs_error()
	'End if
	if request("action")="fix" Then
	Call Fixuser()
	End If
dim trs
dim userinfo
dim usertitle
%>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<tr>
<th align=left colspan=8 height=23>用户管理</th>
</tr>
<%if request("action")="" or request("userSearch")="0" then%>
<form action="?action=userSearch" method=post>
<tr>
<td width=20% class=forumrow>注意事项</td>
<td width=80% class=forumrow>在记录很多的情况下搜索条件越多查询越慢，请尽量减少查询条件；最多显示记录数也不宜选择过大</td>
</tr>
<tr>
<td width=20% class=forumrow>最多显示记录数</td>
<td width=80% class=forumrow><input size=45 name="searchMax" type=text value=100></td>
</tr>
<tr>
<td width=20% class=forumrow>用户名</td>
<td width=80% class=forumrow><input size=45 name="username" type=text>&nbsp;<input type=checkbox name="usernamechk" value="yes" checked>用户名完整匹配</td>
</tr>
<tr>
<td width=20% class=forumrow>用户组</td>
<td width=80% class=forumrow>
<select size=1 name="usergroups">
<option value=0>任意</option>
<%
set rs=Dvbbs.Execute("select usergroupid,title from dv_usergroups where ParentGID=0 order by usergroupid")
do while not rs.eof
response.write "<option value="&rs(0)&">"&rs(1)&"</option>"
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>用户等级</td>
<td width=80% class=forumrow>
<select size=1 name="userclass">
<option value=0>任意</option>
<%
set rs=Dvbbs.Execute("select usertitle from dv_usergroups order by usergroupid")
do while not rs.eof
response.write "<option value="&rs(0)&">"&rs(0)&"</option>"
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>Email包含</td>
<td width=80% class=forumrow><input size=45 name="userEmail" type=text></td>
</tr>
<tr>
<td width=20% class=forumrow>用户IM包含</td>
<td width=80% class=forumrow><input size=45 name="userim" type=text> 包括主页、OICQ、UC、ICQ、YAHOO、AIM、MSN</td>
</tr>
<tr>
<td width=20% class=forumrow>登录IP包含</td>
<td width=80% class=forumrow><input size=45 name="lastip" type=text></td>
</tr>
<tr>
<td width=20% class=forumrow>头衔包含</td>
<td width=80% class=forumrow><input size=45 name="usertitle" type=text></td>
</tr>
<tr>
<td width=20% class=forumrow>签名包含</td>
<td width=80% class=forumrow><input size=45 name="sign" type=text></td>
</tr>
<tr>
<td width=20% class=forumrow>详细资料包含</td>
<td width=80% class=forumrow><input size=45 name="userinfo" type=text></td>
</tr>
<!--shinzeal加入特殊搜索-->
<tr>
<th align=left colspan=2 height=23>特殊查询&nbsp;（注意： <多于> 或 <少于> 已默认包含 <等于>；条件留空则不使用此条件 ）</th>
</tr>
<tr>
<td width=100% class=forumrow colspan=2><table ID="Table1">
<tr>
<td width=50%>登录次数:<input type=radio value=more name="loginR" checked ID="Radio1">&nbsp;多于&nbsp;<input type=radio value=less name="loginR" ID="Radio2">&nbsp;少于&nbsp;&nbsp;<input size=5 name="loginT" type=text ID="Text1"> 次&nbsp;&nbsp;</td>
<td width=50%>消失天数:<input type=radio value=more name="vanishR" checked ID="Radio3">&nbsp;多于&nbsp;<input type=radio value=less name="vanishR" ID="Radio4">&nbsp;少于&nbsp;&nbsp;<input size=5 name="vanishT" type=text ID="Text2"> 天&nbsp;&nbsp;</td>
</tr>

<tr>
<td width=50%>注册天数:<input type=radio value=more name="regR" checked ID="Radio5">&nbsp;多于&nbsp;<input type=radio value=less name="regR" ID="Radio6">&nbsp;少于&nbsp;&nbsp;<input size=5 name="regT" type=text ID="Text3"> 天&nbsp;&nbsp;</td>
<td width=50%>发表帖数:<input type=radio value=more name="artcleR" checked ID="Radio7">&nbsp;多于&nbsp;<input type=radio value=less name="artcleR" ID="Radio8">&nbsp;少于&nbsp;&nbsp;<input size=5 name="artcleT" type=text ID="Text4"> 篇&nbsp;&nbsp;</td>
</tr><!--特殊搜索结束-->
<tr>
<td width=100% class=forumrow align=center colspan=3><input name="submit" type=submit value="   搜  索   "></td>
</tr>
<input type=hidden value="9" name="userSearch">
</form>
<%
elseif request("action")="userSearch" then
%>
<tr>
<th colspan=4 align=left height=23>搜索结果</th>
</tr>
<%

	dim currentpage,page_count,Pcount
	dim totalrec,endpage
	currentPage=request("page")
	if currentpage="" or not IsNumeric(currentpage) then
		currentpage=1
	else
		currentpage=clng(currentpage)
		if err then
			currentpage=1
			err.clear
		end if
	end if
	Set rs= Server.CreateObject("ADODB.Recordset")
	select case request("userSearch")
	case 1
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid order by u.UserID desc"
	case 2
		sql="select top 100  u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid order by u.UserPost desc"
	case 3
		sql="select top 100 u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid order by u.UserPost"
	case 4
		If IsSqlDataBase=1 Then
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where datediff(hour,u.LastLogin,"&SqlNowString&")<25 order by u.lastlogin desc"
		else
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where datediff('h',u.LastLogin,"&SqlNowString&")<25 order by u.lastlogin desc"
		end if
	case 5
		If IsSqlDataBase=1 Then
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where datediff(hour,u.JoinDate,"&SqlNowString&")<25 order by u.UserID desc"
		else
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where datediff('h',u.JoinDate,"&SqlNowString&")<25 order by u.UserID desc"
		end if
	case 6
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.usergroupid=5 order by u.UserID desc"
	case 7
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.usergroupid=6 order by u.UserID desc"
	case 8
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.usergroupid<4 order by u.usergroupid"
	case 11
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.lockuser=2 order by userid desc"
	case 12
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.lockuser=1 order by userid desc"
	case 13
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.IsChallenge=1 order by userid desc"
	case 14
		sql="select distinct u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID,xzdata from [dv_user] u Inner Join Dv_UserAccess UC On u.UserID=UC.uc_UserID order by userid desc"
	case 9
		sqlstr=""
		if request("username")<>"" then
			if request("usernamechk")="yes" then
			sqlstr=" u.username='"&request("username")&"'"
			else
			sqlstr=" u.username like '%"&request("username")&"%'"
			end if
		end if
		if cint(request("usergroups"))>0 then
			if sqlstr="" then
			sqlstr=" u.usergroupid="&request("usergroups")&""
			else
			sqlstr=sqlstr & " and u.usergroupid="&request("usergroups")&""
			end if
		end if
		if request("userclass")<>"0" then
			if sqlstr="" then
			sqlstr=" u.userclass='"&request("userclass")&"'"
			else
			sqlstr=sqlstr & " and u.userclass='"&request("userclass")&"'"
			end if
		end if
		if request("useremail")<>"" then
			if sqlstr="" then
			sqlstr=" u.useremail like '%"&request("useremail")&"%'"
			else
			sqlstr=sqlstr & " and u.useremail like '%"&request("useremail")&"%'"
			end if
		end if
		if request("userim")<>"" then
			if sqlstr="" then
			sqlstr=" u.UserIM like '%"&request("userim")&"%'"
			else
			sqlstr=sqlstr & " and u.UserIM like '%"&request("userim")&"%'"
			end if
		end if
		if request("lastip")<>"" then
			if sqlstr="" then
			sqlstr=" u.UserLastIP like '%"&request("lastip")&"%'"
			else
			sqlstr=sqlstr & " and u.UserLastIP like '%"&request("lastip")&"%'"
			end if
		end if
		if request("userinfo")<>"" then
			if sqlstr="" then
			sqlstr=" u.UserInfo like '%"&request("userinfo")&"%'"
			else
			sqlstr=sqlstr & " and u.UserInfo like '%"&request("userinfo")&"%'"
			end if
		end if
		if request("title")<>"" then
			if sqlstr="" then
			sqlstr=" u.usertitle like '%"&request("title")&"%'"
			else
			sqlstr=sqlstr & " and u.usertitle like '%"&request("title")&"%'"
			end if
		end if
		if request("sign")<>"" then
			if sqlstr="" then
			sqlstr=" u.usersign like '%"&request("sign")&"%'"
			else
			sqlstr=sqlstr & " and u.usersign like '%"&request("sign")&"%'"
			end if
		end if

'======shinzeal加入特殊搜索=======
		dim Tsqlstr
		if request("loginT")<>"" then
		   	if request("loginR")="more" then
			 Tsqlstr=" u.userlogins >= "&request("loginT")&""
			else
			 Tsqlstr=" u.userlogins <= "&request("loginT")&""
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & "and" & Tsqlstr
			end if 
		end if

		if request("vanishT")<>"" then
		   	if request("vanishR")="more" then
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,u.lastlogin,"&SqlNowString&") >= "&request("vanishT")&""
				Else
					Tsqlstr=" datediff('d',u.lastlogin,"&SqlNowString&") >= "&request("vanishT")&""
				End If
			else
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,u.lastlogin,"&SqlNowString&") <= "&request("vanishT")&""
				Else
					Tsqlstr=" datediff('d',u.lastlogin,"&SqlNowString&") <= "&request("vanishT")&""
				End If
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & "and" & Tsqlstr
			end if 
		end if

		if request("regT")<>"" then
		   	if request("regR")="more" then
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,u.JoinDate,"&SqlNowString&") >= "&request("regT")&""
				Else
					Tsqlstr=" datediff('d',u.JoinDate,"&SqlNowString&") >= "&request("regT")&""
				End If
			else
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,u.JoinDate,"&SqlNowString&") <= "&request("regT")&""
				Else
					Tsqlstr=" datediff('d',u.JoinDate,"&SqlNowString&") <= "&request("regT")&""
				End If
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & "and" & Tsqlstr
			end if 
		end if

		if request("artcleT")<>"" then
		   	if request("artcleR")="more" then
			 Tsqlstr=" u.UserPost >= "&request("artcleT")&""
			else
			 Tsqlstr=" u.UserPost <= "&request("artcleT")&""
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & "and" & Tsqlstr
			end if 
		end if
'======特殊搜索结束======
		if sqlstr="" then
		response.write "<tr><td colspan=8 class=forumrow>请指定搜索参数！&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		response.end
		end if
		sql="select top "&request("searchmax")&" u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where "&sqlstr&" order by u.UserID desc"
	case 10
		sql="select u.userid,u.username,u.useremail,u.LastLogin,u.UserLastIP,u.UserPost,u.UserGroupID from [dv_user] u inner join dv_UserGroups G on u.usergroupid=g.usergroupid where u.usergroupid="&request("usergroupid")&" order by u.UserID desc"
	case else
		response.write "<tr><td colspan=8 class=forumrow>错误的参数。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		response.end
	end select
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		response.write "<tr><td colspan=8 class=forumrow>没有找到相关记录。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
	else
%>
<FORM METHOD=POST ACTION="?action=touser">
<tr align=center>
<td class=forumRowHighlight height=23><B>用户名</B></td>
<td class=forumRowHighlight><B>Email</B></td>
<td class=forumRowHighlight><B>最后登录</B></td>
<td class=forumRowHighlight>　</td>
</tr>
<%
		rs.PageSize = Cint(Dvbbs.Forum_Setting(11))
		rs.AbsolutePage=currentpage
		page_count=0
		totalrec=rs.recordcount
		while (not rs.eof) and (not page_count = Cint(Dvbbs.Forum_Setting(11)))
%>
<tr>
<td class=forumrow><a href="?action=modify&userid=<%=rs("userid")%>"><%=rs("username")%></a></td>
<td class=forumrow width=30% ><a href="mailto:<%=rs("useremail")%>"><%=rs("useremail")%></a></td>
<td class=forumrow width=15% ><%if rs("lastlogin")<>"" and isdate(rs("lastlogin")) then%><%=Formatdatetime(rs("lastlogin"),2)%><%end if%></td>
<td class=forumrow align=center>　</td>
</tr>
<%
		page_count = page_count + 1
		rs.movenext
		wend
Pcount=rs.PageCount
%>
<tr><td colspan=4 class=forumrow align=center>分页：
<%
	if currentpage > 4 then
'shinzeal加入特殊搜索的分页代码
	response.write "<a href=""?page=1&userSearch="&request("userSearch")&"&username="&request("username")&"&useremail="&request("useremail")&"&homepage="&request("homepage")&"&oicq="&request("oicq")&"&icq="&request("icq")&"&msn="&request("msn")&"&title="&request("title")&"&sign="&request("sign")&"&userclass="&request("userclass")&"&usergroups="&request("usergroups")&"&action="&request("action")&"&usergroupid="&request("usergroupid")&"&loginR="&request("loginR")&"&loginT="&request("loginT")&"&vanishR="&request("vanishR")&"&vanishT="&request("vanishT")&"&regR="&request("regR")&"&regT="&request("regT")&"&artcleR="&request("artcleR")&"&artcleT="&request("artcleT")&"&searchmax="&request("searchmax")&""">[1]</a> ..."
	end if
	if Pcount>currentpage+3 then
	endpage=currentpage+3
	else
	endpage=Pcount
	end if
	for i=currentpage-3 to endpage
	if not i<1 then
		if i = clng(currentpage) then
        response.write " <font color=red>["&i&"]</font>"
		else
        response.write " <a href=""?page="&i&"&userSearch="&request("userSearch")&"&username="&request("username")&"&useremail="&request("useremail")&"&homepage="&request("homepage")&"&oicq="&request("oicq")&"&icq="&request("icq")&"&msn="&request("msn")&"&title="&request("title")&"&sign="&request("sign")&"&userclass="&request("userclass")&"&usergroups="&request("usergroups")&"&action="&request("action")&"&usergroupid="&request("usergroupid")&"&loginR="&request("loginR")&"&loginT="&request("loginT")&"&vanishR="&request("vanishR")&"&vanishT="&request("vanishT")&"&regR="&request("regR")&"&regT="&request("regT")&"&artcleR="&request("artcleR")&"&artcleT="&request("artcleT")&"&searchmax="&request("searchmax")&""">["&i&"]</a>"
		end if
	end if
	next
	if currentpage+3 < Pcount then 
	response.write "... <a href=""?page="&Pcount&"&userSearch="&request("userSearch")&"&username="&request("username")&"&useremail="&request("useremail")&"&homepage="&request("homepage")&"&oicq="&request("oicq")&"&icq="&request("icq")&"&msn="&request("msn")&"&title="&request("title")&"&sign="&request("sign")&"&userclass="&request("userclass")&"&usergroups="&request("usergroups")&"&action="&request("action")&"&usergroupid="&request("usergroupid")&"&loginR="&request("loginR")&"&loginT="&request("loginT")&"&vanishR="&request("vanishR")&"&vanishT="&request("vanishT")&"&regR="&request("regR")&"&regT="&request("regT")&"&artcleR="&request("artcleR")&"&artcleT="&request("artcleT")&"&searchmax="&request("searchmax")&""">["&Pcount&"]</a>"
'shinzeal特殊搜索分页代码加入完毕
	end if
%>
</td></tr>
</FORM>
<%
	end if
	rs.close
	set rs=nothing	
elseif request("action")="touser" then
	response.write "<tr><th colspan=8 height=23 align=left>执行结果</th></tr>"
	if request("useraction")="" then
		response.write "<tr><td colspan=8 class=forumrow>请指定相关参数。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		founderr=true
	end if
	if request("userid")="" then
		response.write "<tr><td colspan=8 class=forumrow>请选择相关用户。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		founderr=true
	end if
	if not founderr then
		if request("useraction")=1 then
			'------------------shinzeal加入删除用户的短信-------------------------
			dim uid
			for i=1 to request("userid").count
				if request("userid").count=1 then
				uID=request("userid")
				else
				uID=replace(request.form("userid")(i),"'","")
				end if
				set rs=Dvbbs.Execute("select username from [dv_User] where userid="&uid&"")
				if not (rs.eof and rs.bof) then
					'Dvbbs.Execute("update dv_message set delR=1 where incept='"&trim(rs(0))&"' and delR=0")
					'Dvbbs.Execute("update dv_message set delS=1 where sender='"&trim(rs(0))&"' and delS=0 and issend=0")
					'Dvbbs.Execute("update dv_message set delS=1 where sender='"&trim(rs(0))&"' and delS=0 and issend=1")
					'Dvbbs.Execute("delete from dv_message where incept='"&rs(0)&"' and delR=1") 
					'Dvbbs.Execute("update dv_message set delS=2 where sender='"&trim(rs(0))&"' and delS=1")
					'Dvbbs.Execute("delete from dv_friend where F_username='"&rs(0)&"'") 
					'Dvbbs.Execute("delete from dv_bookmark where username='"&rs(0)&"'") 
				end if 
				rs.close
			next
			'-------------------删除用户的短信------------------------
			'删除用户的帖子和精华
			'Dvbbs.Execute("delete from dv_topic where PostUserID in ("&replace(request("userid"),"'","")&")")
			for i=0 to ubound(allposttable)
				'Dvbbs.Execute("delete from "&allposttable(i)&" where PostUserID in ("&replace(request("userid"),"'","")&")")
			next
			'Dvbbs.Execute("delete from dv_besttopic where PostUserID in ("&replace(request("userid"),"'","")&")")
			'删除用户上传表
			'Dvbbs.Execute("delete from dv_upfile where F_UserID in ("&replace(request("userid"),"'","")&")")
			'Dvbbs.Execute("delete from [dv_user] where userid in ("&replace(request("userid"),"'","")&")")
			response.write "<tr><td colspan=8 class=forumrow>操作成功。</td></tr>"
		elseif request("useraction")=2 then
			dim userclass,usertitlepic
			set rs=Dvbbs.Execute("select * from dv_usergroups where usergroupid="&request("selusergroup")&" order by minarticle")
			if not (rs.eof and rs.bof) then
				userclass=rs("usertitle")
				usertitlepic=rs("grouppic")
			end if
			'Dvbbs.Execute("update [dv_user] set UserGroupID="&replace(request("selusergroup"),"'","")&",userclass='"&userclass&"',titlepic='"&usertitlepic&"' where userid in ("&replace(request("userid"),"'","")&")")
			response.write "<tr><td colspan=8 class=forumrow>操作成功。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		elseif request("useraction")=3 then
			dim titlenum
			if request("userid")="" then
				response.write "<tr><td colspan=8 class=forumrow>请输入被删除帖子用户名。</td></tr>"
			end if
			titlenum=0
			for i=0 to ubound(allposttable)
			set rs=Dvbbs.Execute("Select Count(announceID) from "&allposttable(i)&" where postuserid in ("&replace(request("userid"),"'","")&")") 
   			titlenum=titlenum+rs(0)
			sql="update "&allposttable(i)&" set locktopic=boardid,boardid=444,isbest=0 where postuserid in ("&replace(request("userid"),"'","")&")"
			'Dvbbs.Execute(sql)
			next
			'Dvbbs.Execute("delete from dv_besttopic where postuserid in ("&replace(request("userid"),"'","")&")")
			set rs=Dvbbs.Execute("select topicid,posttable from dv_topic where postuserid in ("&replace(request("userid"),"'","")&")")
			do while not rs.eof
			'Dvbbs.Execute("update "&rs(1)&" set locktopic=boardid,boardid=444,isbest=0 where rootid="&rs(0))
			rs.movenext
			loop
			set rs=nothing
			'Dvbbs.Execute("update dv_topic set locktopic=boardid,boardid=444,isbest=0 where postuserid in ("&replace(request("userid"),"'","")&")")
			if isnull(titlenum) then titlenum=0
			sql="update [dv_user] set UserPost=UserPost-"&titlenum&",userWealth=userWealth-"&titlenum*Dvbbs.Forum_user(3)&",userEP=userEP-"&titlenum*Dvbbs.Forum_user(8)&",userCP=userCP-"&titlenum*Dvbbs.Forum_user(13)&" where userid in ("&replace(request("userid"),"'","")&")"
			'Dvbbs.Execute(sql)
			response.write "<tr><td colspan=8 class=forumrow>删除成功，如果要完全删除帖子请到论坛回收站<BR>建议您到更新论坛数据中更新一下论坛数据，或者<a href=admin_alldel.asp>返回</a></td></tr>"
		else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		end if
	end if

elseif request("action")="modify" then
dim realname,character,personal,country,province,city,shengxiao,blood,belief,occupation,marital, education,college,userphone,iaddress
Dim UserIM
	response.write "<tr><th colspan=8 height=23 align=left>用户资料操作</th></tr>"
	if not isnumeric(request("userid")) then
		response.write "<tr><td colspan=8 class=forumrow>错误的用户参数。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		founderr=true
	end if
	if not founderr then
		Set rs= Server.CreateObject("ADODB.Recordset")
		sql="select * from [dv_user] where userid="&request("userid")
		rs.open sql,conn,1,1
		if rs.eof and rs.bof then
		response.write "<tr><td colspan=8 class=forumrow>没有找到相关用户。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		founderr=true
		else
if rs("userinfo")<>"" then
	userinfo=split(Server.HtmlEncode(rs("userinfo")),"|||")
	if ubound(userinfo)=14 then
		realname=userinfo(0)
		character=userinfo(1)
		personal=userinfo(2)
		country=userinfo(3)
		province=userinfo(4)
		city=userinfo(5)
		shengxiao=userinfo(6)
		blood=userinfo(7)
		belief=userinfo(8)
		occupation=userinfo(9)
		marital=userinfo(10)
		education=userinfo(11)
		college=userinfo(12)
		userphone=userinfo(13)
		iaddress=userinfo(14)
	else
		realname=""
		character=""
		personal=""
		country=""
		province=""
		city=""
		shengxiao=""
		blood=""
		belief=""
		occupation=""
		marital=""
		education=""
		college=""
		userphone=""
		iaddress=""
	end if
else
	realname=""
	character=""
	personal=""
	country=""
	province=""
	city=""
	shengxiao=""
	blood=""
	belief=""
	occupation=""
	marital=""
	education=""
	college=""
	userphone=""
	iaddress=""
end if
UserIM = Split(Rs("UserIM"),"|||")
%>
<FORM METHOD=POST ACTION="?action=saveuserinfo">
<tr>
<td width=100% class=forumrow valign=top colspan=4>对 <%=rs("username")%> 用户操作快捷选项：<BR><BR>
<a href="mailto:<%=rs("useremail")%>">发邮件</a> | <a href="messanger.asp?action=new&touser=<%=rs("username")%>" target=_blank>发短信</a> | <a href="dispuser.asp?id=<%=rs("userid")%>" target=_blank>预览用户资料</a> | <a href="Query.asp?stype=1&nSearch=3&keyword=<%=rs("username")%>&SearchDate=30" target=_blank>用户新贴</a> | <a href="Query.asp?stype=6&nSearch=0&pSearch=0&keyword=<%=rs("username")%>" target=_blank>用户精华</a> | <a href="Query.asp?stype=4&nSearch=0&pSearch=0&keyword=<%=rs("username")%>" target=_blank>用户热贴</a> | <a href="show.asp?username=admin" target=_blank>用户展区</a> |
</td>
</tr>
<tr><th colspan=8 height=23 align=left>用户基本资料修改－－<%=rs("username")%></th></tr>
<input name="userid" type=hidden value="<%=rs("userid")%>">


<!-- ######################################### -->
<tr>
<td width=20% class=forumrow>社区奖章</td>
<td width=80% class=forumrow colspan=3>
第一奖项：<select size=1 name="xzn1">
<%
dim xzrs,xzname,xzid,xzdata,numb,xz1,xz2,xz3,xz4,xz5
if rs("xzdata")<>"" then
xzdata=split(rs("xzdata"),"|||")
	select case ubound(xzdata)
 	case 0
 		xz1=xzdata(0)
 	case 1
 	    xz1=xzdata(0)
 	    xz2=xzdata(1)
 	case 2
 		xz1=xzdata(0)
 	    xz2=xzdata(1)
 	    xz3=xzdata(2)
 	case 3
 		xz1=xzdata(0)
 	    xz2=xzdata(1)
 	    xz3=xzdata(2)
 	    xz4=xzdata(3)
 	case 4
 		xz1=xzdata(0)
 	    xz2=xzdata(1)
 	    xz3=xzdata(2)
 	    xz4=xzdata(3)
 	    xz5=xzdata(4)
	end select
end if
%>

<%

'set rs=Dvbbs.Execute("select usergroupid,title from dv_usergroups where ParentGID=0 order by usergroupid")


set xzrs=Dvbbs.execute("select xzname,xzid from xzdata")
response.write "<option value=0>没有勋章</option>"
do while not xzrs.eof
xzname=xzrs("xzname")
response.write "<option value="&xzrs("xzid")
if xzrs("xzid")=cint(xz1) then response.write " selected "
response.write ">"&xzname&"</option>"
xzrs.movenext
loop
xzrs.close
set xzrs=nothing
%>
</select>←如果这里已经有奖请在下面颁发</td>
</tr>
<tr>
<td width=20% class=forumrow rowspan="4">　</td>
<td width=80% class=forumrow colspan=3>
第二奖项：<select size=1 name="xzn2">
<%
set xzrs=Dvbbs.execute("select xzname,xzid from xzdata")
response.write "<option value=0>没有勋章</option>"
do while not xzrs.eof
xzname=xzrs("xzname")
response.write "<option value="&xzrs("xzid")
if xzrs("xzid")=cint(xz2) then response.write " selected "
response.write ">"&xzname&"</option>"
xzrs.movenext
loop
xzrs.close
set xzrs=nothing
%>
</select>←如果这里已经有奖请在下面颁发</td>
</tr>
<tr>
<td width=80% class=forumrow colspan=3>
第三奖项：<select size=1 name="xzn3">
<%
set xzrs=Dvbbs.execute("select xzname,xzid from xzdata")
response.write "<option value=0>没有勋章</option>"
do while not xzrs.eof
xzname=xzrs("xzname")
response.write "<option value="&xzrs("xzid")
if xzrs("xzid")=cint(xz3) then response.write " selected "
response.write ">"&xzname&"</option>"
xzrs.movenext
loop
xzrs.close
set xzrs=nothing
%>
</select>←如果这里已经有奖请在下面颁发</td>
</tr>
<tr>
<td width=80% class=forumrow colspan=3>
第四奖项：<select size=1 name="xzn4">
<%
set xzrs=Dvbbs.execute("select xzname,xzid from xzdata")
response.write "<option value=0>没有勋章</option>"
do while not xzrs.eof
xzname=xzrs("xzname")
response.write "<option value="&xzrs("xzid")
if xzrs("xzid")=cint(xz4) then response.write " selected "
response.write ">"&xzname&"</option>"
xzrs.movenext
loop
xzrs.close
set xzrs=nothing
%>
</select>←如果这里已经有奖请在下面颁发</td>
</tr>
<tr>
<td width=80% class=forumrow colspan=3>
第五奖项：<select size=1 name="xzn5">
<%
set xzrs=Dvbbs.execute("select xzname,xzid from xzdata")
response.write "<option value=0>没有勋章</option>"
do while not xzrs.eof
xzname=xzrs("xzname")
response.write "<option value="&xzrs("xzid")
if xzrs("xzid")=cint(xz5) then response.write " selected "
response.write ">"&xzname&"</option>"
xzrs.movenext
loop
xzrs.close
set xzrs=nothing
%>
</select>←如果这里已经有奖请在上面找空位颁发</td>
</tr>

<tr>
<th width=80% class=forumrow colspan=8>

你给<%=rs("username")%><select size=1 name="pos">
<option value="颁发">颁发</option>
<option value="摘除">摘除</option>
</select>
了一枚<select size=1 name="xzwhy">

<%
set xzrs=Dvbbs.execute("select xzname,xzid from xzdata")
response.write "<option value=0>请选择勋章</option>"
do while not xzrs.eof
xzname=xzrs("xzname")
response.write "<option value="&xzrs("xzid")
response.write ">"&xzname&"</option>"
xzrs.movenext
loop
xzrs.close
set xzrs=nothing
%>
</select>
勋章，执行理由是：<input type="text" name="upwhy" size=50>
</th>

</tr>





<tr>
<td width=100% class=forumrow align=center colspan=8><input name="submit" type=submit value="   更  新   "></td>
</tr>
</FORM>
<%
		end if
		rs.close
		set rs=nothing
	end if
elseif request("action")="saveuserinfo" then
	response.write "<tr><th colspan=8 height=23 align=left>更新用户资料</th></tr>"
	dim myuserim
	if not isnumeric(request("userid")) then
		response.write "<tr><td colspan=8 class=forumrow>错误的用户参数。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		founderr=true
	end if
		dim xzxg
	xzxg=request.form("xzn1")& "|||" &request.form("xzn2")& "|||" &request.form("xzn3")& "|||" &request.form("xzn4")& "|||" &request.form("xzn5")

	if not founderr then
	Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select * from [dv_user] where userid="&request("userid")
	rs.open sql,conn,1,3
	if rs.eof and rs.bof then
		response.write "<tr><td colspan=8 class=forumrow>没有找到相关用户。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
		founderr=true
	else

		rs("xzdata")=xzxg

		rs.update
	end if
	
	
	if Request.Form("upwhy")="" then
		response.write "<tr><td colspan=8 class=forumrow><font color=red>请填写执行原因！</font>&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"

	elseif Request.Form("xzwhy")=0 then
			response.write "<tr><td colspan=8 class=forumrow><font color=red>请选择颁发的勋章名称！</font>&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
else
	dvbbs.execute "insert into xz_log values(" & SqlNowString &",'"& rs("username") &"','"& Dvbbs.membername & "','"&(Request.Form("xzwhy"))&"','"&(Request.Form("pos"))&"','"&(Request.Form("upwhy"))&"')"
if founderr then
		response.write "<tr><td colspan=8 class=forumrow>更新失败。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
	else
		response.write "<tr><td colspan=8 class=forumrow>更新用户数据成功。&nbsp;&nbsp;&nbsp;<a href=z_xzup_admin.asp>返回管理页面</a></td></tr>"
	end if
end if
	
	rs.close
	set rs=nothing
	end if
	
	

	
	
end if
'end if
'end if

%>
<tr><td colspan=5 class=forumrow>
<%
%>
</td></tr>
<%

function checkreal(v)
	dim w
	if not isnull(v) then
	w=replace(v,"|||","§§§")
	checkreal=w
	end if
end function

%>
</table>
<p></p>
<script language="JavaScript">
<!--
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
//-->
</script>
<%' footer()
END IF%>



