asp修改密码代码,请高手帮忙
update.asp页面<HEAD><TITLE>修改密码页面</TITLE></HEAD><BODY><BR><BR><CENTER><FONTSIZE="5"COLO...
update.asp页面
<HEAD>
<TITLE>修改密码页面</TITLE>
</HEAD>
<BODY>
<BR><BR><CENTER><FONT SIZE="5" COLOR=blue FACE="黑体">修改个人密码页面</FONT></CENTER><BR><BR>
<FORM METHOD=POST ACTION="updatepost.asp">
<TABLE align=center width="60%" border="1" cellspacing="0">
<TR>
<TD bordercolor="#6699FF" bgcolor="#6699FF">
<FONT FACE="隶书" SIZE="4" COLOR="#FF0000">更改密码:</FONT>
</TD>
</TR>
<TR>
<TD>
<FONT COLOR=red>*</FONT>您的旧密码:<INPUT TYPE="password" NAME="password" size=20 maxlength=6>
<FONT SIZE="" COLOR=""></FONT><BR><HR>
<FONT COLOR=red>*</FONT>输入新密码:<INPUT TYPE="password" NAME="newpassword" size=20 maxlength=6><BR>
<FONT COLOR=red>*</FONT>新密码确认:<INPUT TYPE="password" NAME="newpasswordtemp" size=20 maxlength=6><BR>
</TD>
</TR>
<TR>
<TD bordercolor="#6699FF" bgcolor="#6699FF" align=center>
<P><input type="submit" value="提交" name="submit">
<input type="reset" value="重写" name="B2">
<input type="submit" value="返回" name="submit"></P>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
updatepost.asp页面
<!--#include file="conn.asp"-->
<%
dim password,newpassword,newpasswordtemp,userid
if Request.Form("submit")="提交" then
userid = session("userid")
password = Request("password")
newpassword = Request("newpassword")
newpasswordtemp = Request("newpasswordtemp")
if session("password") <> password then
Response.Write "<center>对不起,您输入的旧密码不正确.请重试!</center>"
Response.end
elseif newpassword <> newpasswordtemp then
Response.Write "<center>对不起,新密码与新密码确认不同.请重试!</center>"
Response.end
end if
dim rs,sql
set rs = Server.CreateObject("ADODB.Recordset")
sql="update user set password='" & newpassword & "' where ID="& id
rs.execute(sql)
Response.Write "<center>密码修改成功,请切记您的新密码:'" & newpassword & "'</center>"
Response.end
elseif Request.Form("submit")="返回" then
Response.Redirect "Selfinfo.asp"
end if
%>
数据表 user
列:user,password,id
一提交就出错,是我少写了什么东西吗? 展开
<HEAD>
<TITLE>修改密码页面</TITLE>
</HEAD>
<BODY>
<BR><BR><CENTER><FONT SIZE="5" COLOR=blue FACE="黑体">修改个人密码页面</FONT></CENTER><BR><BR>
<FORM METHOD=POST ACTION="updatepost.asp">
<TABLE align=center width="60%" border="1" cellspacing="0">
<TR>
<TD bordercolor="#6699FF" bgcolor="#6699FF">
<FONT FACE="隶书" SIZE="4" COLOR="#FF0000">更改密码:</FONT>
</TD>
</TR>
<TR>
<TD>
<FONT COLOR=red>*</FONT>您的旧密码:<INPUT TYPE="password" NAME="password" size=20 maxlength=6>
<FONT SIZE="" COLOR=""></FONT><BR><HR>
<FONT COLOR=red>*</FONT>输入新密码:<INPUT TYPE="password" NAME="newpassword" size=20 maxlength=6><BR>
<FONT COLOR=red>*</FONT>新密码确认:<INPUT TYPE="password" NAME="newpasswordtemp" size=20 maxlength=6><BR>
</TD>
</TR>
<TR>
<TD bordercolor="#6699FF" bgcolor="#6699FF" align=center>
<P><input type="submit" value="提交" name="submit">
<input type="reset" value="重写" name="B2">
<input type="submit" value="返回" name="submit"></P>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
updatepost.asp页面
<!--#include file="conn.asp"-->
<%
dim password,newpassword,newpasswordtemp,userid
if Request.Form("submit")="提交" then
userid = session("userid")
password = Request("password")
newpassword = Request("newpassword")
newpasswordtemp = Request("newpasswordtemp")
if session("password") <> password then
Response.Write "<center>对不起,您输入的旧密码不正确.请重试!</center>"
Response.end
elseif newpassword <> newpasswordtemp then
Response.Write "<center>对不起,新密码与新密码确认不同.请重试!</center>"
Response.end
end if
dim rs,sql
set rs = Server.CreateObject("ADODB.Recordset")
sql="update user set password='" & newpassword & "' where ID="& id
rs.execute(sql)
Response.Write "<center>密码修改成功,请切记您的新密码:'" & newpassword & "'</center>"
Response.end
elseif Request.Form("submit")="返回" then
Response.Redirect "Selfinfo.asp"
end if
%>
数据表 user
列:user,password,id
一提交就出错,是我少写了什么东西吗? 展开
2个回答
展开全部
1.应该是userid
sql="update [user] set password='" & newpassword & "' where ID="& userid
2.不能这样用execute
Dim db,connstr
Set db=server.CreateObject("ADODB.connection")
str="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("你数据源的名称,例如:abc.mdb")
db.Open str
db.execrte(sql)
sql="update [user] set password='" & newpassword & "' where ID="& userid
2.不能这样用execute
Dim db,connstr
Set db=server.CreateObject("ADODB.connection")
str="provider=microsoft.jet.oledb.4.0;data source="&server.MapPath("你数据源的名称,例如:abc.mdb")
db.Open str
db.execrte(sql)
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
问题很多,不过最要命的是这里:
set rs = Server.CreateObject("ADODB.Recordset")
sql="update user set password='" & newpassword & "' where ID="& id
rs.execute(sql)
id哪来的?应该是userid吧,改为:
sql="update [user] set password='" & newpassword & "' where ID="& userid
conn.execute(sql)
set rs = Server.CreateObject("ADODB.Recordset")
sql="update user set password='" & newpassword & "' where ID="& id
rs.execute(sql)
id哪来的?应该是userid吧,改为:
sql="update [user] set password='" & newpassword & "' where ID="& userid
conn.execute(sql)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询