28,391
社区成员
发帖
与我相关
我的任务
分享
<%
pwd1=trim(request("pwd1"))
pwd2=trim(request("pwd2"))
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from user_info where name='"&session("username")&"' "
rs.open sql,conn,1,3
if rs("password")<>pwd1 then
response.write "<script language='javascript'>"
response.write "alert('Wrong current password!');window.location.href='changepw.asp';"
response.write "</script>"
response.end
else
rs("password")=pwd2
rs.update
response.write "<script language='javascript'>"
response.write "alert('Change password success,please remember the new password!');window.location.href='home.asp';"
response.write " </script>"
rs.close
set rs=nothing
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- #include file="conn.asp" -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DCC Database System</title>
</head>
<script language="javascript">
function check(){
if(document.myform.pwd1.value=="")
{
document.myform.pwd1.focus();
alert("Please input the current password!");
return false;
}
if(document.myform.pwd2.value=="")
{
document.myform.pwd2.focus();
alert("Please input the new password!");
return false;
}
if(document.myform.pwd3.value=="")
{
document.myform.pwd3.focus();
alert("Please input the new password again!");
return false;
}
if(document.myform.pwd2.value!=document.myform.pwd3.value)
{
alert("You input two different passwords!");
return false;
}
}
</script>
<body >
<%
pwd1=request("pwd1")
pwd2=request("pwd2")
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from user_info where [name]='"&session("username")&"' "
rs.open sql,conn,1,3
response.write rs("password") & " <br>"
response.write pwd1
if rs("password")<>pwd1 then
response.write "<script language='javascript'>"
response.write "alert('Wrong current password!');"
response.write "</script>"
response.end
else
rs("password")=pwd2
rs.update
response.write "<script language='javascript'>"
response.write "alert('Change password success,please remember the new password!');"
response.write " </script>"
rs.close
set rs=nothing
end if
%>
<form id="myform" name="myform" method="post" action="" onSubmit="return check();">
<table width="970" border="0" cellspacing="0" cellpadding="0" align="center" height="269" >
<tr>
<td height="260" valign="bottom" bordercolor="#9966CC" background="images/top.jpg">
<table width="700" border="0" align="right" cellpadding="0" cellspacing="0" height="17">
<tr>
<td width="82" height="19" align="center" valign="middle"><b><a href="newdoc.asp">
New DOC</a></b></td>
<td width="104" height="19" align="center" valign="middle"><b>
<a href="editdoc.asp">Edit DOC</a></b></td>
<td width="103" height="19" align="center" valign="middle">
<b><a href="edittype.asp">Edit Type</a></b></td>
<td width="124" height="19" align="center" valign="middle">
<a href="editproject.asp"><b>Edit Project</b></a></td>
<td width="81" height="19" align="center" valign="middle">
<a href="search.asp"><b>Search</b></a></td>
<td width="81" height="19" align="center" valign="middle">
<a href="report.asp"><b>Report</b></a></td>
<td width="108" height="19" align="center" valign="middle"> </td>
<td width="16" height="19"> </td>
</tr>
</table></td>
</tr>
<tr>
<td height="9" align="center" valign="top" background="images/line.jpg">
<table border="0" width="96%" id="table1" height="215">
<tr>
<td height="211">
<table border="0" width="96%" id="table2" height="47">
<tr>
<td height="43" align="left">
<img border="0" src="images/ico05.gif" width="32" height="32">
<font size="4" color="#9999FF"><b>Change Password</b></font></td>
</tr>
<tr><td align="center">
<table width="90%" style="border-style: solid; border-width: 2px" bordercolor="#000000" height="162">
<tr>
<td bgcolor="#9AA7ED" align="left" height="25" colspan="2" >
<p align="center"><font size="4" color="#FFFFFF"><b>
<img border="0" src="images/res.gif" width="15" height="13"> Change Password</b></font></td>
</tr>
<tr>
<td bgcolor="#E7F0FA" align="right" height="36" >
<p align="right"><b>User Name:<font color="#FF0000"></font>
</b></td>
<td bgcolor="#E7F0FA" align="left" height="36" width="60%" >
<font size="3">
<input type="text" name="username" size="26" value="<%=session("username")%>" readonly></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF" align="right" height="27" >
<p align="right"><b>
Current password: </b>
</td>
<td bgcolor="#FFFFFF" align="left" height="27" >
<font size="3">
<input type="password" name="pwd1" size="26" value="" ><font color="#FF0000">*</font></font></td>
</tr>
<tr>
<td bgcolor="#E7F0FA" align="right" height="24" width="39%">
<b>New password: </b> </td>
<td bgcolor="#E7F0FA" align="left" height="24" >
<font size="3">
<input type="password" name="pwd2" size="26" value="" ><font color="#FF0000">*</font></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" height="35" width="39%">
<p align="right"><b> New password again: </b> </td>
<td align="left" height="35" >
<font size="3">
<input type="password" name="pwd3" size="26" value="" ><font color="#FF0000">*</font></font></td>
</tr>
<tr>
<td bgcolor="#9AA7ED" align="center" height="23" colspan="2" >
<p align="left"> <input type="submit" value=" OK " name="OK" > <input name="button" type="button" class="botton" onClick="Javascript:window.history.go(-1);" value=" Back " />
<input type="reset" value="Cancel" name="cancel" ></td>
</tr>
</table>
</td>
</tr>
</table>
</tr>
<tr>
<td height="51"><img src="images/copyright.jpg" width="990" height="51" ></td>
</tr>
</table>
</form>
</body>
</html>