classchangepwdok.asp

来自「这是一个基于sql和asp的网页设计」· ASP 代码 · 共 115 行

ASP
115
字号
<!--#include file="connectionstring.asp"-->
<%
FUNCTION checkpwd(id,pwd)
  dim conn,param,rs
  Set Conn=Server.CreateObject("ADODB.Connection")
  Conn.Open strConn
  sql = "select * from classid where id='"&id&"' and pwd='"&pwd&"'"
  set rs = conn.execute(sql)
  if rs.eof then
    checkpwd = false
  else
    checkpwd =true
  end if
end function
%>

<%
idClass = request.cookies("idClass")
if idClass = "" then 
  response.write "非法操作!请登录后再操作!"
  response.end
end if 
 
pwd = request("old")
new1 = request("new1")
new2 = request("new2")

if new2 ="" or new1="" then
  %>
  <body background="Back1.jpg">
  <hr color="#000080">
  <font size="6" font color="#FF0000"> 新密码不能为空!!!!
  <p></p>
  <p align="center">请按下面的按钮回到选单</b></font></p>
  <hr color="#000080">
  <p align="center"><a href="ClassMain.asp"><img border="0" src="1.GIF" width="63" height="59"></a></p>
  <p align="center"> </p>
  <p>&nbsp;</p>
<%
   response.end
end if 

if new2 <> new1 then
  %>
  <body background="Back1.jpg">
  <hr color="#000080">
  <font size="6" font color="#FF0000"> 新密码两次输入不一致!
  <p></p>
  <p align="center">请按下面的按钮回到选单</b></font></p>
  <hr color="#000080">
  <p align="center"><a href="ClassMain.asp"><img border="0" src="1.GIF" width="63" height="59"></a></p>
  <p align="center"> </p>
  <p>&nbsp;</p>
  <%
  response.end
end if 



if not checkpwd(idClass,pwd) then
  %>
  <body background="Back1.jpg">
  <hr color="#000080">
  <font size="4" font color="#FF0000">原密码错误!
  <p></p>
   <p align="center">请按下面的按钮回到选单</b></font></p>
  <hr color="#000080">
  <p align="center"><a href="ClassMain.asp"><img border="0" src="1.GIF" width="63" height="59"></a></p>
  <p align="center"> </p>
  <p>&nbsp;</p>
  <%
  response.end
end if

Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open strConn
sql = "update classid Set pwd = '"&new1&"' where id = '" & idClass & "'"
Conn.Execute sql
conn.close

response.redirect "ClassChangePwdOk.htm"
%>
































⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?