<!--#include file="conn.asp"-->
<%
if session("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
else
if request.cookies("sundxshop")("admin")="" then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('请先登录！');history.go(-1);</script>"
response.End
end if
end if
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权查看用户信息！');history.go(-1);</script>"
response.End
end if
%>
<title>用户资料管理</title>
<%dim userid,rsUser,UserNum
		userid=SafeRequest("id",1)
		set rs=server.createobject("adodb.recordset")
		rs.open "select * from DV_User where userid="&userid ,conn,1,1
		  %>
<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" BGCOLOR="#39867B">
  <tr> 
    <td align="center"><font color="#FFFFFF">用户详细资料</font></td>
  </tr>
  <tr> 
    <td valign="top" bgcolor="#FFFFFF"> <br>
	<form name="form1" method="post" action="saveuser.asp?action=save&id=<%=userid%>">
        <table width="95%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
          <tr bgcolor="#FFFFFF"> 
            <td width="20%" height="25">&nbsp;用户名称：</td>
            <td width="80%">&nbsp;<FONT COLOR=#FF7E28><%=trim(rs("username"))%></font></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;登录密码：</td>
            <td>&nbsp;
              <input name="UserPassword" type="text" id="UserPassword" size="12">
              不改密码请为空!</td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;真实姓名：</td>
            <td> &nbsp;
              <input name="realname" type="text" id="realname" size="12" value=<%=trim(rs("realname"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;身份证号码</td>
            <td>&nbsp;
              <INPUT NAME="identify" TYPE="text" ID="identify" SIZE="18" VALUE=<%=trim(rs("identify"))%>></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;电子邮件：</td>
            <td> &nbsp;
              <input name="useremail" type="text" id="useremail" value=<%=trim(rs("useremail"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;手机号码：</td>
            <td>&nbsp;
              <INPUT NAME="UserMobile" TYPE="text" ID="UserMobile" SIZE="15" VALUE=<%=trim(rs("UserMobile"))%>></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;腾 讯 Q Q：</td>
            <td>&nbsp;
              <INPUT NAME="userqq" TYPE="text" ID="userqq" SIZE="15" VALUE=<%=trim(rs("userqq"))%>></td>
          </tr>
		     <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;MSN：</td>
            <td>&nbsp;
              <INPUT NAME="MSN" TYPE="text" ID="MSN" SIZE="15" VALUE=<%=trim(rs("MSN"))%>></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;密码提问：</td>
            <td> &nbsp;
              <input name="UserQuesion" type="text" id="UserQuesion" value=<%=trim(rs("UserQuesion"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;密码答案：</td>
            <td> &nbsp;
              <input name="UserAnswer" type="text" id="UserAnswer"> </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;收货人姓名：</td>
            <td> &nbsp;
              <input name="receipt" type="text" id="receipt" size="12" value=<%=trim(rs("receipt"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;收货人性别：</td>
            <td> &nbsp; 
             <select name="UserSex" id="UserSex">
			    <option value="0" <% if rs("UserSex")=0 Then Response.write("Selected") %>>男</option>
                <option value="1" <% if rs("UserSex")=1 Then Response.write("Selected") %>>女</option>
              </select>
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;收货人省/市：</td>
            <td> &nbsp;
              <input name="city" type="text" id="city" size="12" value=<%=trim(rs("city"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;收货地址：</td>
            <td> &nbsp;
              <input name="address" type="text" id="address" size="30" value=<%=trim(rs("address"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;邮编：</td>
            <td>&nbsp;
              <input name="postcode" type="text" id="postcode" size="12" value=<%=rs("postcode")%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;电话：</td>
            <td> &nbsp;
              <input name="usertel" type="text" id="usertel" size="12" value=<%=trim(rs("usertel"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;用户积分：</td>
            <td>&nbsp;
              <INPUT NAME="score" TYPE="text" ID="usertel" SIZE="12" VALUE=<%=trim(rs("score"))%>> 
            </td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;用户预存款</td>
            <td>&nbsp;
              <INPUT NAME="deposit" TYPE="text" ID="usertel" SIZE="12" VALUE=<%=trim(rs("deposit"))%>></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td>&nbsp;会员级别</td>
            <td>
              <% 
			set rsUser=server.createobject("adodb.recordset")
			rsUser.Open "Select GrpID,GrpName From sundxGRP"  ,conn,1,1 %>
              &nbsp;
              <select name="GrpID" id="GrpID">
                <%
		do while not rsUser.eof
		response.write  "<option value="&rsUser("GrpID")
 		 if rsUser("GrpID")=rs("GrpID") then response.write " selected "
  		response.write ">"&trim(rsUser("GrpName"))&"</option>"    
        rsUser.movenext
        loop
		rsUser.Close
		%>
              </select> 
		<%
		rsUser.Open "Select Count(UserID) as RecNum Where DV_User.recommender = '"&rs("UserName")&"' ",conn,1,1
		UserNum = rsUser("RecNum")
		rsUser.Close
		Set rsUser = Nothing
		%>
			  </td>
          </tr>
          <tr bgcolor="#FFFFFF" height="20"> 
            <td>&nbsp;注册时间：</td>
            <td>&nbsp;<%=rs("adddate")%></td>
          </tr>
          <tr bgcolor="#FFFFFF" height="20"> 
            <td>&nbsp;上次登录时间：</td>
            <td>&nbsp;<%=rs("LastLogin")%></td>
          </tr>
          <tr bgcolor="#FFFFFF" height="20"> 
            <td>&nbsp;登录次数：</td>
            <td>&nbsp;<%=rs("UserLogins")%>次</td>
          </tr>
          <tr bgcolor="#FFFFFF" height="20"> 
            <td>&nbsp;已下订单数：</td>
            <td>&nbsp; 
              <%dim rs2
			set rs2=server.CreateObject("adodb.recordset")
			rs2.open "select distinct(goods) from orders where username='"&trim(rs("username"))&"' and orders.state>2 ",conn,1,1
			response.write rs2.recordcount&"&nbsp;笔订单"
			rs2.close
			set rs2=nothing
			%>
            </td>
          </tr>
          <tr bgcolor="#FFFFFF" height="20"> 
            <td>&nbsp;推 荐 人：</td>
            <td>&nbsp;<A HREF=disuser.asp?id=<%=rs("userid")%>><%=trim(rs("recommender"))%></A><% = UserNum %></td>
          </tr>
		   <tr bgcolor="#FFFFFF" height="20"> 
            <td>&nbsp;最后登录IP：</td>
            <td>&nbsp;<%=trim(rs("img"))%></A><% = UserNum %></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td valign="top">&nbsp;系统广播</td>
            <td>&nbsp;
              <TEXTAREA NAME="book" ID="book" COLS="50" ROWS="5"><%=trim(rs("book"))%></TEXTAREA></td>
          </tr>
          <tr bgcolor="#FFFFFF"> 
            <td height="28" colspan="2">&nbsp;查找此用户的所有定单： 
              <select name="state" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" ><base target=Right> 
                <option value="" selected>--选择查询状态--</option>
                <option value="editorder.asp?state=0&namekey=<%=trim(rs("username"))%>" >全部订单状态</option>
                <option value="editorder.asp?state=1&namekey=<%=trim(rs("username"))%>" >未作任何处理</option>
                <option value="editorder.asp?state=2&namekey=<%=trim(rs("username"))%>" >用户已划出款</option>
                <option value="editorder.asp?state=3&namekey=<%=trim(rs("username"))%>" >服务商已收到款</option>
                <option value="editorder.asp?state=4&namekey=<%=trim(rs("username"))%>" >服务商已发货</option>
                <option value="editorder.asp?state=5&namekey=<%=trim(rs("username"))%>" >用户已经收到货</option>
              </select> </td>
          </tr>
          <%rs.close
			set rs=nothing
			conn.close
			set conn=nothing%>
          <tr> 
            <td height="28" colspan="2" bgcolor="#FFFFFF" align="center"><input type="submit" name="Submit" value="确认提交"> 
              &nbsp;&nbsp;&nbsp; <input type="button" name="Submit2" value="返回上一页" onClick='javascript:history.go(-1)'> 
            </td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
<!--#include file="footer.asp"-->
