<!--#include file="conn.asp"-->
<!--#include file="md5.asp"-->
<title>修改密码</title>
<body>


<% 
if session("Empleadoid")="" then
response.write("<script>window.location.href='login.asp';</script>") 
response.End()
end if
conn.open Str
sql = "select * from Empleado where Empleadoid='"&session("Empleadoid")&"'"
set rs = conn.execute(sql)
if  request.QueryString("ac")="cambia" and md5(request.Form("pass"))<>rs("Contrasena") then
response.write("<script>alert('原始密码错误，请检查！\nContrasena original incorecto!');window.location.href='cambiapass.asp';</script>") 
response.End()
else
pass="1"
 end if
 
if request.QueryString("ac")="cambia" and request.Form("newpass1")="" and request.Form("newpass2")="" then
response.write("<script>alert('新密码不能为空！\nContrasena nueva no puede dejar en blanco!');window.location.href='cambiapass.asp';</script>")   
response.End()  
end if
 
if  request.QueryString("ac")="cambia" and request.Form("newpass1")<>request.Form("newpass2") then
response.write("<script>alert('新密码不一致！\nNueva contrasena inconsistente!');window.location.href='cambiapass.asp';</script>")   
response.End()
end if

if  request.QueryString("ac")="cambia" and request.Form("newpass1")=request.Form("newpass2") and pass="1" then
set cambiapass=conn.execute("update Empleado set Contrasena='"& md5(request.Form("newpass1")) &"' where Empleadoid='"&session("Empleadoid")&"' " ) 
response.write("<script>alert('密码修改成功\nNueva contrasena modificada!');window.location.href='login.asp?ac=exit';</script>")   

response.End()
  conn.close
end if

 %> 


<form id="form1" name="form1" method="post" action="cambiapass.asp?ac=cambia">
 <table width="100%"  height="100" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center"><span class="STYLE2">修改密码</span>
        <br />
        <div align="center" class="STYLE15">MODIFICAR CONTRASENA</div>
    </div></td>
  </tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50"><div align="right">用户名：<br />
    </div>      <div align="center" class="STYLE15">
        <div align="right">USARIO&nbsp;&nbsp;</div>
      </div></td>
    <td height="50"><label>
        <input name="name" type="text" id="name" style=" width:100px;height:25px; font-size:16px;" autocomplete="off" value="<%= session("nombre") %>" readonly="true"/>
        </label></td>
  </tr>
  <tr>
    <td height="50"><div align="right">原密码：<br />
    </div>      <div align="center" class="STYLE15">
        <div align="right">CONTRASENA ORIGINAL&nbsp;&nbsp;</div>
      </div></td>
    <td height="50">
      <label>
        <input name="pass" type="text" id="pass" style=" width:100px;height:25px; font-size:16px;"  autocomplete="off"/>
        </label>
    
    *</td>
  </tr>
  <tr>
    <td height="50"><div align="right">新密码：<br />
    </div>      <div align="center" class="STYLE15">
        <div align="right">CONTRASENA NUEVA&nbsp;&nbsp;</div>
      </div></td>
    <td height="50"><input name="newpass1" type="text" id="newpass1" style=" width:100px;height:25px; font-size:16px;"  autocomplete="off"/>
    *</td>
  </tr>
  <tr>
    <td height="50"><div align="right">确认新密码：<br />
    </div>      <div align="center" class="STYLE15">
        <div align="right">REPIDE CONTRASENA NUEVA&nbsp;&nbsp;</div>
      </div></td>
    <td height="50"><p>
      <input name="newpass2" type="text" id="newpass2" style=" width:100px;height:25px; font-size:16px;"  autocomplete="off" />
      *</p>      </td>
  </tr>
  <tr>
    <td height="100px" colspan="2"><label>
      <div align="center"><a href="#" onClick="document.getElementById('form1').submit();"><img src="img/save.png" width="40" height="40" border="0" /></a></div>
    </label></td>
    </tr>
</table>
</form>
</body>
</html>
<!--#include file="fooder.asp"-->