?? users.asp
字號:
<!-- #include file="conn.asp"-->
<!-- #include file="changepwd.asp"-->
<!-- #include file="md5.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用戶管理</title>
<script language="javascript" type="text/javascript">
function check1()
{
if (document.form.admin.value=="")
{
alert("錯誤:請輸入用戶名!");
return false;
}
if (document.form.pwd.value=="")
{
alert("錯誤:請輸入密碼!");
return false;
}
return true;
}
</script>
<script type="text/jscript">
var uReg=/[^A-Za-z0-9]/ig;
function check3(vAlue){
if (uReg.test(vAlue)){
alert('錯誤:密碼不能輸入非法字符!');
document.form1.password.value=""
form.password.focus();
}
if (vAlue.length>16){
alert('錯誤:密碼只能輸入16位!');
document.form1.password.value=""
form.pwd.focus();
}
}
</script>
<script type="text/jscript">
var uReg=/[^A-Za-z0-9]/ig;
function check2(vAlue){
if (uReg.test(vAlue)){
alert('錯誤:用戶名不能輸入非法字符!');
document.form1.admin.value=""
form.admin.focus();
}
if (vAlue.length>12){
alert('錯誤:用戶名只能輸入12位!');
document.form1.admin.value=""
form1.admin.focus();
}
}
if (vAlue.length<5){
alert('錯誤:用戶名不得小于5位!');
document.form1.admin.value=""
form1.admin.focus();
}
}
</script>
<style type="text/css">
<!--
.btn {
border: 1px solid #F5B814;
background-color: #F1F8D1;
}
-->
</style>
</head>
<body style="font-size:12px;">
<p>
<%
dim name
name=request.querystring("name")
dim rs,strsql
set rs=server.createobject("adodb.recordset")
strsql="select * from users where admin='"&name&"'"
rs.open strsql,db,1,2
%>
用戶名:
<input type="text" name="admin" value="<%=rs("admin")%>"/>
密 碼:
<input type="text" name="password" value="<%=rs("password")%>"/>
</p>
<p> </p>
<p> </p>
<form id="form1" name="form1" method="post" action="" onsubmit="javascript:return check1();">
<p> 用戶名:
<input name="admin" type="text" class="btn" size="19" onchange="check2(this.value)" />
</p>
<p>
密 碼:
<input name="password" type="password" class="btn" size="20" />
</p>
<p>確認密碼:
<input name="repassword" type="password" class="btn" size="20" />
</p>
<p>
<input name="Submit" type="submit" class="btn" value="修改" />
</p>
</form>
<%
dim admin,password,rers,restrsql,repassword
admin=request.form("admin")
password=md5(request.form("password"))
repassword=md5(request.form("repassword"))
if admin<>"" then
if repassword=password then
set rers=server.createobject("adodb.recordset")
restrsql="select * from users"
strsql="update users users set admin='"&admin&"'and password='"&password&"' where admin='"&name&"'"
set rs=db.execute(strsql)
rers.open restrsql,db,0,2
rers.addnew restrsql
rers("admin")=admin
rers("password")=password
rers.update
response.write "<script>alert('添加成功!');</script>"
else
response.write "<script>alert('密碼不一致!');form1.admin.focus();</script>"
end if
end if
%>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -