<!--#include file="conn.asp"-->
<!--#include file="../fuction.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="../webconfig.asp"-->

<!--#include file="../webtop.asp"-->

<table width="1000" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="6" colspan="3"></td>
  </tr>
  <tr>
    <td width="20"></td>
    <td valign="bottom"><img src="<%=weburl%>images/arrow01.gif" width="11" height="11" /> Your present position: <a href="<%=weburl%>"><%=webname%></a> -> <span class="table-shangxia"><span class="b14"><a href=index.asp><%=bbsname%></a> → 修改我的资料</span></span></td>
    <td valign="bottom"></td>
  </tr>
  <tr>
    <td height="6" colspan="3"></td>
  </tr>
</table>
<!--#include file="top.asp"-->
<% 
username=nosql(session("username"))
password=nosql(session("userpassword"))
if username="" or password="" then
response.redirect"login.asp"
end if
set rs=server.createobject("adodb.recordset")
    sql="select * from shop_user  where username='" &username& "'  "
    rs.open sql,conn,1,1
dim save
save=Request.Form("save")
select case save
case "save"
password=trim(replace(Request.Form("password"),chr(9),""))
email=trim(replace(Request.Form("email"),chr(9),""))
sex=replace(Request.Form("sex"),chr(9),"")
repass=replace(Request.Form("repass"),chr(9),"")
ask=trim(replace(Request.Form("ask"),chr(9),""))
anser=trim(replace(Request.Form("anser"),chr(9),""))
qianming=HTMLEncode(Request.Form("qianming"))
pic=trim(replace(Request.Form("pic"),chr(9),""))
oicq=trim(replace(Request.Form("oicq"),chr(9),""))
email=trim(replace(Request.Form("email"),chr(9),""))

if 	password<> "" then	
if  strLength(password)<cint("5") or  strLength(password)>Cint("14") then
response.write"<script language='javascript'>alert('密码必须介于5到14个字符之间，且不得包含特殊符号！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
Response.End
end if
if password<>repass then
response.write"<script language='javascript'>alert('密码和确认密码不一致！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
Response.End
end if

end if
		
if IsValidEmail(trim(request("email")))=false Then
response.write"<script language='javascript'>alert('请正确填写你的电子邮件')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
Response.End
end if
	set rs1=server.createobject("adodb.recordset")
    sql="select * from shop_user  where username='" &username& "'  "
    rs1.open sql,conn,3,3
    if not password="" then
rs1("userpassword")=md5(password)
end if
rs1("UserEmail")=email
rs1("sex")=sex
rs1("Quesion")=ask
if not anser="" then
rs1("Answer")=md5(anser)
end if
rs1("content")=qianming
rs1("oicq")=oicq
rs1("pic")=pic
rs1("userlastip")=Request.ServerVariables("REMOTE_ADDR")
rs1.Update



session("username")=rs("username")                  
session("userpassword")=rs("userpassword") 
session("pic")=rs("pic")  
 response.write"<script language='javascript'>alert('修改成功！')</script>"
response.write "<script language='javascript'>window.location='index.asp'</script>"

case else
%>
<body topmargin="0" leftmargin="0">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td valign="top">
            <p>&nbsp;</p><%set rs=server.createobject("adodb.recordset")
    sql="select * from shop_user  where username='" &username& "'  "
    rs.open sql,conn,1,1%>
            <table width="90%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999">
              <form method="POST" action="myinfo.asp"  name="forms" >
                <tr bgcolor="#CCCCCC">
                  <td width="191" height="31" align="left"><div align="right">
                      <p align="center">用户昵称：<br>
                  </div></td>
                  <td width="509" height="31">
                  <p>&nbsp;<strong><font color="#FF0000"> </font></strong><strong><input type="hidden" name="save" value="save"> <%=session("username")%></strong></p></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="31" align="left"><div align="right">
                      <p align="center">用户密码：<br>
                  </div></td>
                  <td width="509" height="31"><input name="password" type="password" class="wenbenkuang" size="20">
&nbsp; </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="31" align="left"><div align="right">
                      <p align="center">确认密码：            
                  </div></td>
                  <td width="509" height="31"><input name="repass" type="password" class="wenbenkuang" size="20">
&nbsp; </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="32" align="left"><div align="right">
                      <p align="center">用户性别：            
                  </div></td>
                  <td width="509" height="32">
                    <% if rs("sex")=1 then %>
                    <input type="radio" name="sex" value="1" checked>
        男孩
        <input type="radio" name="sex" value="2" >
        女孩
        <input name="sex" type="radio" value="3" >
        保密
        <%elseif rs("sex")=2 then%>
        <input type="radio" name="sex" value="2" checked>
        女孩
        <input type="radio" name="sex" value="1" >
        男孩
        <input name="sex" type="radio" value="3" >
        保密
        <%else%>
        <input name="sex" type="radio" value="3" checked>
        保密
        <input type="radio" name="sex" value="1" >
        男孩
        <input type="radio" name="sex" value="2" >
        女孩
        <%end if%></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="32" align="left"><div align="right">
                      <p align="center">密码问题：<br>
                  </div></td>
                  <td width="509" height="32"><input name="ask" class="wenbenkuang" size="20" value="<%=rs("Quesion")%>">
&nbsp;</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="32" align="left"><div align="right">
                      <p align="center">问题答案：<br>
                  </div></td>
                  <td width="509" height="32"><input name="anser" class="wenbenkuang" size="20">
&nbsp;</td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="32" align="left">
                  <p align="center">用户 QQ：</td>
                  <td width="509" height="32">
                  <input name="oicq" class="wenbenkuang" size="20" value="<%=rs("oicq")%>"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="32" align="left"><div align="right">
                  <p align="center">用户邮箱：
                  </div></td>
                  <td width="509" height="32">
                  <input name="email" class="wenbenkuang" size="20" value="<%=rs("useremail")%>"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="20">
                  <p align="center">我的头像：</td>
                  <td width="509" height="20">
                    <input type="text" name="pic" value="<%=rs("pic")%>" readonly style="width:200px" class="wenbenkuang" onClick="this.readOnly=false;this.value='http://';this.focus();" size="20">                  
                  <input name="button" type="button" class="go-wenbenkuang" onClick="window.open('allFace.asp','touxian','width=520,height=415,menubar=no,toolbar=no,scrollbars=yes,location=no')" value="选择头像"></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="191" height="62">
                  <p align="center">我的签名：</td>
                  <td width="509" height="62"><textarea name="qianming" cols="60" rows="6" class="wenbenkuang"><%=rs("content")%></textarea>                  </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="27" colspan="2">
                    <p align="center">
                      <input type="submit" value="提交修改" name="B1" class="go-wenbenkuang">　
                      <input type="reset" value="全部重写" name="B2" class="go-wenbenkuang">
                    </p></td>
                </tr>
              </form>
            </table>            
            <p>
              <%                                                                                    
end select                                                                                    
%>
          </p></td>
        </tr>
    </table></td>
  </tr>
</table>
<!--#include file="../copyright.asp"-->             