⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 savepwd.asp

📁 一套很早的多用户电子商务程序
💻 ASP
字号:
<!--#include file="bkconn.asp"-->
<!--#include file="inc/chkStr.inc"-->
<!--#include file="inc/char.inc"-->
<%
   dim sql
   dim rs
   dim sid
   dim spwd
   dim snpwd
   dim srnpwd 
   dim foundError
   dim errorMsg
   call getInput()
   call chkInput()

   if foundError then
      call showErrors()
   else
      saveData()
      if foundError then
         call showErrors()
      else
          response.redirect "pwdshow.asp?id=" & sid & "&pwd=" & snpwd
      end if
   end if
   set rs=nothing  
   conn.close
   set conn=nothing

   

   sub saveData()
       on error resume next
       dim updasql
       updasql="UPDATE  Users  SET pwd='" &snpwd & "' Where ID='" & sID & "' And Pwd = '" & sPwd & "'"
       conn.Execute updasql
       if err>0 then 
          err.clear
          foundError=true
          ErrorMsg="<li>服务器数据库操作失败!</li>"
       end if
   end sub

   sub chkInput()
   if snpwd=""  or srnpwd="" then
       foundError=true
       ErrorMsg=ErrorMsg+"<br>●“新密码”或“确认密码”不能为空白!"
   else
       if snpwd<>srnpwd then
          foundError=true
          ErrorMsg=ErrorMsg+"<br>●“新密码”和“确认密码”必须相同!" 
       else
          if Len(snpwd)>12 or Len(snpwd)<3 then
             foundError=true
             ErrorMsg=ErrorMsg+"<br>●“新密码”长度应在3到12之间!" 
          else
             Set rs = Server.CreateObject("ADODB.Recordset")
             strSQL =  " Select * From users Where ID='" & sID & "' And Pwd = '" & sPwd & "'"
             rs.Open strSQL,conn
             if rs.eof or rs.bof then 
                foundError=true
                ErrorMsg=ErrorMsg+"<br>●“用户名”和“密码”有错误!" 
             end if
          end if
       end if
   end if
   end sub

   sub getInput()
       if iis3onchsys=true then
          sid=HTMLCharacter(request("txtid"))&""
          spwd=HTMLCharacter(request("txtpwd"))&""
          snpwd=HTMLCharacter(request("txtnpwd"))&""
          srnpwd=HTMLCharacter(request("txtrnpwd"))&""
     else
          sid=request("txtid")&""
          spwd=request("txtpwd")&""
          snpwd=request("txtnpwd")&""
          srnpwd=request("txtrnpwd")&""
     end if
   end sub

   sub showErrors()
%>
<html>

<head>
<title>密码修改错误</title>
</head>

<body background="002.gif">
<p><span style="font-size: 9pt"><font color="#FF0000">发现输入过程中有错误,请按下列提示检查:<br>
</font><font color="#0080FF"><%=ErrorMsg%></span> </font></p>

<form method="POST" action="savepwd.asp" name="spwd">
  <div align="center"><center><p><font size="3" color="#408080">修改密码</font></p>
  </center></div><div align="center"><center><table border="1" width="211" bgcolor="#F1D89C"
  bordercolordark="#FFFFFF" bordercolor="#FFFFFF" bordercolorlight="#C0C0C0">
    <tr>
      <td width="68" align="center"><span style="font-size: 9pt">用 户 名</span></td>
      <td width="131" align="center"><span style="font-size: 9pt"><input class="smallInput"
      type="text" name="txtid" size="12" style="font-family: aa; font-size: 9pt"  value="<%=htmlencode2(sid)%>"></span></td>
    </tr>
    <tr>
      <td width="68" align="center"><span style="font-size: 9pt">原 密 码</span></td>
      <td width="131" align="center"><span style="font-size: 9pt"><input class="smallInput"
      type="text" name="txtpwd" size="12" style="font-family: aa; font-size: 9pt"  value="<%=htmlencode2(spwd)%>"></span></td>
    </tr>
    <tr>
      <td width="68" align="center"><span style="font-size: 9pt">新 密 码</span></td>
      <td width="131" align="center"><span style="font-size: 9pt"><input class="smallInput"
      type="text" name="txtnpwd" size="12" style="font-size: 9pt" value="<%=htmlencode2(snpwd)%>"></span></td>
    </tr>
    <tr>
      <td width="68" align="center"><span style="font-size: 9pt">确认密码</span></td>
      <td width="131" align="center"><span style="font-size: 9pt"><input class="smallInput"
      type="text" name="txtrnpwd" size="12" style="font-size: 9pt" value="<%=htmlencode2(srnpwd)%>"></span></td>
    </tr>
  </table>
  </center></div><div align="center"><center><p><font color="#400040"><input type="submit"
  value="存储密码" class="ee" name="cmdOk" style="font-size: 9pt"> <input type="reset"
  value="清空内容" name="cmdReset" class="ee" style="font-size: 9pt"> </font><input
  type="button" value="放弃修改" name="cmdExit" style="font-size: 9pt"
  OnClick=" URL='book.asp' "></p>
  </center></div>
</form>
</body>
</html>
<%end sub%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -