<!-- #include file="include/config.asp" -->
<!-- #include file="../include/jk_md5.asp" -->
<!-- #include file="../include/jk_user.asp" -->
<%

dim min_len
min_len=dim_num(23)
tit="修改密码"

call web_head(2,0,0,0,0)
'----------------------------左边 开始----------------------------
call user_left(1)
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td colspan=3>&nbsp;<%response.write img_skin("m_user")%>修改我（<%response.write login_username%>）的密码信息</td></tr>
<%
if joekoe_cms.chk() then
  call user_pass_chk()
else
  call user_pass_main()
end if
%>
</table>
<%
response.write ukong
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub user_pass_chk()
  dim password,password1,password2,passwd,found_err
  password=trim(request.form("password"))
  password1=trim(request.form("password1"))
  password2=trim(request.form("password2"))
  passwd=trim(request.form("passwd"))
  found_err=""
  if symbol_ok(password)=false then
    found_err=found_err&"+您输入的 <font class=red>登陆密码</font> 为空或不符合相关规则！<br>"
  end if
  if symbol_ok(password1)=false then
    found_err=found_err&"+您输入的 <font class=red>新 密 码</font> 为空或不符合相关规则！<br>"
  else
    if password1<>password2 then
      found_err=found_err&"+您输入的 <font class=red>新 密 码</font> 和 <font class=red>确认密码</font> 不一致！<br>"
    else
      if int(len(password1))<int(min_len) then
        found_err=found_err&"+您输入的 <font class=red>新 密 码</font> 长度不能少于 <font class=red>"&min_len&"</font> 位！<br>"
      end if
    end if
  end if
  if passwd<>"" then
    if symbol_name(passwd)=false then
      found_err=found_err&"+您输入的 <font class=red>密码钥匙</font> 不符合相关规则！<br>"
    end if
  end if
  if found_err="" then
    sql="select top 1 password,passwd from user_data where id="&login_id&" and password='"&jk_md5(password,"short")&"'"
    rs.open sql,conn,1,3
    if rs.eof then
      found_err=found_err&"+您输入的 <font class=red>登陆密码</font> 在登陆验证时失败！<br>"
    end if
    rs.close
  end if
  if found_err<>"" then
    response.write vbcrlf&"<tr><td colspan=3 class=tr align=center height=200>" & _
		   found_error(found_err,280) & _
		   vbcrlf&"</td></tr>"
    exit sub
  end if
  password1=jk_md5(password1,"short")
  sql="update user_data set password='"&password1&"'"
  if passwd<>"" then
    sql=sql&",passwd='"&jk_md5(passwd,"short")&"'"
  end if
  sql=sql&" where id="&login_id
  conn.execute(sql)
  response.cookies(joekoe_cms.web_cookies)("login_password")=jk_encrypt(password1)
  call web_js_msg(1,"您已成功修改了您密码信息！","user_main.asp")
end sub

sub user_pass_main()
%>
<form name=user_edit_frm action='?' method=post onsubmit="javascript:frm_submitonce(this);">
<input type=hidden name=chk value='yes'>
<tr class=tr>
<td <%response.write dd1%>>登陆密码：</td>
<td <%response.write dd2%>><input type=password name=password size=25 maxlength=20><%response.write redx%></td>
</tr>
<tr class=trb>
<td>新 密 码：</td>
<td><input type=password name=password1 size=25 maxlength=20><%response.write redx%></td>
</tr>
<tr class=trb>
<td>重复密码：</td>
<td><input type=password name=password2 size=25 maxlength=20><%response.write redx%></td>
</tr>
<tr class=tr>
<td>密码钥匙：</td>
<td><input type=text name=passwd size=25 maxlength=20>&nbsp;如不想修改此值可以不填</td>
</tr>
<!--
<tr class=tr>
<td>修改邮箱：</td>
<td><input type=text name=email size=40 maxlength=50>&nbsp;如不想修改此值可以不填</td>
</tr>
-->
<tr class=trb height=30>
<td></td>
<td><input type=submit class=btn value=' 提 交 修 改 '>　　　<input type=reset class=btn value='重新填写'></td>
</tr>
</form>
<%
end sub
%>
