
asp中修改用户密码的代码?
就是我想用户登录页面后,有按钮链接到修改密码的页面:要在修改页面做一个输入原密码、新密码、确认新密码的输入框,并能实现密码修改。请问要怎么写?修改表student里面的p...
就是我想用户登录页面后,有按钮链接到修改密码的页面:
要在修改页面做一个输入原密码、新密码、确认新密码的输入框,并能实现 密码修改。
请问要怎么写?
修改表student里面的password。 展开
要在修改页面做一个输入原密码、新密码、确认新密码的输入框,并能实现 密码修改。
请问要怎么写?
修改表student里面的password。 展开
展开全部
验证输入
<script>
function checkdata()
{
if (document.ChangPwd.OldPwd.value.length==""){
alert("旧密码必须输入!");
document.ChangPwd.OldPwd.focus();
return false;
}
if (document.ChangPwd.NewPwd.value.length==""){
alert("新密码必须输入!");
document.ChangPwd.NewPwd.focus();
return false;
}
if (document.ChangPwd.ReNewPwd.value.length==""){
alert("请输入重复密码!");
document.ChangPwd.ReNewPwd.focus();
return false;
}
if (document.ChangPwd.OldPwd.value == document.ChangPwd.NewPwd.value){
alert('旧密码不能与新密码相同!');
document.ChangPwd.NewPwd.focus();
return false;
}
if (document.ChangPwd.ReNewPwd.value != document.ChangPwd.NewPwd.value){
alert('新密码与重复密码必须相同!');
document.ChangPwd.ReNewPwd.focus();
return false;
}
}
</script>
提交修改:
<%
Dim action
action=Trim(Request("action"))
if action="chkAdmin" then
ReNewPwd=Request.form("ReNewPwd")
pid=Request.form("OldPwd")
sql="select * From users where nid='"&nid&"'"
set rs=server.CreateObject ("Adodb.recordset")
rs.open sql,conn,1,3
If Not rs.Eof then
if rs("pid")<>pid then
Response.Write "<script>alert('旧密码输入错误!');this.location.href='changepws.asp';</SCRIPT>"
Response.End
end if
rs("pid")=ReNewPwd
rs.update
rs.close
Set rs = Nothing
Response.Write "<script>alert('密码修改成功!');this.location.href='./';</SCRIPT>"
Response.End
end if
end if
%>
<script>
function checkdata()
{
if (document.ChangPwd.OldPwd.value.length==""){
alert("旧密码必须输入!");
document.ChangPwd.OldPwd.focus();
return false;
}
if (document.ChangPwd.NewPwd.value.length==""){
alert("新密码必须输入!");
document.ChangPwd.NewPwd.focus();
return false;
}
if (document.ChangPwd.ReNewPwd.value.length==""){
alert("请输入重复密码!");
document.ChangPwd.ReNewPwd.focus();
return false;
}
if (document.ChangPwd.OldPwd.value == document.ChangPwd.NewPwd.value){
alert('旧密码不能与新密码相同!');
document.ChangPwd.NewPwd.focus();
return false;
}
if (document.ChangPwd.ReNewPwd.value != document.ChangPwd.NewPwd.value){
alert('新密码与重复密码必须相同!');
document.ChangPwd.ReNewPwd.focus();
return false;
}
}
</script>
提交修改:
<%
Dim action
action=Trim(Request("action"))
if action="chkAdmin" then
ReNewPwd=Request.form("ReNewPwd")
pid=Request.form("OldPwd")
sql="select * From users where nid='"&nid&"'"
set rs=server.CreateObject ("Adodb.recordset")
rs.open sql,conn,1,3
If Not rs.Eof then
if rs("pid")<>pid then
Response.Write "<script>alert('旧密码输入错误!');this.location.href='changepws.asp';</SCRIPT>"
Response.End
end if
rs("pid")=ReNewPwd
rs.update
rs.close
Set rs = Nothing
Response.Write "<script>alert('密码修改成功!');this.location.href='./';</SCRIPT>"
Response.End
end if
end if
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询