<!--#include file="conn.asp"-->
<!--#include file="INC/md5.asp"-->
<%
	'检查访问的来源是否合法
	call checkPrePage()
	
	'检查用户访问的权限
	call checkuser(1)

strM_ID=GetQueryString("id")
if GetQueryString("action")="save" then
	strSQL="Update member Set "
	if GetFormVariable("chkpass")<>"" then
		strPass=GetFormVariable("txtpwd")
		strPass=MD5(strPass)
		strSQL=strSQL & "m_password='" & strPass & "',"
	end if
	strCode=GetFormVariable("selCode")
	strAgent=GetFormVariable("selAgent")
	strWebServer=GetFormVariable("txtwebserver")
	strWebServer=Lcase(strWebServer)
	strAdminServer=GetFormVariable("txtadminserver")
	strWebprice=GetFormVariable("txtWebprice")
	
	'检查WEB服务器是否存在
	if strWebServer<>"" then
		if Instr(strWebServer,".")<=0 Or Instr(Lcase(strWebServer),"http:")>0 then
			ShowMsg "域名格式不正确，例如：www.jndiy.com/register.asp,www.jnbiz.com/diyreg.asp"
		end if
		Dim ServerList
		ServerList=split(strWebServer,",")
		For i=0 to LBound(ServerList)
			if ServerList(i)<>"" then
				Set rsSub=Server.CreateObject("ADODB.RecordSet")
				rsSub.open "Select id from member Where id<>"&strM_ID&" and m_webserver Like '%" & ServerList(i) & "%'",conn,1,1
				if rsSub.recordcount > 0 then
					ShowMsg "域名 " & ServerList(i) & " 已经被人占用，不允许重复绑定!"
				end if
				rsSub.close
			end if
		next
	end if
	
	'检查所属代理商是否存在
	Set rSub=server.CreateObject("ADODB.RecordSet")
	rSub.open "Select id From member Where m_code>0 And m_name='" & strAgent & "'",conn,1,1
	if rSub.recordcount>0 then
		strAgent=rSub("id")
	else
		ShowMsg "设置所属代理失败，代理商 " & strAgent & " 不存在!"
	end if
	rSub.close
	
	strSQL=strSQL & "m_code=" & strCode & ",m_AgentName=" & strAgent & ",m_webserver='," & strWebServer & ",' , m_adminserver='" & strAdminServer &  "'"
	if strWebprice<>"" then strSQL=strSQL&",m_webprice="&strWebprice
	strSQL=strSQL & " Where id=" & strM_ID
	conn.execute strSQL,0,1
end if

%>
	<%
	strSQL="Select * from v_member_agent Where id=" & strM_ID
	rs.open strSQL,conn,1,1
	%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>电子商务自助建站--您理想的助手</title>
<link href="common/styleMain.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="common/JS_CheckForm.js"></script>
<script language="JavaScript">

function checksearch(theform){
	if (theform.txtkey.value==""){
		alert("请输入搜索关键字 ");
		return false;
	}
}

function init(){
	SelectValue(form1.selCode,"<%=rs("m_code")%>");
}
function checkform(theform){
	if (theform.txtWebprice!=null){
		if (!CheckEmpty(theform.txtWebprice, "代理价格"))		return false;
		if (!CheckReal(theform.txtWebprice, "代理价格"))	return false;
	}
	
}
</script>
</head>
<body leftmargin="0" topmargin="0" onLoad="init()">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/top.asp"-->
          </td>
        </tr>
        <tr> 
          <td height="100%" align="center" valign="top">
<TABLE class=table002 cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
                <TR> 
                  <!--左边开始-->
                  <TD width="20%" align=right vAlign=top> <!--#include file="common/adminleft.asp"--> </TD>
                  <!--左边结束-->
                  <TD width="2%" background="images/rowline.gif">&nbsp;</TD>
                  <!--右边开始-->
                  <TD vAlign=top align=center width="78%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td><form name="form1" method="post" action="?action=save&id=<%=strM_ID%>" onSubmit="return checkform(this)">
                            <TABLE width="100%" height="100%" border=0 cellPadding=6 cellSpacing=0>
                              <TBODY>
                                <TR> 
                                  <TD vAlign=top align=left bgColor=#ffffff><strong><font color="#FF0000">用户管理：<%=trim(rs("m_name"))%></font></strong><BR> <HR SIZE=1>
                                    <table width="98%" border="0" cellspacing="0" cellpadding="0">
                                      <tr> 
                                        <td height="25" align="center" valign="bottom"> 
                                          <table width="551" height="23" border="0" cellpadding="0" cellspacing="0">
                                            <tr align="center"> 
                                              <td width="30" valign="bottom">&nbsp;</td>
                                              <td width="88" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">基本资料</font></strong></td>
                                              <td width="17">&nbsp;</td>
                                              <td width="88" bgcolor="#EEEEEE"><a href="Admin_UserInfo1.asp?id=<%=GetVariable("id")%>"><strong>财务相关</strong></a></td>
                                              <td width="17">&nbsp;</td>
                                              <td width="88" bgcolor="#EEEEEE"><a href="Admin_UserInfo2.asp?id=<%=GetVariable("id")%>"><strong>权限管理</strong></a></td>
                                              <td width="210">&nbsp;</td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                      <tr> 
                                        <td height="1" bgcolor="#5F8AC5"></td>
                                      </tr>
                                      <tr> 
                                        <td><table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#5F8AC5">
                                            <tr> 
                                              <td height="30" align="center" bgcolor="#FFFFFF"> 
                                                <table width="98%" border="0" cellspacing="0" cellpadding="3">
                                                  <tr align="center"> 
                                                    <td height="30" colspan="2"><strong>基本资料</strong> 
                                                    </td>
                                                  </tr>
                                                  <tr> 
                                                    <td width="28%" align="right" bgcolor="#F9F9F9">用户ID号：</td>
                                                    <td width="72%" bgcolor="#F9F9F9"><font color=#5E5E5E face=verdana><%=rs("id")%></font></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right">用户账号：</td>
                                                    <td><%=rs("m_name")%></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#F9F9F9"><strong><font color="#FF0000">账号密码：</font></strong></td>
                                                    <td bgcolor="#F9F9F9"><input name="txtpwd" type="password" id="txtpwd" value="<%=Trim(rs("m_password"))%>" maxlength="50"> 
                                                      <input name="chkpass" type="checkbox" id="chkpass" value="1">
                                                      修改其密码 </td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right">级　别：</td>
                                                    <td> <select name="selCode" id="selCode">
                                                        <%
													  if Cint(Session("UserCode"))>5 then 
													  %>
                                                        <option value="5">区域管家</option>
                                                        <%end if%>
                                                        <%
													  if Cint(Session("UserCode"))>4 then 
													  %>
                                                        <option value="4">战略伙伴</option>
                                                        <%end if%>
                                                        <%
													  if Cint(Session("UserCode"))>3 then 
													  %>
                                                        <option value="3">合作伙伴</option>
                                                        <%end if%>
                                                        <%
													  if Cint(Session("UserCode"))>2 then 
													  %>
                                                        <option value="2">高级代理</option>
                                                        <%end if%>
                                                        <%
													  if Cint(Session("UserCode"))>1 then 
													  %>
                                                        <option value="1">普通代理</option>
                                                        <%end if%>
                                                        <%
													  if Cint(Session("UserCode"))>0 then 
													  %>
                                                        <option value="0" selected>普通用户</option>
                                                        <%end if%>
                                                      </select> <font color="#FF0000">[请谨慎设置]</font></td>
                                                  </tr>
                                                  <%if rs("m_code")>0 then%>
                                                  <tr bgcolor="#FFFFFF"> 
                                                    <td align="right">注册接口：</td>
                                                    <td> <input name="txtwebserver" type="text" id="txtwebserver" value="<%
													  if Len(rs("m_webserver"))>0 then
													  		response.Write Mid(Trim(rs("m_webserver")),2,len(Trim(rs("m_webserver")))-2)
													  end if
													  
													  %>" size="30" maxlength="250"> 
                                                      <font color="#FF0000"> 　[多个域名用,号分隔]</font></td>
                                                  </tr>
                                                  <tr bgcolor="#FFFFFF"> 
                                                    <td align="right">管理接口：</td>
                                                    <td> <input name="txtadminserver" type="text" id="txtadminserver" value="<%= Trim(rs("m_adminserver")) %>" size="30" maxlength="250"> 
                                                      <font color="#FF0000"> 　[例如：http://admin.easy.com]</font></td>
                                                  </tr>
                                                  <tr bgcolor="#FFFFFF"> 
                                                    <td align="right">代理价格：</td>
                                                    <td> <input name="txtWebprice" type="text" id="txtWebprice" value="<%= Trim(rs("m_webprice")) %>" size="10" maxlength="10">
                                                      <font color="#FF0000"> 　[以月为单位]</font></td>
                                                  </tr>
                                                  <% end if%>
                                                  <tr> 
                                                    <td align="right" bgcolor="#F9F9F9">注册时间：</td>
                                                    <td bgcolor="#F9F9F9"><%=rs("m_regdate")%></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right">使用期限：</td>
                                                    <td><%=rs("m_expire")%></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#F9F9F9">当前状态：</td>
                                                    <td bgcolor="#F9F9F9"><font color="#5E5E5E"> 
                                                      <%
										regdate=rs("m_regdate")
										expire=rs("m_expire")
										if DateDiff("d",regdate,expire)=7 And DateDiff("d",date,expire)>=0 then
											response.Write("试用用户")
										end if
										
										if DateDiff("d",regdate,expire)>7 And DateDiff("d",date,expire)>=0 then
											response.Write("付费用户")
										end if
										
										if DateDiff("d",date,expire)<0 then
											response.Write("过期用户")
										end if
										
										
										
										%>
                                                      － 
                                                      <%
										strChecked="开通中"
										if rs("m_lock") then
											strChecked="已被封杀"
										end if
										response.Write(strChecked)
										%>
                                                      </font></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#FFFFFF">所属代理商：</td>
                                                    <td bgcolor="#FFFFFF"> <input name="selAgent" type="text" id="selAgent" value="<%=Trim(rs("agentname"))%>" maxlength="50"> 
                                                      <font color="#FF0000">[请填写代理商名称，要谨慎设置]</font> 
                                                    </td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#F9F9F9">OICQ：</td>
                                                    <td bgcolor="#F9F9F9"><%=rs("m_oicq")%></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#FFFFFF">E-Mail：</td>
                                                    <td bgcolor="#FFFFFF"><%=rs("m_email")%></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#F9F9F9">最后登陆时间：</td>
                                                    <td bgcolor="#F9F9F9"><%=rs("m_landLogin")%></td>
                                                  </tr>
                                                  <tr> 
                                                    <td align="right" bgcolor="#F9F9F9">网站地址：</td>
                                                    <td bgcolor="#F9F9F9"> <A class=BlackLink 
													href="<%=strWebServer & "/Home/" & Trim(rs("m_name")) %>" target=_blank><FONT 
													color=red><%=strWebServer & "/Home/" & Trim(rs("m_name")) %></FONT></A> 
                                                      <input type="button" name="Submit2" value="重设后台密码" onClick="window.open('Admin_ResetAdminPass.asp?id=<%=Trim(rs("id"))%>&name=<%=Trim(rs("m_name"))%>&pass=<%=Trim(rs("m_password"))%>')">	
                                                    </td>
                                                  </tr>
                                                  <tr> 
                                                    <td height="30" align="right" bgcolor="#F9F9F9">&nbsp;</td>
                                                    <td bgcolor="#F9F9F9">　 
                                                      <input type="submit" name="Submit" value="更 新">
                                                      　 
                                                      <input type="reset" name="reset" value="取 消"></td>
                                                  </tr>
                                                </table></td>
                                            </tr>
                                          </table></td>
                                      </tr>
                                    </table> </TD>
                                </TR>
                              </TBODY>
                            </TABLE>
                          </form>
						 </td>
                      </tr>
                      <tr>
                        <td align="center"> 
                          <form action="Admin_User.asp?state=用户搜索：搜索结果" method="post" name="search" id="search" onSubmit="return checksearch(this)">
                            <table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#5F8AC5">
                              <tr> 
                                <td bgcolor="#5F8AC5">&nbsp<strong><font color="#FFFFFF">用户搜索</font></strong></td>
                              </tr>
                              <tr> 
                                <td height="40" align="center" bgcolor="F9F9F9"> 
                                  关键字： 
                                  <input name="txtkey" type=text id="txtkey" value="" size=30> 
                                  <select name="SchType">
                                    <option value="" selected>模糊查询</option>
                                    <option value="id" >用户ID</option>
                                    <option value="name" >单位域名</option>
                                    <option value="email" >email</option>
                                    <option value="oicq" >oicq</option>
                                  </select> <input type=submit name="submit" value="搜 索">
                                </td>
                              </tr>
                            </table>
                          </form></td>
                      </tr>
                    </table> 
                  </TD>
                </TR>
              </TBODY>
            </TABLE></td>
        </tr>
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/bottom.asp"-->
		  </td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
