<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p20")
'''''''''''''''''''''''''''''''''''''''''''''''
dim id
id=Clng(request.QueryString("id"))
%>
<html>
<head>
<title>会员管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
	font-size:12px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
.td_row{ padding:2px 5px; line-height:20px;}
form{margin:0;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/http.js"></script>
<script type="text/javascript">
function checkint(elem)
{
  var checkOK = ".0123456789";
  var checkStr = elem.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
		ch = checkStr.charAt(i);
    	for (j = 0;  j < checkOK.length;  j++)
      	if (ch == checkOK.charAt(j))
        break;
    	if (j == checkOK.length)
    	{
      		allValid = false;
      		break;
    	}
  }
  if (!allValid)
  {
    	alert("只能输入数字。");
    	elem.focus();
    	return (false);
  }
  return (true);
}
function selectcity(provinceid,cityid){	
			var citySelect=document.PostForm.City;
			citySelect.options.length = 0;		
			var xmlhttp;	 
			xmlhttp=getXMLRequester();	
			//alert(xmlhttp);
			if(xmlhttp){	
				xmlhttp.onreadystatechange = function doAction() {		
					if (xmlhttp.readyState == 4)
					{			
						/*alert(xmlhttp.responseText);*/				
						var response = xmlhttp.responseXML.documentElement;
						var classidList = response.getElementsByTagName('city');	
						
						for(var i=0;i<classidList.length;i++){
							xx=classidList[i].getElementsByTagName('id');
							yy=classidList[i].getElementsByTagName('title');
							classid=xx[0].firstChild.data
							classtitle=yy[0].firstChild.data				
							citySelect.options[i]=new Option(classtitle,classtitle);							
							if(cityid==classtitle){
								citySelect.options[i].selected=true;
							}
						}
					}
				};
				xmlhttp.open("POST", "/member/get_citys.asp?pid="+provinceid,true);
				xmlhttp.send("");
			}
}////////////////////////	
</script>
<LINK media=screen href="../js/dhtmlgoodies_calendar.css" rel=stylesheet></LINK>
<SCRIPT src="../js/dhtmlgoodies_calendar.js" type=text/javascript></SCRIPT>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top">
	<%
dim act
act=request.querystring("act")
if(act="do") then
	call mod_personalinfook()
	response.write("<div align=""center"">成功修改会员信息</p>")
	response.write("<p align=""center""><a href=""javascript:history.go(-2);"">返回</a></p>")
else
	call mod_personalinfo()
end if
%>    </td>
  </tr>
</table>
<%
sub mod_personalinfook
	dim rs,Email,UserName,IdCard,BornDate,Sex,Province,City,Education,Profession,InCome,Tel,Mobile,QQ,MSN,HomePage,Address,PostCode,Age,Demons,Photo
	Email=request.Form("Email")
	UserName=request.Form("UserName")
	IdCard=request.Form("IdCard")
	BornDate=cdate(request.Form("BornDate"))
	Sex=request.Form("Sex")
	Province=request.Form("Province")
	'Province=getProvinceTitle(Province)
	City=request.Form("City")
	Education=request.Form("Education")
	Profession=request.Form("Profession")
	InCome=request.Form("InCome")
	Tel=request.Form("Tel")
	Mobile=request.Form("Mobile")
	QQ=request.Form("QQ")
	MSN=request.Form("MSN")
	HomePage=request.Form("HomePage")
	Address=request.Form("Address")
	PostCode=request.Form("PostCode")
	Demons=request.Form("Demons")
	Photo=request.Form("Photo")
	Age=Cint(request.Form("Age"))
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_member where id="&id,conn,3,3
	if not rs.eof then
		rs("Email")=Email
		rs("UserName")=UserName
		rs("Profession")=Profession
		rs("IdCard")=IdCard
		rs("BornDate")=BornDate
		rs("Sex")=Sex
		rs("Age")=Age
		rs("Province")=Province
		rs("City")=City
		rs("Education")=Education
		rs("InCome")=InCome
		rs("Tel")=Tel
		rs("Mobile")=Mobile
		rs("QQ")=QQ
		rs("MSN")=MSN
		rs("HomePage")=HomePage
		rs("Address")=Address
		rs("PostCode")=PostCode
		rs("Demons")=Demons
		rs("Photo")=Photo
		rs.update
	end if
	rs.close
	set rs=nothing
end sub
sub mod_personalinfo
	dim rs,userinfo,sql
	sql="select * from t_member where id="&id
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,3,1
	if not rs.eof then		
%>
<form id="PostForm" name="PostForm" method="post" action="?act=do&id=<%=id%>">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr>
    <td height="28" colspan="2" class="th_title">会员信息</td>
  </tr>
  <tr>
    <td width="18%" class="td_row">邮箱：</td>
    <td width="82%" class="td_row"><input name="Email" type="text" value="<%=rs("Email")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">姓名：</td>
    <td class="td_row"><input name="UserName" type="text" value="<%=rs("UserName")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">身份证：</td>
    <td class="td_row"><input name="IdCard" type="text" value="<%=rs("IdCard")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">生日：</td>
    <td class="td_row"><input name="BornDate" type="text" value="<%=rs("BornDate")%>" onClick="displayCalendar(this,'yyyy-mm-dd',this)" readonly="true" /></td>
  </tr>
  <tr>
    <td class="td_row">性别：</td>
    <td class="td_row"><input name="Sex" type="radio" value="男" <%if(rs("Sex")="男") then response.Write("checked=""checked""") end if%> />
男
  <input name="Sex" type="radio" value="女" <%if(rs("Sex")="女") then response.Write("checked=""checked""") end if%> />
女</td>
  </tr>
  <tr>
    <td class="td_row">年龄：</td>
    <td class="td_row"><input name="Age" type="text" id="Age" value="<%=rs("Age")%>" size="8" onblur="checkint(this)" /></td>
  </tr>
  <tr>
    <td class="td_row">省市：</td>
    <td class="td_row">
	<select name="Province" id="Province" onchange="selectcity(this.options[this.selectedIndex].value,'')">
     <%=getProvinceOptions(rs("Province"))%>
    </select>
	<select name="City">
	</select>
	<script type="text/javascript">
selectcity("<%=rs("Province")%>","<%=rs("City")%>");	
	</script>	</td>
  </tr>
  <tr>
    <td class="td_row">教育程度：</td>
    <td class="td_row"><input name="Education" type="text" value="<%=rs("Education")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">从事职业：</td>
    <td class="td_row"><input name="Profession" type="text" value="<%=rs("Profession")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">收入：</td>
    <td class="td_row"><input name="InCome" type="text" value="<%=rs("InCome")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">电话：</td>
    <td class="td_row"><input name="Tel" type="text" value="<%=rs("Tel")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">手机：</td>
    <td class="td_row"><input name="Mobile" type="text" value="<%=rs("Mobile")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">QQ：</td>
    <td class="td_row"><input name="QQ" type="text" value="<%=rs("QQ")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">MSN:</td>
    <td class="td_row"><input name="MSN" type="text" value="<%=rs("MSN")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">个人主页：</td>
    <td class="td_row"><input name="HomePage" type="text" value="<%=rs("HomePage")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">住址：</td>
    <td class="td_row"><input name="Address" type="text" value="<%=rs("Address")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">邮编：</td>
    <td class="td_row"><input name="PostCode" type="text" value="<%=rs("PostCode")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">个人简介：</td>
    <td class="td_row"><textarea name="Demons" id="Demons" rows="5" style="width:98%;"><%=rs("Demons")%></textarea></td>
  </tr>
  <tr>
    <td class="td_row">&nbsp;</td>
    <td class="td_row"><input type="submit" name="Submit" value="确 定" />
      <input type="reset" name="Submit2" value="取 消" /></td>
  </tr>
</table>
</form>
<%
	end if
	rs.close
	set rs=nothing
end sub
function getProvinceOptions(province)
	dim ifselect,rs,sql
	sql="select ZID,ZName from t_province order by ZID asc"
	Set rs = conn.Execute(sql)
	if rs.eof then
		getProvinceOptions="<option value=""0"">暂时没有记录</option>"&Chr(13)
	else
		'getSpecialSelect="<option value=""0"">不属任何专题</option>"&Chr(13)
		while not rs.eof
			if(rs(1)=province) then
				ifselect=" selected"
			else
				ifselect=""
			end if
			getProvinceOptions=getProvinceOptions&"<option value="""&rs(1)&""" "&ifselect&">"&rs(1)&"</option>"&Chr(13)
			rs.movenext
		wend
	end if
	rs.close
	set rs=nothing
end function
%>
</body>
</html>
<%
call connclose()
%>