求助 用户修改密码页面
填写上答案 和 新密码 只是弹出信息框 就算提示修改OK 数据库无反应 采用md5加密 写入数据库
表单提交页面
采用提示问题 和答案 + 新密码 验证
帐号 和 问题 文本域 用户不能输入 自动获取和显示
提交到 user_passok.asp
<script language="JavaScript" type="text/JavaScript">
function checkadd(){
if (document.postart.pass_daan.value.length<1)
{
alert("请您填写提示答案");
document.postart.pass_daan.focus();
return false;
}
if (document.postart.pass_mm1.value.length<1)
{
alert("请填写新密码!");
document.postart.pass_mm1.focus();
return false;
}
if (document.postart.pass_mm2.value.length<1)
{
alert("请填写确认密码!");
document.postart.pass_mm2.focus();
return false;
}
if (document.postart.pass_mm1.value != document.postart.pass_mm2.value)
{
alert("两次输入的密码不一致,请重新输入!");
document.postart.pass_mm1.focus();
return false;
}
if (document.postart.checkCode.value.length<1)
{
alert("请输入验证码!");
document.postart.checkCode.focus();
return false;
}
}
</script>
<%
dim sql,rs,username
username=request.cookies("m0453")("username")
set rs=server.createobject("adodb.recordset")
sql = "select * from m_user where username='"&username&"'"
rs.open sql,conn,1,1
%>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="padding:10px;">
<font color="#0000FF" style="font-weight:bold; font-size:14px;">
如果您忘记提示答案、请即时联系客服找回答案或修改答案
</font>
</td>
</tr>
<tr>
<td align="center" style="padding:10px;">
<font color="#0000FF" style="font-weight:bold; font-size:14px;">
联系电话:XXXXXXXX 、 联系QQ:XXXXXXX
</font>
</td>
</tr>
<tr>
<td align="center">
<form action="user_passok.asp" name="postart" method="post" onsubmit="return checkadd()">
<table width="50%" border="1" cellpadding="3" cellspacing="0" bgcolor="#F9F9F9" bordercolorlight="#808080" bordercolordark="#FFFFFF" style="font-size:12px;">
<tr>
<td align="right" bgcolor="#DFDFDF">登陆帐号:</td>
<td align="left">
<input name="pass_name" type="text" style="background-color: #FFFFD2" value="<%=rs("username")%>" size="20" readonly=/></td>
</tr>
<tr>
<td width="23%" align="right" bgcolor="#DFDFDF">提示问题:</td>
<td width="77%" align="left">
<input name="pass_wenti" type="text" style="background-color: #FFFFD2" value="<%=rs("wenti")%>" size="20" readonly> </td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">提示答案:</td>
<td align="left"><input name="pass_daan" type="text" id="pass_daan" size="20" maxlength="20" />
* </td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">输入新密码:</td>
<td align="left"><input name="pass_mm1" type="password" id="pass_mm1" size="20" maxlength="20" />
* 输入新密码</td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">确认新密码:</td>
<td align="left"><input name="pass_mm2" type="password" id="pass_mm2" size="20" maxlength="20" />
* 在此输入新密码</td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">验证码:</td>
<td align="left">
<input name="checkCode" type="text" size="6" maxlength="4" />
<img src="../charAndNum_CheckCode.asp" alt="看不清楚?请点击刷新" style="CURSOR:hand;" onclick="this.src=this.src+'?'+Math.random();">
看不清楚、点图刷新
</td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF"> </td>
<td align="left">
<input style="width:100px; text-align:center;" type="submit" name="Submit" value="提 交" /> </td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<%
rs.close
set rs=nothing
Conn.close
Set conn=nothing
%>
function checkadd(){
if (document.postart.pass_daan.value.length<1)
{
alert("请您填写提示答案");
document.postart.pass_daan.focus();
return false;
}
if (document.postart.pass_mm1.value.length<1)
{
alert("请填写新密码!");
document.postart.pass_mm1.focus();
return false;
}
if (document.postart.pass_mm2.value.length<1)
{
alert("请填写确认密码!");
document.postart.pass_mm2.focus();
return false;
}
if (document.postart.pass_mm1.value != document.postart.pass_mm2.value)
{
alert("两次输入的密码不一致,请重新输入!");
document.postart.pass_mm1.focus();
return false;
}
if (document.postart.checkCode.value.length<1)
{
alert("请输入验证码!");
document.postart.checkCode.focus();
return false;
}
}
</script>
<%
dim sql,rs,username
username=request.cookies("m0453")("username")
set rs=server.createobject("adodb.recordset")
sql = "select * from m_user where username='"&username&"'"
rs.open sql,conn,1,1
%>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" style="padding:10px;">
<font color="#0000FF" style="font-weight:bold; font-size:14px;">
如果您忘记提示答案、请即时联系客服找回答案或修改答案
</font>
</td>
</tr>
<tr>
<td align="center" style="padding:10px;">
<font color="#0000FF" style="font-weight:bold; font-size:14px;">
联系电话:XXXXXXXX 、 联系QQ:XXXXXXX
</font>
</td>
</tr>
<tr>
<td align="center">
<form action="user_passok.asp" name="postart" method="post" onsubmit="return checkadd()">
<table width="50%" border="1" cellpadding="3" cellspacing="0" bgcolor="#F9F9F9" bordercolorlight="#808080" bordercolordark="#FFFFFF" style="font-size:12px;">
<tr>
<td align="right" bgcolor="#DFDFDF">登陆帐号:</td>
<td align="left">
<input name="pass_name" type="text" style="background-color: #FFFFD2" value="<%=rs("username")%>" size="20" readonly=/></td>
</tr>
<tr>
<td width="23%" align="right" bgcolor="#DFDFDF">提示问题:</td>
<td width="77%" align="left">
<input name="pass_wenti" type="text" style="background-color: #FFFFD2" value="<%=rs("wenti")%>" size="20" readonly> </td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">提示答案:</td>
<td align="left"><input name="pass_daan" type="text" id="pass_daan" size="20" maxlength="20" />
* </td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">输入新密码:</td>
<td align="left"><input name="pass_mm1" type="password" id="pass_mm1" size="20" maxlength="20" />
* 输入新密码</td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">确认新密码:</td>
<td align="left"><input name="pass_mm2" type="password" id="pass_mm2" size="20" maxlength="20" />
* 在此输入新密码</td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF">验证码:</td>
<td align="left">
<input name="checkCode" type="text" size="6" maxlength="4" />
<img src="../charAndNum_CheckCode.asp" alt="看不清楚?请点击刷新" style="CURSOR:hand;" onclick="this.src=this.src+'?'+Math.random();">
看不清楚、点图刷新
</td>
</tr>
<tr>
<td align="right" bgcolor="#DFDFDF"> </td>
<td align="left">
<input style="width:100px; text-align:center;" type="submit" name="Submit" value="提 交" /> </td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<%
rs.close
set rs=nothing
Conn.close
Set conn=nothing
%>
下面是 user_passok.asp 页面
有个问题
<input name="pass_name" type="text" style="background-color: #FFFFD2" value="<%=rs("username")%>" size="20" readonly>
readonly属性的 文本域 不可以在user_passok.asp获取 form吗
<!--#include file="../conn.asp"-->
<!--#include file="../usercookies.asp"-->
<!--#include file="../md5.asp"-->
<%
dim checkCode,username,daan,mima
checkCode = request.Form("checkCode")
if (trim(checkCode)<>session("GetCode")) then
Response.Write("<script language=""JavaScript"">alert(""您填写的验证码不正确,请重新填写!"");history.go(-1);</script>")
response.end
end if
username=trim(request.form("pass_name"))
daan=trim(request.form("pass_daan"))
mima=trim(request.form("pass_mm1"))
set rs=server.createobject("adodb.recordset")
sql="select * from m_user where username="&username
rs.open sql,conn,1,3
if rs("daan")<>daan then
Response.Write("<script language=""JavaScript"">alert(""您输入的提示答案错误、无法修改密码!"");history.go(-1);</script>")
Response.end
else
rs("password")=md5(mima)
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"<script>alert('尊敬的会员恭喜您、您的密码修改完毕请牢记!');location='user_center.asp'</script>"
end if
%>
<!--#include file="../usercookies.asp"-->
<!--#include file="../md5.asp"-->
<%
dim checkCode,username,daan,mima
checkCode = request.Form("checkCode")
if (trim(checkCode)<>session("GetCode")) then
Response.Write("<script language=""JavaScript"">alert(""您填写的验证码不正确,请重新填写!"");history.go(-1);</script>")
response.end
end if
username=trim(request.form("pass_name"))
daan=trim(request.form("pass_daan"))
mima=trim(request.form("pass_mm1"))
set rs=server.createobject("adodb.recordset")
sql="select * from m_user where username="&username
rs.open sql,conn,1,3
if rs("daan")<>daan then
Response.Write("<script language=""JavaScript"">alert(""您输入的提示答案错误、无法修改密码!"");history.go(-1);</script>")
Response.end
else
rs("password")=md5(mima)
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write"<script>alert('尊敬的会员恭喜您、您的密码修改完毕请牢记!');location='user_center.asp'</script>"
end if
%>