陶益数码工作室-Dreamweaver开发ASP视频教程
你的位置:首页 >>> 站内帮助 >>> VIP热点问题 >>> 制作会员中心密码修改问题
VIP技术支持中心
欢迎你访问热点问题!我们回答了会员大量的问题,请搜索你想要的 
制作会员中心密码修改问题
问题类型 DW实际开发中的问题 提交时间 2011-08-30 21:09:00
[会员 ken*** 提出的问题如下]

如图:

直接更新是可以的,但是加入以下判断代码后就不行了

 if md5(request("ymm"))<>(Recordset1.Fields.Item("u_pass").Value) then
  Response.Redirect("error6.asp")
  response.End()
  end if

如图:

老师帮忙看看那里出了问题。

源代码如下:

 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="md5.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_update")) = "form1") Then
  If (Not MM_abortEdit) Then 
  if md5(request("ymm"))<>(Recordset1.Fields.Item("u_pass").Value) then
  Response.Redirect("error6.asp")
  response.End()
  end if
    ' execute the update
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_conn_STRING
    MM_editCmd.CommandText = "UPDATE dbo.User_biao SET u_pass = ? WHERE [uid] = ?"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, md5(Request.Form("u_pass"))) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "hyzx_xgzl.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("hy") <> "") Then
  Recordset1__MMColParam = Session("hy")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_conn_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.User_biao WHERE u_name = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 50, Recordset1__MMColParam) ' adVarChar

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="error5.asp"
MM_grantAccess=false
If Session("hy") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
body {
 margin:0; padding:0; color:#B8B8B8;
 background:#282828 url(images/main_bg.gif) 0 0 repeat-x;
 font:normal 12px/14px Arial, Helvetica, sans-serif;
}
div, a, p, img, ul, h1, h2, h3, dl, dt, dd {
 margin:0; padding:0;
}
.spacer {
 font-size:0; line-height:0; clear:both;
}
ul {
 list-style:none;
}
a {
 text-decoration:underline;
}
img {
 border:none;
}
div#body {
 width:780px;
 margin:0 auto;
 position:relative;
}
a:link {
 color: #FFF;
}
a:visited {
 color: #FFFFFF;
}
body,td,th {
 font-size: 12px;
}
</style>
</head>

<body><!--#include file="header.asp" -->
<table width="780" border="0" cellspacing="0" cellpadding="6">
  <tr>
    <td width="400"><iframe src="hyzxdy.asp" frameborder="0" scrolling="no" width="400" height="400"></iframe></td>
     <td width="356" valign="top"><form ACTION="<%=MM_editAction%>" METHOD="POST" id="form1" name="form1">
       <table width="100%" border="0" cellspacing="0" cellpadding="6">
         <tr>
           <td align="right">&nbsp;</td>
           <td><h3>修改密码</h3></td>
         </tr>
         <tr>
           <td align="right">用户名</td>
           <td><%=(Recordset1.Fields.Item("u_name").Value)%></td>
         </tr>
         <tr>
           <td align="right">原密码</td>
           <td><input type="text" name="ymm" id="ymm" /></td>
         </tr>
         <tr>
           <td align="right">新密码</td>
           <td><input type="text" name="u_pass" id="u_pass" /></td>
         </tr>
         <tr>
           <td align="right">重复密码</td>
           <td><input type="text" name="u_pass2" id="u_pass2" /></td>
         </tr>
         <tr>
           <td align="right">&nbsp;</td>
           <td><input type="submit" name="button" id="button" value="修改" /></td>
         </tr>
       </table>
       <input type="hidden" name="MM_update" value="form1" />
       <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("uid").Value %>" />
     </form></td>
  </tr>
</table>

<!--#include file="footer.asp" -->


</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>



 

[本站回复]

将记录集代码

 

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("hy") <> "") Then
  Recordset1__MMColParam = Session("hy")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows

Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_conn_STRING
Recordset1_cmd.CommandText = "SELECT * FROM dbo.User_biao WHERE u_name = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 200, 1, 50, Recordset1__MMColParam) ' adVarChar

Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

 

移动到

第三行下

<!--#include file="md5.asp" -->

即可解决此问题

上一个:局域网内访问网站  |  下一个:刷新验证码问题
[相关内容]
 请匆使用临时文件预览功能
 表格鼠标划过时的颜色怎么设置?
 我想中文网站直接翻译成英文网站,这样翻译器代码有吗
 就像自助建站那样换模板
 如何给图片自动编号
 Dreamweaver里的数据库为灰色
 做框架页面的时候预览不了
 删除前提示是否继续的代码: 放在的位置
 添加后返回原页面
 关于网页适应不同显示率的问题
 像QQ式的简单对话功能可以在网页中实吗?
 网站菜单二、三级栏目的制作
 老师请看这段代码哪里错了。
 老师您好,关于为二栏目添加说明图片的问题
 数据库多表查询并在同一页面显示结果的问题
 关于多表自动查询的问题
 普通ASP页面右边和底部,加滚动条的问题
 关于教程中的一些问题
 问两个问题【加急】
 iframe与服务器端包括
 网站怎样防止恶意发贴?
 制作视频播放页面
 关于复选框的问题?
 如何在网页中直接打开PDF文档?
 有关网页直接打开pdf问题补充说明
 网站计数器代码 
 EXECL数据导入SQL问题
 登录后台不能添加新闻
 登录账号的同时能不能传递参数?
 请教防止网页被盗问题

会员中心 意见建议 获取VIP 联系我们 付款方式 版权声明
陶益数码工作室 Ty502.com Copyright © 2006 版权所有 黔ICP备11000612号