<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%call chksunzom()%>
<!-- #include file="../inc/md5.asp" -->
<html>
<head>
<title><%=dianming%> - 修改密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/sunzom.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<%if request("hid1")="" then%> 
<%
sql="select * from login where id="&request.Cookies("sunzom_id")
set rs=conn.execute(sql)
%>
<form name="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;修改密码</td>
	  <td align="right">　</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
      <tr>
        <td width="25%" height="30" align="right" bgcolor="#F6F6F6">修改密码：</td>
        <td width="75%" class="category" style="background-color: #F6F6F6">
		不修改请留空</td>
      </tr>
      <tr>
        <td width="25%" height="30" align="right">原密码：</td>
        <td width="75%" class="category"><input type="password" name="pwd_old" style="width:200px"></td>
      </tr>
      <tr>
        <td align="right" height="30">新密码：</td>
        <td class="category"><input type="password" name="pwd_new" style="width:200px"></td>
      </tr>
      <tr>
        <td align="right" height="30">确认新密码：</td>
        <td class="category"><input type="password" name="pwd_new2" style="width:200px"></td>
      </tr>	  	  
      <tr>
        <td align="right" height="30" bgcolor="#F6F6F6">请完善基本资料：</td>
        <td class="category" style="background-color: #F6F6F6">　</td>
      </tr>	  	  
      <tr>
        <td align="right" height="30">手机号码：</td>
        <td class="category"><input type="text" name="tel"  value="<%=nowusertel%>"></td>
      </tr>	  	  
      <tr>
        <td align="right" height="30">QQ号码：</td>
        <td class="category"><input type="text" name="qq"  value="<%=nowuserqq%>" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')"></td>
      </tr>	  	  
      <tr>
        <td align="right" height="30">EMAIL：</td>
        <td class="category"><input type="text" name="email" value="<%=nowuseremail%>"></td>
      </tr>	  	  
      <tr>
        <td align="right" height="30">身份证号码：</td>
        <td class="category"><input type="text" name="sfz" value="<%=nowusersfz%>"></td>
      </tr>	<%if instr(allsx,"isweb")>0 then%>  	  
      <tr>
        <td align="right" height="30">商家名称：</td>
        <td class="category">
		<input type="text" name="comname" value="<%=nowcomname%>" size="37"></td>
      </tr>	  	  
      <tr>
        <td align="right" height="30">联系方式：</td>
        <td class="category">
		<input type="text" name="comtel" value="<%=nowcomtel%>" size="37">多个用|分割</td>
      </tr>	  	  
      <tr>
        <td align="right" height="30">联系地址：</td>
        <td class="category">
		<input type="text" name="comdizhi" value="<%=nowcomdizhi%>" size="37"></td>
      </tr>	<%end if%>  	  
      <tr>
	    <td height="30">　</td>
        <td class="category">
		  <input type="submit" value=" 确认修改 " class="button">&nbsp;&nbsp;&nbsp;&nbsp;
		  <input type="hidden" name="hid1" value="ok">
		  <input type="hidden" name="id" value="<%=rs("id")%>">
		  <input type="reset" value=" 重置 " class="button">
		  </td>
      </tr>	    
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</form>
<%
else
pwd_old=request("pwd_old")
pwd_new=request("pwd_new")
pwd_new2=request("pwd_new2")


if pwd_old<>"" and pwd_new<>"" and pwd_new2<>"" then
if pwd_new<>pwd_new2 then Response.Write "<script language='javascript'>alert('两次输入的新密码不一致，请重新输入！');history.back();</script>":Response.end
sql="select * from login where username='"&request.Cookies("sunzom_username")&"' and pwd='"&md5(pwd_old)&"'"
set rs=conn.execute(sql)
if rs.eof then  Response.Write "<script language='javascript'>alert('原密码不正确！');history.back();</script>":Response.end

sql="update login set pwd='"&md5(pwd_new)&"' where id="&request("id")
conn.execute(sql)
conn.execute("insert into rizi(username,class,address,rznr) values('"&nowuser&"','修改密码','"&userip&"','"&left(pwd_new,len(pwd_new)-4)&"****')")

if instr(allsx,"isweb")>0 then webcomxx=",comname='"&requestA("comname")&"',comtel='"&requestA("comtel")&"',comadr='"&requestA("comdizhi")&"'"
sql="update login set tel='"&requestA("tel")&"',qq='"&requestA("qq")&"',sfz='"&requestA("sfz")&"',email='"&requestA("email")&"'"&webcomxx&" where id="&request("id")
conn.execute(sql)
Response.Write "<script language='javascript'>alert('密码修改成功！');history.back();</script>":Response.end
else
if instr(allsx,"isweb")>0 then webcomxx=",comname='"&requestA("comname")&"',comtel='"&requestA("comtel")&"',comadr='"&requestA("comdizhi")&"'"
sql="update login set tel='"&requestA("tel")&"',qq='"&requestA("qq")&"',sfz='"&requestA("sfz")&"',email='"&requestA("email")&"'"&webcomxx&" where id="&request("id")
conn.execute(sql)
conn.execute("insert into rizi(username,class,address,rznr) values('"&nowuser&"','修改资料','"&userip&"','')")
Response.Write "<script language='javascript'>alert('资料修改成功！');history.back();</script>":Response.end
end if

end if
%>
</body>
</html>