📄 savechangepass.asp
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<!--#include file="conn.inc"-->
<!-- #include file="inc/char.inc" -->
<%
dim UserName
dim UserEmail
dim OldPassword
dim newPassword
dim newPassword1
dim ErrorMsg(1)
dim ErrMsg
dim FoundError
FoundError=false
if iis3onchsys=true then
UserName=HTMLCharacter(trim(request("name")))
UserEmail=trim(request("email"))
oldPassword=HTMLCharacter(request("oldpasswd"))
newPassword=HTMLCharacter(request("newpasswd"))
newPassword1=HTMLCharacter(request("newpasswd1"))
else
UserName=trim(request("name"))
UserEmail=trim(request("email"))
oldPassword=request("oldpasswd")
newPassword=request("newpasswd")
newPassword1=request("newpasswd1")
end if
if Trim(UserName)="" or len(UserName)>50 then
ErrMsg="请输入姓名(长度不能大于50)"
foundError=True
end if
if oldPassword="" then
FoundError=True
ErrorMsg(1)="旧的口令不能为空!"
end if
if newPassword="" or len(newPassword)>10 then
FoundError=True
ErrorMsg(1)="新的口令不能为空并且长度不能大于10!"
elseif newPassword<>newPassword1 then
FoundError=true
ErrorMsg(1)="两次输入的口令不符!"
end if
ErrMsg=ErrorMsg(0) +"<BR>"+ErrorMsg(1)
response.write "<html>" +chr(13)+chr(10)
response.write "<head>"+chr(13)+chr(10)
response.write "<meta NAME='GENERATOR' Content='Microsoft FrontPage 3.0'>"+chr(13)+chr(10)
response.write "<META HTTP-EQUIV='Expires' CONTENT='0'>"+chr(13)+chr(10)
response.write "<link rel='stylesheet' type='text/css' href='forum.css'>"
response.write "<title>演说家修改</title>"+chr(13)+chr(10)
response.write "</head>"+chr(13)+chr(10)
response.write "<body>"+chr(13)+chr(10)
if FoundError=True then
response.write "<font color='red'><strong><Big>输入错误:</big></strong></font><BR><font color='#0000FF'>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
%>
<form method="POST" name="frmChangePass" action="saveChangePass.asp">
<p><img src="images/link1.gif" WIDTH="70" HEIGHT="20"></p>
<p>姓名: <input class="smallInput" name="name" size="16" value="<% display username%>"> <br>
E-Mail: <br>
<input class="smallInput" name="email" size="40" value="<% display useremail %>"><br>
旧的密码: <input class="smallInput" name="oldpasswd" size="10" type="password" value><br>
新的密码: <input class="smallInput" name="newpasswd" size="10" type="password" value><br>
密码校验: <input class="smallInput" name="newpasswd1" size="10" type="password" value><br>
<input class="buttonface" type="submit" value="发 送" name="B1"> <input class="buttonface" type="reset" value="清 除" name="B2"></p>
</form>
<%
else
dim rs
dim sql
set rs=server.createobject("adodb.recordset")
sql="select * from User"
rs.open sql,conn,1,1
dim FoundUser
FoundUser=false
do while not rs.eof
if ucase(rs("UserName"))=ucase(Trim(UserName)) then
if rs("UserPassword")=oldpassword then
FoundUser=True
else
FoundUser=false
end if
exit do
end if
rs.movenext
loop
rs.close
if foundUser=false then
FoundError=True
ErrMsg="您指定的姓名找不到或口令不正确,请尝试使用正确的名字"
response.write "<font color='red'><strong><Big>输入错误:</big></strong></font><BR><font color='#0000FF'>"+ErrMsg+"</font><BR>"+chr(13)+chr(10)
%>
<form method="POST" name="frmChangePass" action="saveChangePass.asp">
<p><img src="images/link1.gif" WIDTH="70" HEIGHT="20"></p>
<p>姓名: <input class="smallInput" name="name" size="16" value="<%display username%>"> <br>
E-Mail: <br>
<input class="smallInput" name="email" size="40" value="<%display useremail%>"><br>
旧的密码: <input class="smallInput" name="oldpasswd" size="10" type="password" value><br>
新的密码: <input class="smallInput" name="newpasswd" size="10" type="password" value><br>
密码校验: <input class="smallInput" name="newpasswd1" size="10" type="password" value><br>
<input class="buttonface" type="submit" value="发 送" name="B1"> <input class="buttonface" type="reset" value="清 除" name="B2"></p>
</form>
<%
else
dim cmdTemp
dim InsertCursor
dim dataconn
Set DataConn = Server.CreateObject("ADODB.Connection")
dataconn.open connstr
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set InsertCursor = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "SELECT * FROM User WHERE Username='"+UserName+"'"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = dataConn
InsertCursor.Open cmdTemp, , 1, 3
InsertCursor("UserName") = UserName
InsertCursor("UserEmail") =UserEmail
InsertCursor("userpassword") = newPassword
InsertCursor.Update
if not err then
response.write "<font color='red'><strong><Big>演说家修改成功</big></strong></font><BR>"+chr(13)+chr(10)
response.write "<font color='#0000FF'>"
if pwsonchsys then
ShowBody(username)
else
showbody(Server.HTMLEncode(username))
end if
response.write " 演说家更改成功!请经常光顾这里,畅所欲言。</font><BR>"+chr(13)+chr(10)
else
err.clear
ErrMsg="数据库操作失败,请以后再试"
%>
<form method="POST" name="frmChangePass" action="saveChangePass.asp">
<p><img src="images/link1.gif" WIDTH="70" HEIGHT="20"></p>
<p>姓名: <input class="smallInput" name="name" size="16" value="<%display username%>"> <br>
E-Mail: <br>
<input name="email" size="40" value="<%display useremail%>"><br>
旧的密码: <input class="smallInput" name="oldpasswd" size="10" type="password" value><br>
新的密码: <input class="smallInput" name="newpasswd" size="10" type="password" value><br>
密码校验: <input class="smallInput" name="newpasswd1" size="10" type="password" value><br>
<input class="buttonface" type="submit" value="发 送" name="B1"> <input class="buttonface" type="reset" value="清 除" name="B2"></p>
</form>
<%
end if
InsertCursor.close
dataconn.close
end if
end if
response.write "</body>"+chr(13)+chr(10)
response.write "</html>"+chr(13)+chr(10)
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -