展开全部
<%
if session("shiwei_username")="" then
%>
<script language="javascript">
top.location.href="../index.asp"
</script>
<%
response.end
end if
%>
<!-- #include file="../conn.asp" -->
<!-- #include file="../inc/md5.asp" -->
<html>
<head>
<title><%=dianming%> - 修改密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>
body {
background-color:#FFFFFF;
}
</style>
<script language="javascript">
function check()
{
if (document.form1.pwd_new.value=="")
{
alert("请输入新密码!");
document.form1.pwd_new.focus();
return false;
}
if (document.form1.pwd_new.value!=document.form1.pwd_new2.value)
{
alert("两次密码输入不一致!");
return false;
}
}
</script>
</HEAD>
<BODY>
<%if request("hid1")="" then%>
<%
sql="select * from login where id="&session("shiwei_id")
set rs=conn.execute(sql)
%>
<form name="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> 修改密码</td>
<td align="right"> </td>
</tr>
</table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
<tr>
<td width="25%" height="30" align="right">原密码:</td>
<td width="75%" class="category"><input type="password" name="pwd_old" style="width:200px"></td>
</tr>
<tr>
<td align="right" height="30">新密码:</td>
<td class="category"><input type="password" name="pwd_new" style="width:200px"></td>
</tr>
<tr>
<td align="right" height="30">确认新密码:</td>
<td class="category"><input type="password" name="pwd_new2" style="width:200px"></td>
</tr>
<tr>
<td height="30"> </td>
<td class="category">
<input type="submit" value=" 确认修改 " onClick="return check()" class="button">
<input type="hidden" name="hid1" value="ok">
<input type="hidden" name="id" value="<%=rs("id")%>">
<input type="reset" value=" 重置 " class="button">
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</form>
<%
else
pwd_old=request("pwd_old")
pwd_new=request("pwd_new")
sql="select * from login where username='"&session("shiwei_username")&"' and pwd='"&md5(pwd_old)&"'"
set rs=conn.execute(sql)
if rs.eof then
%>
<script language="javascript">
alert("原密码不正确!")
window.history.go(-1)
</script>
<%
response.end
end if
sql="update login set pwd='"&md5(pwd_new)&"' where id="&request("id")
conn.execute(sql)
%>
<script language="javascript">
alert("密码修改成功!")
window.location.href="../desk.asp"
</script>
<%
end if
%>
</body>
</html>
if session("shiwei_username")="" then
%>
<script language="javascript">
top.location.href="../index.asp"
</script>
<%
response.end
end if
%>
<!-- #include file="../conn.asp" -->
<!-- #include file="../inc/md5.asp" -->
<html>
<head>
<title><%=dianming%> - 修改密码</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>
body {
background-color:#FFFFFF;
}
</style>
<script language="javascript">
function check()
{
if (document.form1.pwd_new.value=="")
{
alert("请输入新密码!");
document.form1.pwd_new.focus();
return false;
}
if (document.form1.pwd_new.value!=document.form1.pwd_new2.value)
{
alert("两次密码输入不一致!");
return false;
}
}
</script>
</HEAD>
<BODY>
<%if request("hid1")="" then%>
<%
sql="select * from login where id="&session("shiwei_id")
set rs=conn.execute(sql)
%>
<form name="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> 修改密码</td>
<td align="right"> </td>
</tr>
</table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
<tr>
<td width="25%" height="30" align="right">原密码:</td>
<td width="75%" class="category"><input type="password" name="pwd_old" style="width:200px"></td>
</tr>
<tr>
<td align="right" height="30">新密码:</td>
<td class="category"><input type="password" name="pwd_new" style="width:200px"></td>
</tr>
<tr>
<td align="right" height="30">确认新密码:</td>
<td class="category"><input type="password" name="pwd_new2" style="width:200px"></td>
</tr>
<tr>
<td height="30"> </td>
<td class="category">
<input type="submit" value=" 确认修改 " onClick="return check()" class="button">
<input type="hidden" name="hid1" value="ok">
<input type="hidden" name="id" value="<%=rs("id")%>">
<input type="reset" value=" 重置 " class="button">
</td>
</tr>
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</form>
<%
else
pwd_old=request("pwd_old")
pwd_new=request("pwd_new")
sql="select * from login where username='"&session("shiwei_username")&"' and pwd='"&md5(pwd_old)&"'"
set rs=conn.execute(sql)
if rs.eof then
%>
<script language="javascript">
alert("原密码不正确!")
window.history.go(-1)
</script>
<%
response.end
end if
sql="update login set pwd='"&md5(pwd_new)&"' where id="&request("id")
conn.execute(sql)
%>
<script language="javascript">
alert("密码修改成功!")
window.location.href="../desk.asp"
</script>
<%
end if
%>
</body>
</html>
展开全部
通常带用户系统的网站都需要制作修改密码的功能,字面上说的修改密码,其实就是我们平时写的记录更新功能了,修改密码很简单,您只需要在asp页面里面执行一句SQL语句就可以实现密码的更新,但基于安全起见,我们需要对用户进行身份验证,防止密码被不法分子非法篡改,目前网络上流行的验证方式一般有:验证密码、邮件认证、问题验证、手机短信认证等,通常简单的用户系统制作一个密码验证或者问题认证就好了,修改密码很简单,不过出于安全性,我们需要将它复杂化了,它就是一个普通的记录更新。
普通修改密码:
<%
dim password
password=request.from("password")
set rs=server.createobject("adodb.recordset")
rs.open "update user set password='"&password&"' where password = '"&原密码验证&"' and username='"&传入当前登录用户名&"'" ,conn,1,1
%>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
account.asp
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你hi我,我给你写一个。。。。不同程序,修改密码的代码不一样的。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询