asp中用户密码修改的代码

网站里用户进行密码修改时,执行密码修改的那部分代码
2024-12-29 14:45:08
推荐回答(2个)
回答1:

if Request.QueryString("action")="Edit" then
id=request("id")
OldPassword=replace(trim(Request("OldPassword")),"'","")
NewPassword=replace(trim(Request("NewPassword")),"'","")if strLength(NewPassword)>16 or strLength(NewPassword)<5 then
response.write ""
response.End
end ifset rs=server.createobject("adodb.recordset")
sql="select * from admin where Id="&id
rs.open sql,conn,1,3'更新管理员密码
if md5(OldPassword)<>rs("PassWord") then
response.write ""
response.End
else
rs("PassWord")=md5(NewPassword)
end if
rs.update
rs.close

回答2:

简单方便的:<%
if request.form("submit") = "修改密码" then
apwd=request.Form("apwd")
pwd=request.form("pwd")
uname=session("login")
if pwd<>"" then
if pwd=apwd then
sql="select*from us where user='"&uname&"'"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,3
rs("pwd")=pwd
rs.update
rs.close
set rs=nothing
Response.Write("alert('密码修改成功!')")
else
response.Write("alert('密码不相同')")
end if
else
Response.Write("alert('密码框不能为空!')")
end if
end if
%>