<!--#include file="conn.asp"-->
<%
page_title=Eval("about_title"&Language)
page_keywords=Eval("about_keywords"&Language)
page_description=Eval("about_description"&Language)
if page_title="" then
page_title=city_title
page_keywords=city_keywords
page_description=city_description
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=page_title%></title>
<meta name="keywords" content="<%=page_keywords%>" />
<meta name="description" content="<%=page_description%>" />
<!--#include file="top.asp"-->
<!--#include file="header.asp"-->
<%
if session("user_xxx_name")="" then
response.Redirect("login.asp")
end if
%>
<link href="<%=filepath%>inc/mycenter.css" type="text/css" rel="stylesheet">
<link href="<%=filepath%>inc/style.css" type="text/css" rel="stylesheet">
<link href="<%=filepath%>inc/user.css" type="text/css" rel="stylesheet">

    <div id="wrap">
        <!--container-->
        <div class="main">
            
<!--sidebar-->
<!--#include file="Mb_left.asp"-->

<script type="text/javascript">
                try
                {
                    document.getElementById("User_Profile").className = "current"; //控制CSS
                }
                catch(e){}
</script>

<!--sidebar end-->
<%dim action,username
action=request.QueryString("action")
username=session("user_xxx_name")
select case action
'//用户资料
case "set"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [com_user] where username='"&username&"'",conn,1,3
'rs("useremail")=trim(request("useremail"))
rs("user_01")=request("realName")
rs("usersex")=request("gender")
rs("user_03")=request("address")
rs("user_04")=request("postcode")
rs("user_05")=request("mobile")
rs("user_06")=request("homePhone")
'rs("useremail")=request("email")
rs("wangWang")=request("wangWang")
rs("qq")=request("qq")
rs("birthday")=request("birthday")
rs("provinceId")=request("provinceId")
rs("cityId")=request("cityId")
rs("countyId")=request("countyId")

rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('您的个人资料修改成功！');window.location.href='Profile.asp';</script>"
response.end

case "savepass"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [com_user] where username='"&username&"'",conn,1,3
'if md5(trim(request("userpassword")))<>trim(rs("userpassword")) then
'response.Write "<script language=javascript>alert('对不起，您输入的原密码错误！');history.go(-1);<-/script>"
'response.End
'else
if trim(request("userpassword"))<>"" then
rs("userpassword")=md5(trim(request("userpassword")))
end if
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('密码更改成功！');window.location.href='"&request.servervariables("http_referer")&"';</script>"
response.End
'end if


'//取回密码
case "repass"
set rs=server.CreateObject("adodb.recordset")
rs.open "select userpassword from [com_user] where username='"&trim(request("username2"))&"'",conn,1,3
rs("userpassword")=md5(trim(request("userpassword2")))
rs.update
rs.close
set rs=nothing
response.Write "<script language=javascript>alert('您的密码取回成功，请登陆！');history.go(-1);</script>"

case "regist"
response.Write "<script language=javascript>alert('恭喜您注册成功，请完善用户资料，谢谢！');</script>"

end select
%>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [com_user] where username='"&session("user_xxx_name")&"' ",conn,1,1
%>
            <!--main-->
			<form id="myform" action="?action=set" method="post">
		<!--main-->
		<div class="mainBox">
			<div class="mainContent myporfile">
				<h3 class="mainContent_title" style="margin-bottom: 15px">
					<span>我的信息</span>
				</h3>
				<!--内容-->

				<p class="tips">
					帮助我们完善您的个人信息，有助于我们未来根据您的情况提供更加个性化的服务；我们会对您的个人资料隐私加以保密。</p>
				<dl>
					<dt>
						<span class="star">*</span>姓名：
					</dt>
					<dd>
						<input value="<%=rs("user_01")%>" name="realName" type="text" id="realName" maxlength="50" class="input"> <span id="WrongRealName" style="display: none" class="wrongtext">请填写您的姓名，长度不超过20个字符！</span>
					</dd>
					<dt>
						<span class="star">*</span> 性别：
					</dt>
					<dd>
						<span id="rblGender"><input id="rblGender_0" type="radio" name="gender" value="0" <%if rs("Usersex")=0 then%> checked="checked"<%end if%>><label for="rblGender_0">男</label><input id="rblGender_1" type="radio" name="gender" value="1" <%if rs("Usersex")=1 then%> checked="checked"<%end if%>><label for="rblGender_1">女</label></span>
					</dd>
					<dt>
						<span class="star">*</span> Email：
					</dt>
					<dd>
						<input name="email" type="text" id="email" maxlength="50" class="input" value="<%=rs("useremail")%>" disabled="disabled"><span style="color: Red"> 填写正确后，邮箱不可修改！</span> <span id="WrongEmail" style="display: none" class="wrongtext">Email格式错误</span>
					</dd>
					<dt>
						<span class="star">*</span> 手机：
					</dt>
					<dd>
						<input value="<%=rs("user_05")%>" name="mobile" type="text" id="mobile" class="input" maxlength="11"><span style="color: Red">
							用于接收发货通知短信及送货前确认</span> <span id="WrongMobile" style="display: none" class="wrongtext">手机格式错误</span>
					</dd>
					<dt style="">
						<span class="star">*</span> 居住城市：
					</dt>
					<dd>
	<select id="provinceId" name="provinceId" ></select>&nbsp;&nbsp;
    <select id="cityId" name="cityId" ></select>&nbsp;&nbsp;
    <select id="countyId" name="countyId"></select>
	
    <script type="text/javascript" src="../inc/area_all.js"></script>
    <script type="text/javascript">
	<%if rs("provinceId")<>"" then%>
	var opt0 = ["<%=rs("provinceId")%>","<%=rs("cityId")%>","<%=rs("countyId")%>"];
	<%else%>
	var opt0 = ["省份","地级市","市、县级市"];//初始值
	<%end if%>
	_init_area();</script>

					</dd>
					<dt>
						<span class="star">*</span> 地址：
					</dt>
					<dd>
						<input value="<%=rs("user_03")%>" name="address" type="text" id="address" class="input" style="width: 280px"> <span id="WrongAddress" style="display: none" class="wrongtext">请填写您的详细地址</span>
					</dd>
					<dt>
						<span class="star">*</span> 邮政编码：
					</dt>
					<dd>
						<input value="<%=rs("user_04")%>" name="postcode" type="text" id="postcode" maxlength="6" class="input" onblur="CheckOnBlur(this.id)">
						<span id="WrongPostalCode" style="display: none" class="wrongtext">邮政编码必须是6位数字</span>
					</dd>
				</dl>
				<div class="SpanDiv">
					<ul>
						<li><span class="SpanDivContent">以下为选填信息</span></li>
					</ul>
				</div>
				<dl id="detailInfo">

					<dt>旺旺：</dt>
					<dd>
						<input value="<%=rs("wangWang")%>" name="wangWang" type="text" id="wangWang" class="input" maxlength="50">
					</dd>
					<dt>QQ：</dt>
					<dd>
						<input value="<%=rs("qq")%>" name="qq" type="text" id="qq" class="input" maxlength="13">
					</dd>
					<dt>出生年月：</dt>
					<dd>
						<input value="<%=rs("birthday")%>" name="birthday" type="text" id="birthday" class="input Wdate hasDatepicker" maxlength="15">
					</dd>
					<dt>固定电话：</dt>
					<dd>
						<input value="<%=rs("user_06")%>" name="homePhone" type="text" id="homePhone" class="input" maxlength="20"> <span id="WrongPhone" style="display: none" class="wrongtext">固定电话格式错误</span>
					</dd>
				</dl>
				<p class="btns" style="padding-top: 20px; padding-bottom: 20px;">

					<span><input type="submit" name="btnConfirm" value=" 保 存 " onclick="return check();" id="btnConfirm" class="btn"></span>
				</p>
<%
rs.close
set rs=nothing
%>
				<!--内容end-->
			</div>
		</div>
		</form>
		<script>
function dataValidator() {

}

dataValidator.isEmail = function(str) {
    var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    return re.test(str);
}


dataValidator.isNumber = function(str) {
    var re = /^\d+$/;
    return re.test(str);
}


dataValidator.isChinese = function(str) {
    var re = /^[\u4e00-\u9fa5]+$/;
    return re.test(str);
}

dataValidator.isMobile = function(str) {
    var re = /^(13|15|16|18)[0-9]{9}$/;
    return re.test(str);
}
dataValidator.isPhone = function(str) {
    var re = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
    return re.test(str);
}
dataValidator.isPostcode = function(str) {
    var re = /^\d{6}$/;
    return re.test(str);
}

dataValidator.isTime = function(str) {
    var re = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;
    return re.test(str);
}

$("#myform").submit(function() {
	var mob = $("#mobile").val();
	if(!dataValidator.isMobile(mob)){
	   alert('请输入正确的手机号');
	   return false;
	}
	var postcode = $("#postcode").val();
	if(!dataValidator.isPostcode(postcode)){
	   alert('请输入6位邮政编号');
	   return false;
	}
	return ture;
});

$(document).ready(function(){

    $( "#birthday" ).datepicker({
        changeMonth: true,
        changeYear: true
    });

	$("#provinceId").change(function(){
		var id=$(this).val();
		var dataString = 'id='+ id;
		
		$.ajax({
			type: "POST",
			url: "address-select.html",
			data: dataString,
			cache: false,
			success: function(html){
				$("#cityId").html(html);
			} 
		});
		$("#countyId").html("<option value='0'>请选择</option>");
	});
	$("#cityId").change(function(){
		var id=$(this).val();
		var dataString = 'id='+ id;
		
		$.ajax({
			type: "POST",
			url: "address-select.html",
			data: dataString,
			cache: false,
			success: function(html){
				$("#countyId").html(html);
			} 
		});
	});
});
</script>
            <!--main end-->
        </div>
        <!--container end-->
        <div class="clr">
        </div>
        

  
<!--#include file="foot.asp"--> 