<!--#include file="../Include/Conn.jsp" -->
<!--#include file="../Include/Char.jsp" -->
<!--#include file="../Include/const.jsp" -->

<%
   if Request.Cookies("UserID") = ""  THEN
     Response.Redirect("Login.jsp")
	 Response.End()
   end if
   
  ID =  Request.Cookies("UserID")
  oldpwd = CheckStr(Request("oldpwd"))
  Newpwd1 = CheckStr(Request("Newpwd1"))
  Newpwd2 = CheckStr(Request("Newpwd2"))

  if CheckStr(Request("update")) = "OK" then
    if Oldpwd = ""  OR Newpwd1 = "" OR Newpwd2 = "" then
       msbox = "密码框不能为空"
	elseif Newpwd1 <> Newpwd2 then
	   msbox = "新密码不一致"
	else
      SET rs=server.createobject("adodb.recordset")
      SQL="SELECT * FROM  CityCard_League WHERE CompanyID ="&ID  
      rs.Open SQL,conn,1,1 
	  if rs.eof then 
	     msbox = "对不起，不存在"	  
	  elseif rs("password") <> Oldpwd then
	     msbox = "旧密码不正确"
	  else
	    SQL="UPDATE CityCard_League SET password ='"& Newpwd1 &"' WHERE CompanyID='"& ID &"'"
        Conn.Execute SQL
	    msbox = "修改成功"
		Response.Write "<meta HTTP-EQUIV=REFRESH CONTENT='2; URL=index.jsp'>"
	  end if
	end if
  end if	
	


%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=site_info(0)%>-商家管理系统</title>
<link href="../Include/Style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
</head>

<body onLoad="MM_preloadImages('images/xf_link1b.gif','images/xf_link2b.gif','images/xf_link3b.gif','images/xf_link4b.gif','images/xf_link5b.gif','images/ly_b_2b.gif','images/ly_b_4b.gif','images/ly_b_1b.gif','images/ly_b_3b.gif','images/ly_b_5b.gif')">

<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td width="170" height="500" valign="top" bgcolor="f5f5f5">
      <!--#include file="Left.jsp" -->
    </td>
    <td width="10" valign="top"></td>
    <td width="600" valign="top">
      <table width="600" border="1" cellpadding="0" cellspacing="5" bordercolor="e2e2e2" bgcolor="f5f5f5">
        <tr> 
          <td height="25" background="images/about_bj.gif" class="p4">&nbsp;<b>·密码修改</b> 
          </td>
        </tr>
      </table>
      <table width="600" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td height="5"></td>
        </tr>
        <tr> 
          <td height="1" background="images/line.gif" ></td>
        </tr>
      </table>
      <br>
      <br>
      <br>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center"><font color=ff0000><%=msbox%></font></div></td>
        </tr>
      </table>
      <br>
      <br>
      <table width="82%" height="48" border="0" align="center" cellpadding="4" cellspacing="0">
        <tr bgcolor="f5f5f5"> 
          <th colspan="2"><div align="center">密码修改</div></th>
        </tr>
        <form name="form1" method="post" action="?update=OK">
          <tr> 
            <td width="13%" height="24" bgcolor="#FFFFFF">旧密码：</td>
            <td width="87%" bgcolor="#FFFFFF"><input name="Oldpwd" type="password" id="Oldpwd">
              <font color="#FF0000">*</font></td>
          </tr>
          <tr> 
            <td height="24" bgcolor="#FFFFFF">新密码：</td>
            <td bgcolor="#FFFFFF"><input name="NewPwd1" type="password" id="NewPwd1" maxlength="12">
              <font color="#FF0000">*</font></td>
          </tr>
          <tr> 
            <td height="24" bgcolor="#FFFFFF">确　认：</td>
            <td bgcolor="#FFFFFF"><input name="NewPwd2" type="password" id="NewPwd2" maxlength="12">
              <font color="#FF0000">*</font></td>
          </tr>
          <tr>
            <td height="24" bgcolor="#FFFFFF">&nbsp;</td>
            <td bgcolor="#FFFFFF"><input type="submit" name="Submit" value="修　改">
              <input type="reset" name="Submit2" value="重　来"></td>
          </tr>
        </form>
      </table>
    </td>
  </tr>
</table>

</body>
</html>
