?? changepass.asp
字號:
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="newconn.asp"-->
<%
dim username
dim oldpwd
dim newpwd
dim compwd
dim sql
dim rs
dim errmsg
dim founderror
username=trim(request("name"))
oldpwd=trim(request("oldpwd"))
newpwd=trim(request("newpwd"))
compwd=trim(request("compwd"))
FoundError=false
if username="" then
ErrMsg="請輸入姓名"
foundError=True
elseif oldpwd="" then
ErrMsg="請輸入舊密碼"
foundError=True
elseif newpwd="" then
ErrMsg="請輸入新密碼"
foundError=True
elseif compwd="" then
ErrMsg="請輸入確認密碼"
foundError=True
elseif newpwd<>compwd then
ErrMsg="新密碼與確認密碼不相同"
foundError=True
end if
if founderror then
session("ErrMsg")=ErrMsg
response.redirect "myinfo.asp?page=1"
else
set rs=server.createobject("adodb.recordset")
sql="select * from User"
rs.open sql,conn,1,3
if err.number<>0 then
response.write "數據庫操作失敗:"&err.description
else
dim FoundUser
FoundUser=false
do while not (rs.eof or err.number<>0)
if ucase(rs("UserName"))=ucase(UserName) and ucase(rs("userpassword"))=ucase(oldpwd) then
FoundUser=True
rs("userpassword")=newpwd
rs.update
Msg="密碼修改成功,請記住你的密碼"
exit do
end if
rs.movenext
loop
if not FoundUser then
Msg="您的名字不存在或您的密碼不正確"
founderror=true
end if
rs.close
end if
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>更改密碼</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<link rel="stylesheet" type="text/css" href="forum.css">
</head>
<body>
<p align="center"><%=msg%> </p>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -