<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<!--#include file=../md5.asp-->
<%Head()
	dim admin_flag,GroupID,action
	admin_flag=",11,"
	if not master or instr(","&session("flag")&",",admin_flag)=0 then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=../"&LoginUrl&" target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
		call Ms_error()
	End If
	Main(1)
	Select Case Request("action")
	Case "fix"
		Fixuser()
	Case "userSearch"
		UserSearch()
	Case "touser"
		ToUser()
	Case "modify"
		UserModify()
	Case "saveuserinfo"
		SaveUserInfo()
	Case Else
		UserIndex()
	End Select
	Main(0)
	Footer()

sub main(Str)
If Str = 1 Then%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr> 
    <th height="23" colspan=8 class="tableHeaderText">用户管理</th>
  </tr>
  <tr> 
    <td width="17%" height="46" class=forumrowHighlight>注意事项 </td>
    <td width="83%" height="46" class=forumrowHighlight colspan=7><li>①点删除按钮将删除所选定的用户，此操作是不可逆的；<li>②您可以批量移动用户到相应的组；<li>③点用户名进行相应的资料操作；<li>④点用户最后登陆IP可进行锁定IP操作；<li>⑤点用户Email将给该用户发送Email
      <li>⑥点修复将会修复该用户所发的文章数据并更新其文章数。</td>
  </tr>
  <tr> 
    <td height="29" colspan=8 class=forumrowHighlight> 快速查看：<a href="admin_user.asp">管理首页</a> 
      | <a href="?action=userSearch&userSearch=1">所有用户</a> | <a href="?action=userSearch&userSearch=2">文章TOP100</a> 
      | <a href="?action=userSearch&userSearch=3">日记TOP100</a> | <a href="?action=userSearch&userSearch=4">24H内登录</a> 
      | <a href="?action=userSearch&userSearch=5">24H内注册</a> | <a href="?action=userSearch&userSearch=5"></a><a href="?action=userSearch&userSearch=6">等待验证</a> 
      | <a href="?action=userSearch&userSearch=7">邮件验证</a> <BR>
      　　　　　<a href="?action=userSearch&userSearch=8">管理团队</a> | <a href="?action=userSearch&userSearch=11">屏蔽用户</a> 
      | <a href="?action=userSearch&userSearch=12">锁定　用户</a> | <a href="?action=userSearch&userSearch=15">贵宾VIP用户</a>| 
      <a href="?action=userSearch&userSearch=13">未审核VIP</a> | <a href="?action=userSearch&userSearch=14">到期VIP</a> | <a href="?action=userSearch&userSearch=16">上传图片</a> | <a href="?action=userSearch&userSearch=17">首页之星</a></td>
  </tr>
  <tr> 
    <td height="25" colspan=8 class=forumrowHighlight></td>
  </tr>
<%
	Else
%>
</table>
<p></p>
<%
	End If
End Sub

'用户管理首页，搜索项
Sub UserIndex()
%>
<form action="?action=userSearch" method=post>
<tr>
<th align=left colspan=7 height=23>高级查询</th>
</tr>
<tr>
<td width=20% class=forumrow>注意事项</td>
<td width=80% class=forumrow colspan=5>在记录很多的情况下搜索条件越多查询越慢，请尽量减少查询条件；最多显示记录数也不宜选择过大</td>
</tr>
<tr>
<td width=20% class=forumrow>用户名</td>
<input type=hidden name="userSearch" value="9"> 
<td width=80% class=forumrow colspan=5><input size=45 name="username" type=text>&nbsp;<input type=checkbox name="like" value="1" checked>
      完整匹配</td>
</tr>
<tr>
<td width=20% class=forumrow>最多记录数</td>
<td width=80% class=forumrow colspan=5><input size=10 name="searchMax" type=text value=100></td>
</tr>
<tr>
<td width=20% class=forumrow>用户组</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name="usergroups">
<option value=0>任意</option>
<%
set rs=Conn.Execute("select usergroupid,UserTitle,ParentGID from Ms_usergroups Where Not ParentGID=0 order by ParentGID,usergroupid")
do while not rs.eof
response.write "<option value="&rs(0)&">"&SysGroupName(Rs(2)) & rs(1)&"</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 colspan=5><input size=45 name="userEmail" type=text></td>
</tr>
<tr>
<td width=20% class=forumrow>登录IP包含</td>
<td width=80% class=forumrow colspan=5><input size=45 name="lastip" type=text></td>
</tr>
<tr>
    <td width=20% class=forumrow>
    </td>
  </tr>
  <tr>
<th align=left colspan=7 height=23>特殊查询&nbsp;（注意： <多于> 或 <少于> 已默认包含 <等于>；条件留空则不使用此条件 ）</th>
</tr>
<tr>
    <td class=forumrow colspan=7> <table id="Table1" width="100%" >
        <tr> 
          <td width=50% class=forumrowHighlight>登录次数: 
            <input type=radio value=more name="loginR" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="loginR"> &nbsp;少于&nbsp;&nbsp; <input size=5 name="loginT" type=text>
            次</td>
          <td width=50% class=forumrowHighlight>撰写日记: 
            <input type=radio value=more name="diaryR" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="diaryR"> &nbsp;少于&nbsp;&nbsp; 
            <input size=5 name="diaryT" type=text>
            篇</td>
        </tr>
        <tr> 
          <td>注册天数: 
            <input type=radio value=more name="regR" checked> &nbsp;多于&nbsp; <input type=radio value=less name="regR"> 
            &nbsp;少于&nbsp;&nbsp; <input size=5 name="regT" type=text>
            天</td>
          <td>发表文章: 
            <input type=radio value=more name="artcleR" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="artcleR"> &nbsp;少于&nbsp;&nbsp; 
            <input size=5 name="artcleT" type=text>
            篇</td>
        </tr>
        <tr> 
          <td class=forumrowHighlight>用户金钱: 
            <input type=radio value=more name="UWealth" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="UWealth"> &nbsp;少于&nbsp;&nbsp; 
            <input size=5 name="UWealth_value" type=text></td>
          <td class=forumrowHighlight>用户经验: 
            <input type=radio value=more name="UEP" checked> &nbsp;多于&nbsp; <input type=radio value=less name="UEP"> 
            &nbsp;少于&nbsp;&nbsp; <input size=5 name="UEP_value" type=text></td>
        </tr>
        <tr> 
          <td height="21">用户魅力: 
            <input type=radio value=more name="UCP" checked> &nbsp;多于&nbsp; <input type=radio value=less name="UCP"> 
            &nbsp;少于&nbsp;&nbsp; <input size=5 name="UCP_value" type=text></td>
          <td>用户威望: 
            <input type=radio value=more name="UPower" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="UPower"> &nbsp;少于&nbsp;&nbsp; <input size=5 name="UPower_value" type=text></td>
        </tr>
        <tr> 
          <td class=forumrow><li>以下条件请选取相应的VIP用户组进行查询</li></td>
        </tr>
        <tr> 
          <td class=forumrowHighlight>登记时间: 
            <input type=radio value=more name="UVipStarTime" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="UVipStarTime"> &nbsp;少于&nbsp;&nbsp; 
            <input size=5 name="UVipStarTime_value" type=text></td>
          <td class=forumrowHighlight>截止时间: 
            <input type=radio value=more name="UVipEndTime" checked> &nbsp;多于&nbsp; 
            <input type=radio value=less name="UVipEndTime"> &nbsp;少于&nbsp;&nbsp; 
            <input size=5 name="UVipEndTime_value" type=text></td>
        </tr>
      </table></td>
  </tr>
<tr>
<td width=100% class=forumrow align=center colspan=7><input name="submit" type=submit value="   搜  索   "></td>
</tr>
</form>
<%
End Sub

'用户搜索结果项
Sub UserSearch()
dim sqlstr
strFileName="admin_user.asp?userSearch=" & Request("userSearch") & "&action="&Request("action") & "&username=" & Request("username") & "&like=" & Request("like") & "&useremail=" & Request("useremail") & "&usergroups=" & Request("usergroups") & "&usergroupid=" & Request("usergroupid") & "&loginR=" & Request("loginR") & "&loginT=" & Request("loginT") & "&diaryR=" & Request("diaryR") & "&diaryT=" & Request("diaryT") & "&regR=" & Request("regR") & "&regT=" & Request("regT") & "&artcleR=" & Request("artcleR") & "&artcleT=" & Request("artcleT") & "&searchmax=" & Request("searchmax") & "&UVipStarTime=" & Request("UVipStarTime") & "&UVipStarTime_value=" & Request("UVipStarTime_value") & "&UVipEndTime=" & Request("UVipEndTime") & "&UVipEndTime_value=" & Request("UVipEndTime_value")&""
call tumppages()
dim sqlt
sqlt = " Userid,Username,Useremail,LastLogin,UserLastIP,UserGroupID,Vip_StarTime,Vip_EndTime,Uservip "
%>
<tr>
<th colspan=8 align=left height=23>搜索结果</th>
</tr>
<FORM METHOD=POST ACTION="?action=touser">
<tr align=center height=23>
<td class=forumRowHighlight width="10%"><B>用户名</B></td>
<td class=forumRowHighlight width="12%"><B>Email</B></td>
<td class=forumRowHighlight width="7%"><B>VIP</B></td>
<td class=forumRowHighlight width="7%"><B>修复</B></td>
<td class=forumRowHighlight width="15%"><B>最后IP</B></td>
<td class=forumRowHighlight width="17%"><B>最后登录</B></td>
<td class=forumRowHighlight width="20%"><B>登记/终止日期</B></td>
<td class=forumRowHighlight><B>操作</B></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
Select Case Request("UserSearch")
	Case 1
		Sql = "SELECT " & sqlt & " from Ms_user ORDER BY UserID DESC"
	Case 2
		Sql = "SELECT TOP 100 " & sqlt & " from Ms_user ORDER BY Userart DESC"
	case 3
		sql="select top 100 " & sqlt & " from Ms_user  order by Userdiary desc"
	case 4
		If IsSqlDataBase=1 Then
		sql="select " & sqlt & " from Ms_user where datediff(hour,LastLogin,"&SqlNowString&")<25 order by lastlogin desc"
		else
		sql="select " & sqlt & " from Ms_user where datediff('h',LastLogin,"&SqlNowString&")<25 order by lastlogin desc"
		end if
	case 5
		If IsSqlDataBase=1 Then
		sql="select " & sqlt & " from Ms_user where datediff(hour,JoinDate,"&SqlNowString&")<25 order by UserID desc"
		else
		sql="select " & sqlt & " from Ms_user  where datediff('h',JoinDate,"&SqlNowString&")<25 order by UserID desc"
		end if
	case 6
		sql="select " & sqlt & " from Ms_user  where usergroupid=5 order by UserID desc"
	case 7
		sql="select " & sqlt & " from Ms_user  where usergroupid=6 order by UserID desc"
	case 8
		sql="select " & sqlt & " from Ms_user  where usergroupid<4 order by usergroupid"
	case 10
		Sql = "select " & sqlt & " from Ms_user  where usergroupid="&request("usergroupid")&" order by UserID desc"
	case 11
		sql="select " & sqlt & " from Ms_user  where lockuser=2 order by userid desc"
	case 12
		sql="select " & sqlt & " from Ms_user  where lockuser=1 order by userid desc"
	case 13''申请VIP会员
		sql="select " & sqlt & " from Ms_user  where UserVip=1 order by userid desc"
	case 14''到期VIP会员
		If IsSqlDataBase=1 Then
		sql="select " & sqlt & " from Ms_user where datediff(hour,Vip_EndTime,"&SqlNowString&")>=25 order by UserID desc"
		else
		sql="select " & sqlt & " from Ms_user  where datediff('h',Vip_EndTime,"&SqlNowString&")>=25 order by UserID desc"
		end if
	case 15''VIP会员
		sql="select " & sqlt & " from Ms_user  where Uservip>1 order by userid desc"
	case 16''有上传
		sql="select " & sqlt & " from Ms_user  where UserPhoto<>null order by userid desc"
	case 17''首页之星 
		sql="select " & sqlt & " from Ms_user  where Istop=1 order by Topdate desc"			
	case 9''搜索表单
	sqlstr=""''----------以下为搜索开始
		if request("username")<>"" then
			if request("like")=1 then
			sqlstr=" username='"&request("username")&"'"
			else
			sqlstr=" username like '%"&request("username")&"%'"
			end if
		end if
		if cint(request("usergroups"))>0 then
			if sqlstr="" then
			sqlstr=" usergroupid="&request("usergroups")&""
			else
			sqlstr=sqlstr & " and usergroupid="&Cint(request("usergroups"))
			end if
		end if
		if request("useremail")<>"" then
			if sqlstr="" then
			sqlstr=" useremail like '%"&request("useremail")&"%'"
			else
			sqlstr=sqlstr & " and useremail like '%"&request("useremail")&"%'"
			end if
		end if
		if request("lastip")<>"" then
			if sqlstr="" then
			sqlstr=" UserLastIP like '%"&request("lastip")&"%'"
			else
			sqlstr=sqlstr & " and UserLastIP like '%"&request("lastip")&"%'"
			end if
		end if
		dim Tsqlstr
		if request("loginT")<>"" then
		   	if request("loginR")="more" then
			 Tsqlstr=" userlogins >= "&CheckNumeric(request("loginT"))
			else
			 Tsqlstr=" userlogins <= "&CheckNumeric(request("loginT"))
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if 
		end if
		if request("diaryT")<>"" then
		   	if request("diaryR")="more" then
			 Tsqlstr=" Userdiary >= "&CheckNumeric(request("diaryT"))
			else
			 Tsqlstr=" Userdiary <= "&CheckNumeric(request("diaryT"))
			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,JoinDate,"&SqlNowString&") >= "&CheckNumeric(request("regT"))
				Else
					Tsqlstr=" datediff('d',JoinDate,"&SqlNowString&") >= "&CheckNumeric(request("regT"))
				End If
			else
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,JoinDate,"&SqlNowString&") <= "&CheckNumeric(request("regT"))
				Else
					Tsqlstr=" datediff('d',JoinDate,"&SqlNowString&") <= "&CheckNumeric(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=" Userart >= "&CheckNumeric(request("artcleT"))
			else
			 Tsqlstr=" Userart <= "&CheckNumeric(request("artcleT"))
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if 
		end if
		if request("UWealth_value")<>"" then
			if request("UWealth")="more" then
				Tsqlstr=" userWealth >= "&CheckNumeric(Request("UWealth_value"))
			else
				Tsqlstr=" userWealth <= "&CheckNumeric(Request("UWealth_value"))
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if
		end if
		if request("UEP_value")<>"" then
			if request("UEP")="more" then
				Tsqlstr=" userEP >= "&CheckNumeric(Request("UEP_value"))
			else
				Tsqlstr=" userEP <= "&CheckNumeric(Request("UEP_value"))
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if
		end if
		if request("UCP_value")<>"" then
			if request("UCP")="more" then
				Tsqlstr=" userCP >= "&CheckNumeric(Request("UCP_value"))
			else
				Tsqlstr=" userCP <= "&CheckNumeric(Request("UCP_value"))
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if
		end if

		if request("UPower_value")<>"" then
			if request("UPower")="more" then
				Tsqlstr=" UserPower >= "&CheckNumeric(Request("UPower_value"))
			else
				Tsqlstr=" UserPower <= "&CheckNumeric(Request("UPower_value"))
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if
		end if
		if request("UVipStarTime_value")<>"" then
		   	if request("UVipStarTime")="more" then
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,Vip_StarTime,"&SqlNowString&") >= "&CheckNumeric(request("UVipStarTime_value"))
				Else
					Tsqlstr=" datediff('d',Vip_StarTime,"&SqlNowString&") >= "&CheckNumeric(request("UVipStarTime_value"))
				End If
			else
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,Vip_StarTime,"&SqlNowString&") <= "&CheckNumeric(request("UVipStarTime_value"))
				Else
					Tsqlstr=" datediff('d',Vip_StarTime,"&SqlNowString&") <= "&CheckNumeric(request("UVipStarTime_value"))
				End If
			end if 	
			if sqlstr="" then 
			  sqlstr=Tsqlstr
			else
			  sqlstr=sqlstr & " and " & Tsqlstr
			end if 
		end if
		if request("UVipEndTime_value")<>"" then
		   	if request("UVipEndTime")="more" then
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,Vip_EndTime,"&SqlNowString&") >= "&CheckNumeric(request("UVipEndTime_value"))
				Else
					Tsqlstr=" datediff('d',Vip_EndTime,"&SqlNowString&") >= "&CheckNumeric(request("UVipEndTime_value"))
				End If
			else
				If IsSqlDataBase=1 Then
					Tsqlstr=" datediff(d,Vip_EndTime,"&SqlNowString&") <= "&CheckNumeric(request("UVipEndTime_value"))
				Else
					Tsqlstr=" datediff('d',Vip_EndTime,"&SqlNowString&") <= "&CheckNumeric(request("UVipEndTime_value"))
				End If
			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>请指定搜索参数！</td></tr>"
			Response.End
		End If
		If Request("Searchmax") = "" Or Not Isnumeric(Request("Searchmax")) Then
			Sql = "SELECT TOP 1 "& sqlt &" FROM [Ms_User] WHERE " & Sqlstr & " ORDER BY UserID DESC"
		Else
			Sql = "SELECT TOP " & Request("Searchmax") & sqlt &" FROM [Ms_User] WHERE " & Sqlstr & " ORDER BY UserID DESC"
		End If		
	case else
		Response.Write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
		Response.End
	End Select
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)%>
<tr>
<td class=forumrow><a href="?action=modify&username=<%=rs("username")%>"><%=rs("username")%></a></td>
<td class=forumrow><a href="sendemail.asp?username=<%=rs("username")%>"><%=rs("useremail")%></a></td>
<td class=forumrow align=center><%if rs("Uservip")>1 then
response.write("<font color=red>是</font>")
elseif rs("Uservip")=1 then
response.Write("<font color=blue>申</font>")
elseif rs("Uservip")=0 then
response.Write("否")
end if%></td>
<td class=forumrow align=center><a href="?action=fix&username=<%=rs("username")%>">修复</a></td>
<td class=forumrow><a href="../admin_lockIP.asp?userip=<%=rs("UserLastIP")%>" title="点击锁定该用户IP" target=_blank><%=rs("userlastip")%></a></td>
<td class=forumrow ><%if rs("lastlogin")<>"" and isdate(rs("lastlogin")) then%><%=rs("lastlogin")%><%end if%></td>
<td class=forumrow align=center>
<%=rs("Vip_StarTime")%>/
<%=rs("Vip_EndTime")%>
</td>
<td class=forumrow align=center><input type="checkbox" name="userid" value="<%=rs("userid")%>" <%if rs("userGroupid")=1 then response.write "disabled"%>></td>
</tr>
<%page_count=page_count+1
  rs.movenext
  loop
  end if
  
  if totalrec>0 then%>
    <tr align="center"> 
      <td height="24" colspan="8" class=forumrow> <%
		  	call showpage(strFileName)
		  %></td>
    </tr>
<%end if%>
	<tr align="center"> 
      <td height="24" colspan="8" class=forumrow><input type="radio" name="useraction" value=1>删除用户
	  <input type="radio" name="useraction" value=2>
      用户操作
      <select name="lockset">
	  <option value=2>屏蔽</option>
	  <option value=1>锁定</option>
	  <option value=0>正常</option>
      </select>
	  <input type="radio" name="useraction" value=3>首页之星
	  <select name="Pset">
	  <option value=1>推荐</option>
	  <option value=0>撤消</option>
      </select>
	 <input type="radio" name="useraction" value=5 checked> 移动到用户组
<select size=1 name="selusergroup">
<%dim trs
set trs=Conn.Execute("select usergroupid,UserTitle,ParentGID from Ms_usergroups where not (usergroupid=1 or usergroupid=7) and (Not ParentGID=0) order by ParentGID,usergroupid")
do while not trs.eof
response.write "<option value="&trs(0)&">"&SysGroupName(tRs(2))&trs(1)&"</option>"
trs.movenext
loop
trs.close
set trs=nothing
%>
</select>全部选定<input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)"></td>
    </tr>
	<tr align="center"> 
      <td height="24" colspan="8" class=forumRowHighlight><input type=submit name=submit value="执行选定的操作"  onclick="{if(confirm('确定执行选择的操作吗?')){return true;}return false;}"></td>
    </tr>
	</form>
<%end sub

sub ToUser()''执行选定操作
dim delid,fixid,Maxnum
response.write "<tr><th colspan=8 height=23 align=left>执行结果</th></tr>"
	if request("useraction")="" then
		response.write "<tr><td colspan=8 class=forumrow>请指定相关参数。</td></tr>"
		founderr=true
	end if
	delid=replace(request.form("userid"),"'","")
	delid=replace(delid,";","")
	delid=replace(delid,"--","")
	delid=replace(delid,")","")
	fixid=replace(delid,",","")
	fixid=Trim(replace(fixid," ",""))
	Maxnum=split(delid,",")
	Maxnum=ubound(Maxnum)
	If Not IsNumeric(fixid) Then
		response.write "<tr><td colspan=8 class=forumrow>请选择相关用户。</td></tr>"
		founderr=true
	End If
	if not founderr then
		if request("useraction")=5 then''移动操作
			dim userclass,usertitlepic
			set rs=Conn.Execute("select * from Ms_usergroups where usergroupid="&request("selusergroup")&" order by minarticle")
			if not (rs.eof and rs.bof) then
				userclass=rs("usertitle")
				usertitlepic=rs("grouppic")
			end if
			Conn.Execute("update [Ms_user] set UserGroupID="&replace(request("selusergroup"),"'","")&",userclass='"&userclass&"',titlepic='"&usertitlepic&"' where userid in ("&delid&")")
			Conn.Execute("update [Ms_usergroups] set Useradd=Useradd+"&(Maxnum-1)&" where UserGroupID="&replace(request("selusergroup"),"'","")&"")
			response.write "<tr><td colspan=8 class=forumrow>操作成功。</td></tr>"
		elseif request("useraction")=2 then''锁定操作
			if request("lockset")<>"" then
		Conn.Execute("update Ms_user set Lockuser="&Cint(request("lockset"))&" where  userid in ("&delid&")")
			response.write "<tr><td colspan=8 class=forumrow>操作成功。</td></tr>"
			else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
			end if
		elseif request("useraction")=3 then''首页之星
			if request("Pset")<>"" then
					Conn.Execute("update Ms_user set IsTop="&Cint(request("Pset"))&" where userid in ("&delid&")")
					response.write "<tr><td colspan=8 class=forumrow>操作成功。</td></tr>"
			else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
			end if
		elseif request("useraction")=1 then''删除操作
				dim delids
				delids=split(delid,",")
				Conn.Execute("delete from Ms_user where userid in ("&delid&")")
				Conn.Execute("update Ms_setup set UserNum=UserNum-"&Cint(ubound(delids)-1)&" where Cid=1")
				response.write "<tr><td colspan=8 class=forumrow>删除用户操作成功。</td></tr>"
		else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
		end if
	end if
End Sub

'修改用户资料表单
Sub UserModify()
	dim Stockmoney,bankmoney,userinfo
	dim realname,character,personal,country,province,city,shengxiao,Userstars
	dim UserIM
	dim homepage,Oicq,Icq,Msn,Aim,Yahoo,Uc
	dim Userfriendinfo,Pheight,Pweight,figure,TemplateId
	dim Ublood,UFolk,Ubelief,Uoccupation,Udutytype,Umarital,Ueducation,Ucollege
	dim Uuserphone,Uaddress
	dim Uhealth,Uweight,Ufigure,Umylook,Ufug,Uincome,Ualcohol,Uhouses,Ulanguage
	dim Uphototitle,Uimages,UWealth,Uvip,Uep,Ucp,Upower,Udiarynum
	dim Upics,Uhits,ULastlogin,Uclass,Usex,Ubirth,Umail,Ulock,Loginnum
	dim username
	dim userclass
	Username=trim(request("username"))
	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>错误的用户参数。</td></tr>"
		founderr=true
	end if
	if not founderr then
		Set rs= Server.CreateObject("ADODB.Recordset")
		sql="select * from [Ms_user] where username='"&Username&"'"
		rs.open sql,conn,1,1
		if rs.eof and rs.bof then
		response.write "<tr><td colspan=8 class=forumrow>没有找到相关用户。</td></tr>"
		founderr=true
		else
		userclass=rs("userclass")
		UserIM=rs("UserIM")
		Pheight=rs("Userheight")
		TemplateId=rs("TemplateId")
		UserIM=split(UserIM,"|||")
		homepage=UserIM(0)
		Oicq=UserIM(1)
		Icq=UserIM(2)
		Msn=UserIM(3)
		Aim=UserIM(4)
		Yahoo=UserIM(5)
		Uc=UserIM(6)
		userinfo=rs("UserInfo")
		userinfo=split(userinfo,"|||")
		realname=userinfo(0)
		character=userinfo(1)
		personal=userinfo(2)
		country=userinfo(3)
		province=userinfo(4)
		city=userinfo(5)
		shengxiao=userinfo(6)
		Userstars=userinfo(7)
		Ublood=userinfo(8)
		UFolk=userinfo(9)
		Ubelief=userinfo(10)
		Uoccupation=userinfo(11)
		Udutytype=userinfo(12)
		Umarital=userinfo(13)
		Ueducation=userinfo(14)
		Ucollege=userinfo(15)
		Uuserphone=userinfo(16)
		Uaddress=userinfo(17)
		Userfriendinfo=split(rs("Userfriends"),"|||")
		Uhealth=Userfriendinfo(0)
		Uweight=Userfriendinfo(1)
		Ufigure=Userfriendinfo(2)
		Umylook=Userfriendinfo(3)
		Ufug=Userfriendinfo(4)
		Uincome=Userfriendinfo(5)
		Ualcohol=Userfriendinfo(6)
		Uhouses=Userfriendinfo(7)
		Ulanguage=Userfriendinfo(8)
		Stockmoney=0
		bankmoney=0
	if TemplateId="" then
		TemplateId=1
	end if
%>

<FORM METHOD=POST ACTION="?action=saveuserinfo">
<tr><th colspan=6 height=23 align=left>用户基本资料修改－－<%=Username%></th></tr>
<tr><td class=forumrow height=23 align=left colspan=6>
注意：新建管理员建议到管理员管理中进行，仅在此设置为管理员组的用户并无进入系统后台权限
</td></tr>
<tr>
<td width=20% class=forumrow>用户组</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name="usergroups">
<%dim Trs
set trs=Conn.Execute("select usergroupid,UserTitle,parentgid from Ms_usergroups where Not ParentGID=0 order by ParentGID,usergroupid")
do while not trs.eof
response.write "<option value="&trs(0)
if rs("usergroupid")=trs(0) then response.write " selected "
response.write ">"&SysGroupName(tRs(2)) & trs(1)
'if trs(2)>0 then response.write "(自定义等级)"
response.write "</option>"
trs.movenext
loop
trs.close
set trs=nothing
%>
</select>
</td>
</tr>
<input name="userid" type=hidden value="<%=rs("userid")%>">
<tr>
<td width=20% class=forumrow>用户名</td>
<td width=80% class=forumrow colspan=5><input size=45 name="username" type=text value="<%=Server.HtmlEncode(Username)%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>密  码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="password" type=text>
      &nbsp;<font color="#FF0000">如果不修改请留空</font></td>
</tr>
<tr>
<td width=20% class=forumrow>密码问题</td>
<td width=80% class=forumrow colspan=5><input size=45 name="quesion" type=text value="<%If Trim(rs("userquesion"))<>"" Then Response.Write Server.HtmlEncode(rs("userquesion"))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>密码答案</td>
<td width=80% class=forumrow colspan=5><input size=45 name="answer" type=text>&nbsp;如果不修改请留空</td>
</tr><tr>
<td width=20% class=forumrow>用户性别</td>
<td width=80% class=forumrow colspan=5>
女 <input type="radio" value="0" <%if rs("UserSex")=0 then%>checked<%end if%> name="sex">&nbsp;
男 <input type="radio" value="1" <%if rs("UserSex")=1 then%>checked<%end if%> name="sex">&nbsp;
</td>
</tr>
<tr>
<td width=20% class=forumrow>Email</td>
<td width=80% class=forumrow colspan=5><input size=45 name="userEmail" type=text value="<%If Trim(rs("useremail"))<>"" Then Response.Write Server.HtmlEncode(rs("useremail"))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>个人主页</td>
<td width=80% class=forumrow colspan=5><input size=45 name="homepage" type=text value="<%=Server.HtmlEncode(UserIM(0))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>头像</td>
<td width=80% class=forumrow colspan=5><input size=45 name="face" type=text value="<%=rs("userface")%>">&nbsp;宽度：<input size=3 name="width" type=text value="<%=split(rs("faceinfo"),"|||")(0)%>">&nbsp;高度：<input size=3 name="height" type=text value="<%=split(rs("faceinfo"),"|||")(1)%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>OICQ号码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="oicq" type=text value="<%=Server.HtmlEncode(UserIM(1))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>ICQ号码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="icq" type=text value="<%=Server.HtmlEncode(UserIM(2))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>MSN号码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="msn" type=text value="<%=Server.HtmlEncode(UserIM(3))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>AIM号码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="aim" type=text value="<%=Server.HtmlEncode(UserIM(4))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>YaHoo号码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="yahoo" type=text value="<%=Server.HtmlEncode(UserIM(5))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>UC号码</td>
<td width=80% class=forumrow colspan=5><input size=45 name="uc" type=text value="<%=Server.HtmlEncode(UserIM(6))%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>个性模板</td>
<td width=80% class=forumrow colspan=5>
<select name="Templateid">
<%dim sqlte,rste
sqlte="select Tempname,id from [Ms_Template] order by id"
		set rste=conn.execute(Sqlte)
		if not (rste.eof and rste.bof) then
		do while not rste.eof%>
<option value="<%=rste(1)%>" <%if rste(1)=TemplateId then%>selected<%end if%>><%=rste(0)%></option>
<%rste.movenext
loop
rste.close
end if%>
</select></td>
</tr>
<tr><th colspan=6 height=23 align=left>用户分值资料修改</th></tr>
<tr>
<td width=20% class=forumrow>发表文章</td>
<td width=80% class=forumrow colspan=5><input size=45 name="article" type=text value="<%=rs("Userart")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>日记总数</td>
<td width=80% class=forumrow colspan=5><input size=45 name="Userdiary" type=text value="<%=rs("Userdiary")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>相册总数</td>
<td width=80% class=forumrow colspan=5><input size=45 name="UserPics" type=text value="<%=rs("UserPics")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>金钱</td>
<td width=80% class=forumrow colspan=5><input size=45 name="userwealth" type=text value="<%=rs("userwealth")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>经验</td>
<td width=80% class=forumrow colspan=5><input size=45 name="userep" type=text value="<%=rs("userep")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>魅力</td>
<td width=80% class=forumrow colspan=5><input size=45 name="usercp" type=text value="<%=rs("usercp")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>威望</td>
<td width=80% class=forumrow colspan=5><input size=45 name="userpower" type=text value="<%=rs("userpower")%>"></td>
</tr>
<tr><th colspan=6 height=23 align=left>日期相关</th></tr>
<tr>
<td width=20% class=forumrow>生日</td>
<td width=80% class=forumrow colspan=5><input size=45 name="birthday" type=text value="<%=rs("userbirthday")%>">&nbsp;格式：2001-2-2</td>
</tr>
<tr>
<td width=20% class=forumrow>注册时间</td>
<td width=80% class=forumrow colspan=5><input size=45 name="adddate" type=text value="<%=rs("JoinDate")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>最后登录</td>
<td width=80% class=forumrow colspan=5><input size=45 name="lastlogin" type=text value="<%=rs("lastlogin")%>"></td>
</tr>
<tr><th colspan=6 height=23 align=left>用户详细资料</th></tr>
<tr>
<td width=20% class=forumrow>真实姓名</td>
<td width=80% class=forumrow colspan=5><input size=45 name="realname" type=text value="<%=realname%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>国　　家</td>
<td width=80% class=forumrow colspan=5><input size=45 name="country" type=text value="<%=country%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>联系电话</td>
<td width=80% class=forumrow colspan=5><input size=45 name="userphone" type=text value="<%=Uuserphone%>"></td>
</tr><tr>
<td width=20% class=forumrow>通信地址</td>
<td width=80% class=forumrow colspan=5><input size=45 name="address" type=text value="<%=Uaddress%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>省　　份</td>
<td width=80% class=forumrow colspan=5><input size=45 name="province" type=text value="<%=province%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>城　　市</td>
<td width=80% class=forumrow colspan=5><input size=45 name="city" type=text value="<%=city%>"></td>
</tr><tr>
<td width=20% class=forumrow>生　　肖</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name=shengxiao>
<option <%if shengxiao="" then%>selected<%end if%>></option>
<option value=鼠 <%if shengxiao="鼠" then%>selected<%end if%>>鼠</option>
<option value=牛 <%if shengxiao="牛" then%>selected<%end if%>>牛</option>
<option value=虎 <%if shengxiao="虎" then%>selected<%end if%>>虎</option>
<option value=兔 <%if shengxiao="兔" then%>selected<%end if%>>兔</option>
<option value=龙 <%if shengxiao="龙" then%>selected<%end if%>>龙</option>
<option value=蛇 <%if shengxiao="蛇" then%>selected<%end if%>>蛇</option>
<option value=马 <%if shengxiao="马" then%>selected<%end if%>>马</option>
<option value=羊 <%if shengxiao="羊" then%>selected<%end if%>>羊</option>
<option value=猴 <%if shengxiao="猴" then%>selected<%end if%>>猴</option>
<option value=鸡 <%if shengxiao="鸡" then%>selected<%end if%>>鸡</option>
<option value=狗 <%if shengxiao="狗" then%>selected<%end if%>>狗</option>
<option value=猪 <%if shengxiao="猪" then%>selected<%end if%>>猪</option>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>星　　座</td>
<td width=80% class=forumrow colspan=5><select name=Userstars size=1 id="Userstars">
            <option></option>
            <option value=白羊座 <%if Userstars="白羊座" then%>selected<%end if%>>白羊座</option>
            <option value=金牛座 <%if Userstars="金牛座" then%>selected<%end if%>>金牛座</option>
            <option value=双子座 <%if Userstars="双子座" then%>selected<%end if%>>双子座</option>
            <option value=巨蟹座 <%if Userstars="巨蟹座" then%>selected<%end if%>>巨蟹座</option>
            <option value=狮子座 <%if Userstars="狮子座" then%>selected<%end if%>>狮子座</option>
            <option value=处女座 <%if Userstars="处女座" then%>selected<%end if%>>处女座</option>
            <option value=天秤座 <%if Userstars="天秤座" then%>selected<%end if%>>天秤座</option>
            <option value=天蝎座 <%if Userstars="天蝎座" then%>selected<%end if%>>天蝎座</option>
            <option value=射手座 <%if Userstars="射手座" then%>selected<%end if%>>射手座</option>
            <option value=摩羯座 <%if Userstars="摩羯座" then%>selected<%end if%>>摩羯座</option>
            <option value=水瓶座 <%if Userstars="水瓶座" then%>selected<%end if%>>水瓶座</option>
            <option value=双鱼座 <%if Userstars="双鱼座" then%>selected<%end if%>>双鱼座</option>
          </select></td>
</tr>
<tr>
<td width=20% class=forumrow>血　　型</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name=blood>
<option <%if Ublood="" then%>selected<%end if%>></option>
<option value=A <%if Ublood="A" then%>selected<%end if%>>A</option>
<option value=B <%if Ublood="B" then%>selected<%end if%>>B</option>
<option value=AB <%if Ublood="AB" then%>selected<%end if%>>AB</option>
<option value=O <%if Ublood="O" then%>selected<%end if%>>O</option>
<option value=其他 <%if Ublood="其他" then%>selected<%end if%>>其他</option>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>民　　族</td>
<td width=80% class=forumrow colspan=5><select name=Folk>
              <option></option>
              <option value=汉族 <%if UFolk="汉族" then%>selected<%end if%>>汉族</option>
			  <option value=藏族 <%if UFolk="藏族" then%>selected<%end if%>>藏族</option>
			  <option value=朝鲜族 <%if UFolk="朝鲜族" then%>selected<%end if%>>朝鲜族</option>
			  <option value=蒙古族 <%if UFolk="蒙古族" then%>selected<%end if%>>蒙古族</option>
			  <option value=回族 <%if UFolk="回族" then%>selected<%end if%>>回族</option>
			  <option value=满族 <%if UFolk="满族" then%>selected<%end if%>>满族</option>
			  <option value=维吾尔族 <%if UFolk="维吾尔族" then%>selected<%end if%>>维吾尔族</option>
			  <option value=壮族 <%if UFolk="壮族" then%>selected<%end if%>>壮族</option>
			  <option value=彝族 <%if UFolk="彝族" then%>selected<%end if%>>彝族</option>
			  <option value=苗族 <%if UFolk="苗族" then%>selected<%end if%>>苗族</option>
			  <option value=其他民族 <%if UFolk="其他民族" then%>selected<%end if%>>其他民族</option> 
            </select></td>
</tr>
<tr>
<td width=20% class=forumrow>信　　仰</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name=belief>
<option <%if Ubelief="" then%>selected<%end if%>></option>
<option value=佛教 <%if Ubelief="佛教" then%>selected<%end if%>>佛教</option>
<option value=道教 <%if Ubelief="道教" then%>selected<%end if%>>道教</option>
<option value=基督教 <%if Ubelief="基督教" then%>selected<%end if%>>基督教</option>
<option value=天主教 <%if Ubelief="天主教" then%>selected<%end if%>>天主教</option>
<option value=回教 <%if Ubelief="回教" then%>selected<%end if%>>回教</option>
<option value=无神论者 <%if Ubelief="无神论者" then%>selected<%end if%>>无神论者</option>
<option value=共产主义者 <%if Ubelief="共产主义者" then%>selected<%end if%>>共产主义者</option>
<option value=其他 <%if Ubelief="其他" then%>selected<%end if%>>其他</option>
</select>
</td>
</tr><tr>
<td width=20% class=forumrow>职　　业</td>
<td width=80% class=forumrow colspan=5>
<select name=occupation>
          <option value="" <%if Uoccupation="" then%>selected<%end if%>> </option>
          <option value=学生 <%if Uoccupation="学生" then%>selected<%end if%>>学生</option>
          <option value=高层管理 <%if Uoccupation="高层管理" then%>selected<%end if%>>高层管理</option>
          <option value=中层干部 <%if Uoccupation="中层干部" then%>selected<%end if%>>中层干部</option>
          <option value=私营业主 <%if Uoccupation="私营业主" then%>selected<%end if%>>私营业主</option>
          <option value=个体业主 <%if Uoccupation="个体业主" then%>selected<%end if%>>个体业主</option>
          <option value=销售 <%if Uoccupation="销售" then%>selected<%end if%>>销售</option>
          <option value=市场 <%if Uoccupation="市场" then%>selected<%end if%>>市场</option>
          <option value=策划 <%if Uoccupation="策划" then%>selected<%end if%>>策划</option>
          <option value=研发 <%if Uoccupation="研发" then%>selected<%end if%>>研发</option>
          <option value=技术 <%if Uoccupation="技术" then%>selected<%end if%>>技术</option>
          <option value=科研 <%if Uoccupation="科研" then%>selected<%end if%>>科研</option>
          <option value=设计 <%if Uoccupation="设计" then%>selected<%end if%>>设计</option>
          <option value=生产采购 <%if Uoccupation="生产采购" then%>selected<%end if%>>生产采购</option>
          <option value=财务 <%if Uoccupation="财务" then%>selected<%end if%>>财务</option>
          <option value=人事行政 <%if Uoccupation="人事行政" then%>selected<%end if%>>人事行政</option>
          <option value=后勤 <%if Uoccupation="后勤" then%>selected<%end if%>>后勤</option>
          <option value=文秘助理 <%if Uoccupation="文秘助理" then%>selected<%end if%>>文秘助理</option>
          <option value=咨询培训 <%if Uoccupation="咨询培训" then%>selected<%end if%>>咨询培训</option>
          <option value=普通职员 <%if Uoccupation="普通职员" then%>selected<%end if%>>普通职员</option>
          <option value=高级职员 <%if Uoccupation="高级职员" then%>selected<%end if%>>高级职员</option>
          <option value=公务员 <%if Uoccupation="公务员" then%>selected<%end if%>>公务员</option>
          <option value=机关干部 <%if Uoccupation="机关干部" then%>selected<%end if%>>机关干部</option>
          <option value=教师 <%if Uoccupation="教师" then%>selected<%end if%>>教师</option>
          <option value=服务 <%if Uoccupation="服务" then%>selected<%end if%>>服务</option>
          <option value=工人 <%if Uoccupation="工人" then%>selected<%end if%>>工人</option>
          <option value=技工 <%if Uoccupation="技工" then%>selected<%end if%>>技工</option>
          <option value=农民 <%if Uoccupation="农民" then%>selected<%end if%>>农民</option>
          <option value=军人 <%if Uoccupation="军人" then%>selected<%end if%>>军人</option>
          <option value=警察 <%if Uoccupation="警察" then%>selected<%end if%>>警察</option>
          <option value=医生 <%if Uoccupation="医生" then%>selected<%end if%>>医生</option>
          <option value=护士 <%if Uoccupation="护士" then%>selected<%end if%>>护士</option>
          <option value=艺术 <%if Uoccupation="艺术" then%>selected<%end if%>>艺术</option>
          <option value=演艺 <%if Uoccupation="演艺" then%>selected<%end if%>>演艺</option>
          <option value=记者编辑 <%if Uoccupation="记者编辑" then%>selected<%end if%>>记者编辑</option>
          <option value=体育 <%if Uoccupation="体育" then%>selected<%end if%>>体育</option>
          <option value=律师 <%if Uoccupation="律师" then%>selected<%end if%>>律师</option>
          <option value=专业人士 <%if Uoccupation="专业人士" then%>selected<%end if%>>专业人士</option>
          <option value=自由职业 <%if Uoccupation="自由职业" then%>selected<%end if%>>自由职业</option><option value=待业 <%if Uoccupation="待业" then%>selected<%end if%>>待业</option> 
          <option value=退休 <%if Uoccupation="退休" then%>selected<%end if%>>退休</option>
          <option value=其他职业 <%if Uoccupation="其他职业" then%>selected<%end if%>>其他职业</option>
        </select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>职　　称</td>
<td width=80% class=forumrow colspan=5><input size=45 name="dutytype" type=text value="<%=Udutytype%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>婚姻状况</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name=marital>
<option <%if Umarital="" then%>selected<%end if%>></option>
<option value=未婚 <%if Umarital="未婚" then%>selected<%end if%>>未婚</option>
<option value=已婚 <%if Umarital="已婚" then%>selected<%end if%>>已婚</option>
<option value=离异 <%if Umarital="离异" then%>selected<%end if%>>离异</option>
<option value=丧偶 <%if Umarital="丧偶" then%>selected<%end if%>>丧偶</option>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>最高学历</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name=education>
<option <%if Ueducation="" then%>selected<%end if%>></option>
<option value=小学 <%if Ueducation="小学" then%>selected<%end if%>>小学</option>
<option value=初中 <%if Ueducation="初中" then%>selected<%end if%>>初中</option>
<option value=高中 <%if Ueducation="高中" then%>selected<%end if%>>高中</option>
<option value=大学 <%if Ueducation="大学" then%>selected<%end if%>>大学</option>
<option value=硕士 <%if Ueducation="硕士" then%>selected<%end if%>>硕士</option>
<option value=博士 <%if Ueducation="博士" then%>selected<%end if%>>博士</option>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>毕业院校</td>
<td width=80% class=forumrow colspan=5><input size=45 name="college" type=text value="<%=Ucollege%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>性　格</td>
<td width=80% class=forumrow colspan=5>
<textarea name=character rows=4 cols=80><%=character%></textarea>
</td>
</tr><tr>
<td width=20% class=forumrow>个人简介</td>
<td width=80% class=forumrow colspan=5>
<textarea name=personal rows=4 cols=80><%=personal%></textarea>
</td>
</tr><tr>
<td width=20% class=forumrow>用户签名</td>
<td width=80% class=forumrow colspan=5>
<textarea name="sign" rows=4 cols=80><%If Trim(Rs("UserSign"))<>"" Then Response.Write Server.HtmlEncode(rs("usersign"))%></textarea>
</td>
</tr>
<tr><th colspan=6 height=23 align=left>交友资料信息</th></tr>
<tr> 
        <td width=20% class=forumrow>健康程度</td>
        <td width=80% colspan=5 class=forumrow><select name=health>
            <option <%if Uhealth="" then%>selected<%end if%>></option>
            <option value=体弱多病 <%if Uhealth="体弱多病" then%>selected<%end if%>>体弱多病</option>
            <option value=体质一般 <%if Uhealth="体质一般" then%>selected<%end if%>>体质一般</option>
            <option value=很健康 <%if Uhealth="很健康" then%>selected<%end if%>>很健康</option>
            <option value=棒极了 <%if Uhealth="棒极了" then%>selected<%end if%>>棒极了</option>
          </select></td>
      </tr>
      <tr> 
        <td height="3" width=20%  class=forumrow>身　　高</td>
        <td width=80% colspan=5 class=forumrow><input name=Pheight type=text size=6 maxlength="4" value=<%=Pheight%>>
          厘米</td>
      </tr>
      <tr> 
        <td height="3" width=20%  class=forumrow>体　　重</td>
        <td width=80% colspan=5 class=forumrow><input name=Pweight type=text size=6 maxlength="4" value=<%=Uweight%>>
          公斤</td>
      </tr>
      <tr> 
        <td height="1" width=20%  class=forumrow>体　　型</td>
        <td width=80% colspan=5 class=forumrow><SELECT name=figure>
            <option <%if Ufigure="" then%>selected<%end if%>></option>
			<option value=瘦 <%if Ufigure="瘦" then%>selected<%end if%>>瘦</option>
            <option value=较瘦 <%if Ufigure="较瘦" then%>selected<%end if%>>较瘦</option>
			<option value=匀称 <%if Ufigure="匀称" then%>selected<%end if%>>匀称</option>
			<option value=苗条 <%if Ufigure="苗条" then%>selected<%end if%>>苗条</option>
			<option value=高挑 <%if Ufigure="高挑" then%>selected<%end if%>>高挑</option>
			<option value=丰满 <%if Ufigure="丰满" then%>selected<%end if%>>丰满</option>
			<option value=健壮 <%if Ufigure="健壮" then%>selected<%end if%>>健壮</option>
			<option value=魁梧 <%if Ufigure="魁梧" then%>selected<%end if%>>魁梧</option>
			<option value=较胖 <%if Ufigure="较胖" then%>selected<%end if%>>较胖</option>
			<option value=胖 <%if Ufigure="胖" then%>selected<%end if%>>胖</option>
          </SELECT>&nbsp;&nbsp;相貌自评：<select name=mylook>
              <option <%if Umylook="" then%>selected<%end if%>></option>
              <option value=1 <%if Umylook="1" then%>selected<%end if%>>1</option>
              <option value=2 <%if Umylook="2" then%>selected<%end if%>>2</option>
              <option value=3 <%if Umylook="3" then%>selected<%end if%>>3</option>
              <option value=4 <%if Umylook="4" then%>selected<%end if%>>4</option>
              <option value=5 <%if Umylook="5" then%>selected<%end if%>>5</option>
              <option value=6 <%if Umylook="6" then%>selected<%end if%>>6</option>
              <option value=7 <%if Umylook="7" then%>selected<%end if%>>7</option>
              <option value=8 <%if Umylook="8" then%>selected<%end if%>>8</option>
              <option value=9 <%if Umylook="9" then%>selected<%end if%>>9</option>
              <option value=10 <%if Umylook="10" then%>selected<%end if%>>10</option>
            </select>
            (10分为满分) </font></td>
      </tr>
      <tr>
        <td height="1" width=20%  class=forumrow>是否吸烟</td>
        <td width=80% colspan=5 class=forumrow><SELECT name=fug>
                      <option <%if Ufug="" then%>selected<%end if%>></option>
                      <option value=厌恶 <%if Ufug="厌恶" then%>selected<%end if%>>厌恶</option>
                      <option value=不吸 <%if Ufug="不吸" then%>selected<%end if%>>不吸</option>
                      <option value=偶尔 <%if Ufug="偶尔" then%>selected<%end if%>>偶尔</option>
                      <option value=经常 <%if Ufug="经常" then%>selected<%end if%>>经常</option>
                    </SELECT>&nbsp;&nbsp;收入水平：
					<select name=income>
              <option <%if Uincome="" then%>selected<%end if%>></option>
          <option value=1000以下 <%if Uincome="1000以下" then%>selected<%end if%>>1000以下</option>
          <option value=1000-2000 <%if Uincome="1000-2000" then%>selected<%end if%>>1000-2000</option>
          <option value=2000-3000 <%if Uincome="2000-3000" then%>selected<%end if%>>2000-3000</option>
          <option value=3000-4000 <%if Uincome="3000-4000" then%>selected<%end if%>>3000-4000</option>
          <option value=4000-5000 <%if Uincome="4000-5000" then%>selected<%end if%>>4000-5000</option>
          <option value=5000-6000 <%if Uincome="5000-6000" then%>selected<%end if%>>5000-6000</option>
          <option value=6000-7000 <%if Uincome="6000-7000" then%>selected<%end if%>>6000-7000</option>
          <option value=7000-10000 <%if Uincome="7000-10000" then%>selected<%end if%>>7000-10000</option>
          <option value=10000以上 <%if Uincome="10000以上" then%>selected<%end if%>>10000以上</option>
            </select></td>
      </tr>
      <tr>
        <td height="3" width=20%  class=forumrow>是否喝酒</td>
        <td width=80% colspan=5 class=forumrow><SELECT name=alcohol>
                      <option <%if Ualcohol="" then%>selected<%end if%>></option>
                      <option value=厌恶 <%if Ualcohol="厌恶" then%>selected<%end if%>>厌恶</option>
                      <option value=不喝 <%if Ualcohol="不喝" then%>selected<%end if%>>不喝</option>
                      <option value=偶尔 <%if Ualcohol="偶尔" then%>selected<%end if%>>偶尔</option>
                      <option value=经常 <%if Ualcohol="经常" then%>selected<%end if%>>经常</option>
                    </SELECT>&nbsp;&nbsp;住房状况：<select name=houses>
              <option <%if Uhouses="" then%>selected<%end if%>></option>
              <option value=自有房 <%if Uhouses="自有房" then%>selected<%end if%>>自有房</option>
			  <option value=与人合租 <%if Uhouses="与人合租" then%>selected<%end if%>>与人合租</option>
			  <option value=独自租房 <%if Uhouses="独自租房" then%>selected<%end if%>>独自租房</option>
			  <option value=与父母同住 <%if Uhouses="与父母同住" then%>selected<%end if%>>与父母同住</option>
			  <option value=住亲朋家 <%if Uhouses="住亲朋家" then%>selected<%end if%>>住亲朋家</option>
			  <option value=住单位房 <%if Uhouses="住单位房" then%>selected<%end if%>>住单位房</option> 
            </select></td>
      </tr>
      <tr> 
        <td height="16" width=20%  class=forumrow>掌握语言：</td>
        <td width=80% colspan=5 class=forumrow>
		<input type=checkbox name=language value=普通话 <%if instr(Ulanguage,"普通话")>0 then response.write "checked" end if%>>普通话 
          <input type=checkbox name=language value=上海话 <%if instr(Ulanguage,"上海话")>0 then response.write "checked" end if%>>上海话
<input type=checkbox name=language value=广东话 <%if instr(Ulanguage,"广东话")>0 then response.write "checked" end if%>>广东话
<input type=checkbox name=language value=其他方言 <%if instr(Ulanguage,"其他方言")>0 then response.write "checked" end if%>>其他方言
<input type=checkbox name=language value=英语 <%if instr(Ulanguage,"英语")>0 then response.write "checked" end if%>>英语
<br><input type=checkbox name=language value=日语 <%if instr(Ulanguage,"日语")>0 then response.write "checked" end if%>>日语
<input type=checkbox name=language value=韩语 <%if instr(Ulanguage,"韩语")>0 then response.write "checked" end if%>>韩语
<input type=checkbox name=language value=法语 <%if instr(Ulanguage,"法语")>0 then response.write "checked" end if%>>法语
<input type=checkbox name=language value=德语 <%if instr(Ulanguage,"德语")>0 then response.write "checked" end if%>>德语
<input type=checkbox name=language value=俄语 <%if instr(Ulanguage,"俄语")>0 then response.write "checked" end if%>>
          俄语 
          <input type=checkbox name=language value=其它 <%if instr(Ulanguage,"其它")>0 then response.write "checked" end if%>>其它</td>
      </tr>
<tr><th colspan=6 height=23 align=left>用户设置</th></tr>
<tr>
<td width=20% class=forumrow>用户状态</td>
<td width=80% class=forumrow colspan=5>
正常 <input type="radio" value="0" <%if rs("lockuser")=0 then%>checked<%end if%> name="lockuser">&nbsp;
锁定 <input type="radio" value="1" <%if rs("lockuser")=1 then%>checked<%end if%> name="lockuser">&nbsp;
屏蔽 <input type="radio" value="2" <%if rs("lockuser")=2 then%>checked<%end if%> name="lockuser">
</td>
</tr>
<tr>
<td width=20% class=forumrow>VIP设置</td>
<td width=80% class=forumrow colspan=5>
<select size=1 name="UserVip">
<%dim Trv,it
set trv=Conn.Execute("select usergroupid,Usertitle from Ms_usergroups where ParentGID=5 order by usergroupid asc")
it=0
do while not trv.eof
it=it+1
response.write "<option value="&i
if i=rs("UserVip") then response.write " selected "
response.write ">"& trv(1)
response.write "</option>"
trv.movenext
loop
trv.close
set trv=nothing
response.Write("<option value=1 ")
if rs("UserVip")=1 then response.write " selected"
response.Write(">提交申请VIP</option>")
response.Write("<option value=0 ")
if rs("UserVip")=0 then response.write " selected"
response.Write(">解除VIP或未申请</option>")
%>
</select>
</td>
</tr>
<tr>
<td width=20% class=forumrow>VIP用户登记时间</td>
<td width=80% class=forumrow colspan=5>
<INPUT TYPE="text" NAME="Vip_StarTime" value="<%=Rs("Vip_StarTime")%>">
</td>
</tr>
<tr>
<td width=20% class=forumrow>VIP用户到期时间</td>
<td width=80% class=forumrow colspan=5>
<INPUT TYPE="text" NAME="Vip_EndTime" value="<%=Rs("Vip_EndTime")%>">
</td>
</tr>
<tr>
<td width=100% class=forumrow align=center colspan=6><input name="submit" type=submit value="   更  新   "></td>
</tr>
</FORM>
<%
		end if
		rs.close
		set rs=nothing
	end if
End Sub

Sub SaveUserInfo()''用户资料更新
dim Userinfo,myuserim,Userfriends
	response.write "<tr><th colspan=8 height=23 align=left>更新用户资料</th></tr>"
	Userinfo=checkreal(Request.Form("realname")) & "|||" & checkreal(Request.Form("character")) & "|||" & Htmlencode(trim(checkreal(Request.Form("personal")))) & "|||" & checkreal(Request.Form("country")) & "|||" & checkreal(Request.Form("province")) & "|||" & checkreal(Request.Form("city")) & "|||" & Request.Form("shengxiao") & "|||" & Request.Form("Userstars") & "|||" & Request.Form("blood") & "|||" & Request.Form("Folk") & "|||" & Request.Form("belief") & "|||" & Request.Form("occupation") & "|||" & checkreal(Request.Form("dutytype"))& "|||" & Request.Form("marital") & "|||" & Request.Form("education") & "|||" & checkreal(Request.Form("college")) & "|||" & checkreal(Request.Form("userphone")) & "|||" & checkreal(Request.Form("address"))
	myuserim=checkreal(Request.form("homepage")) &"|||"& checkreal(Request.form("Oicq")) &"|||"& checkreal(Request.form("Icq")) &"|||"& checkreal(Request.form("msn")) &"|||"& checkreal(Request.form("yahoo")) &"|||"& checkreal(Request.form("aim")) &"|||"& checkreal(Request.form("uc"))
	Userfriends=Request.Form("health") & "|||" & checkreal(Request.Form("Pweight")) & "|||" & Request.Form("figure") & "|||" & Request.Form("mylook")& "|||" & Request.Form("fug")& "|||" & Request.Form("income")& "|||" & Request.Form("alcohol")& "|||" & Request.Form("houses")& "|||" & checkreal(Request.Form("language"))
	if not isnumeric(request("userid")) then
		response.write "<tr><td colspan=8 class=forumrow>错误的用户参数。</td></tr>"
		founderr=true
	end if
	If strLength(Request.Form("sign"))> 250 Then
		Response.Write "<tr><td colspan=8 class=forumrow>用户签名不能超过 250 个字符。</td></tr>"
		Founderr = True
	End If
	if not founderr then
	Dim iUserClass,iTitlePic
	Set Rs=Conn.Execute("Select UserTitle,GroupPic From Ms_UserGroups Where UserGroupID = " & Request.Form("usergroups"))
	If Rs.Eof And Rs.Bof Then
		Response.Write "<tr><td colspan=8 class=forumrow>所选用户组信息并不存在。</td></tr>"
		Founderr = True
	Else
		iUserClass = Rs("UserTitle")
		iTitlePic = Rs("GroupPic")
	End If
	Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select * from [Ms_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>没有找到相关用户。</td></tr>"
		founderr=true
	else
		rs("username")=request.form("username")
		if request.form("password")<>"" then
		rs("userpassword")=md5(request.form("password"),16)
		end if
		rs("usergroupid")=request.form("usergroups")
		rs("userquesion")=request.form("quesion")
		if request.form("answer")<>"" then rs("useranswer")=md5(request.form("answer"),16)
		rs("userclass")=iUserClass
		rs("useremail")=request.form("useremail")
		Rs("UserSex")=request.form("sex")
		rs("userim")=myuserim
		rs("userface")=request.form("face")
		rs("Faceinfo")=request.form("width")& "|||"&request.form("height")
		rs("Userfriends")=Userfriends
		rs("UserInfo")=userinfo
		rs("titlepic")=iTitlePic
		rs("UserVip")=request.form("UserVip")
		if isnumeric(request.form("article")) then rs("Userart")=request.form("article")
		if isnumeric(request.form("userdiary")) then rs("userdiary")=request.form("userdiary")
		if isnumeric(request.form("userpics")) then rs("userpics")=request.form("userpics")
		if isnumeric(request.form("userpower")) then rs("userpower")=request.form("userpower")
		if isnumeric(request.form("userwealth")) then rs("userwealth")=request.form("userwealth")
		if Request.Form("TemplateId")="" then
	rs("TemplateId")=1
	else
	rs("TemplateId")=Request.Form("TemplateId")
	end if
		if isnumeric(request.form("userep")) then rs("userep")=request.form("userep")
		if isnumeric(request.form("usercp")) then rs("usercp")=request.form("usercp")
		if isdate(request.form("birthday")) then rs("userbirthday")=request.form("birthday")
		if isdate(request.form("adddate")) then rs("JoinDate")=request.form("adddate")
		if isdate(request.form("lastlogin")) then rs("lastlogin")=request.form("lastlogin")
		if isdate(request.form("Vip_StarTime")) then rs("Vip_StarTime")=request.form("Vip_StarTime")
		if isdate(request.form("Vip_EndTime")) then rs("Vip_EndTime")=request.form("Vip_EndTime")
		if isnumeric(request.form("lockuser")) then rs("lockuser")=request.form("lockuser")
		if Request.Form("Pheight")<>"" then
	rs("Userheight")=Request.Form("Pheight")
	end if
	If request.form("sign")<>"" Then rs("UserSign")=Htmlencode(Trim(request.form("sign")))
		rs.update
	end if
	rs.close
	set rs=nothing
	end if
	if founderr then
		response.write "<tr><td colspan=8 class=forumrow>更新失败。</td></tr>"
	else
		response.write "<tr><td colspan=8 class=forumrow>更新用户数据成功。</td></tr>"
	end if
End Sub

sub Fixuser()''修复操作
Dim Username,Userart,Userdiary,Userpics
	Username = Request("username")
	If Username="" Then
	Errmsg = ErrMsg + "<BR><li>参数错误!"
		Ms_error()
		Exit Sub
	End If
	''修复文章
	sql="select Count(ID) from [Ms_Article] where username='"&Username&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Userart=rs(0)
else
Userart=0
end if
set rs=nothing
''修复日记
	sql="select Count(DID) from [Ms_diary] where username='"&Username&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Userdiary=rs(0)
else
Userdiary=0
end if
set rs=nothing
''修复相册
	sql="select Count(FID) from [Ms_Upphoto] where username='"&Username&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Userpics=rs(0)
else
Userpics=0
end if
set rs=nothing
Conn.Execute ("UPDATE [Ms_User] SET Userart = " & Userart & ", Userdiary = " & Userdiary & ",UserPics="&Userpics&" WHERE Username = '" & Username & "'")
	Ms_suc("用户<b>" & Username & "</b>数据修复成功！")
end sub

Function CheckReal(v)
	Dim w
	If Not IsNull(v) Then
		w=Replace(v,"|||","§§§")
		CheckReal=w
	End If
End Function

Function CheckNumeric(Byval CHECK_ID)''检验是否数字型
	If CHECK_ID<>"" and IsNumeric(CHECK_ID) Then _
		CHECK_ID = Int(CHECK_ID) _
	Else _
		CHECK_ID = 0
	CheckNumeric = CHECK_ID
End Function%>