<
%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<script language="javascript">
<!--
function chk()
{
if(document.form1.oldname.value=="")
{
alert("请输入用户名");
return false;
}
if(document.form1.oldpwd.value=="")
{
alert("请输入密码");
return false;
}
if(document.form1.newname.value=="")
{
alert("请输入新用户名");
return false;
}
if(document.form1.newpwd.value=="")
{
alert("新密码不能为空");
return false;
}
if(document.form1.newname.value.length<4)
{
alert("用户名不能少于4位");
return false;
}
if(document.form1.newpwd.value.length<8)
{
alert("密码不能小于8位");
return false;
}
if(document.form1.newpwd.value!=document.form1.newpwd1.value)
{
alert("两次密码不一致");
return false;
}
return true;
}
-->
</script>
<%if isempty(session("username")) then
response.redirect("login.asp")
end if
name1=request("oldname")
pwd1=request("oldpwd")
name2=request("newname")
pwd2=request("newpwd")
if name1<>""and pwd1<>"" then
set rsc=server.createobject("adodb.recordset")
sqlc="select * from admin where admin='"&name1&"' and pwd='" &pwd1&"'"
rsc.open sqlc,conn,3,2
if rsc.eof and rsc.bof then
%>
<script language=javascript>
alert('请输入正确的用户名或密码');
history.back();
</script>
<%
else
sqlcc="update admin set admin='"&name2&"',pwd='"&pwd2&"' where admin='"&name1&"'"
conn.execute sqlcc
%>
<script language=javascript>
alert("修改成功");
history.back();
</script>
<%
end if
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/my.css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理员密码修改</title>
</head>
<body>
<form name="form1" method="post" action="change.asp" onSubmit="return chk()">
<table width="424" height="220" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#993300" class="k1">
<tr>
<td width="420" height="18" bgcolor="#FFFFFF"><a href="index.asp">发表留言</a>||<a href="rword.asp">查看留言</a>||<a href="loginout.asp">退出管理</a></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td width="37%">旧用户名:</td>
<td width="63%">
<div align="justify">
<input name="oldname" type="text" class="k1" size="20">
</div></td>
</tr>
<tr align="center">
<td>旧 密 码:</td>
<td>
<div align="justify">
<input name="oldpwd" type="password" class="k1" value="" size="20">
</div></td>
</tr>
<tr align="center">
<td>新用户名:</td>
<td>
<div align="justify">
<input name="newname" type="text" class="k1" size="20">
</div></td>
</tr>
<tr align="center">
<td>新 密 码:</td>
<td>
<div align="justify">
<input name="newpwd" type="password" class="k1" id="newpwd" size="20">
</div></td>
</tr>
<tr align="center">
<td>确认密码:</td>
<td>
<div align="justify">
<input name="newpwd1" type="password" class="k1" id="newpwd" size="20">
</div></td>
</tr>
<tr align="center">
<td height="26"><input name="Submit" type="submit" class="k1" value="修改"></td>
<td>
<input name="Submit" type="reset" class="k1" value="重置">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
我把那个id=newpws1就可以了,但不知道为什么?
和这个ID有什么关系吗?