adminsetstupassword.asp

来自「eayanQuery思燕大学成绩查询系统 版本 V1.6」· ASP 代码 · 共 127 行

ASP
127
字号
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="../include/ReplaceHtml.asp"-->
<!--#include file="../include/PublicFunction.asp"-->
<!--#include file="../include/md5.asp"-->
<!--#include file="../include/Session.asp"-->
<%'call CheckOuterUrl()
   Dim student_name
       student_name=trim(HtmlEncode(request.Cookies("student_name")))
 	   
'强制浏览器重新访问服务器下载页面
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Dim Action
Action=request.QueryString("Action")
Select Case  Action
 Case "SavePassword"   
  Call SavePassword()
  Case Else
  Call Main()
End Select

Sub Main()
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML lang="gb2312">
	<HEAD>
		<title>修改密码---思燕Seayan成绩查询系统SQL版本v1.0----现代教学管理信息系统</title>
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<meta http-equiv="Content-Language" content="gb2312">
		<meta content="all" name="robots">
		<meta content="websvc@163.com" name="author">
		<meta content="版权所有:Seagreen 2005-2008" name="Copyright">
		<meta content="思燕Seayan成绩查询系统SQL版本v1.0, 由 赵海 先生模仿方正教务管理系统开发。" name="description">
		<link rel="icon" href="/favicon.ico" type="image/x-icon">
			<link rel="stylesheet" rev="stylesheet" href="../images/main.css" type="text/css" media="all">
 	</HEAD>
	<BODY background="images/admin_MainBg.gif">
<script language="javascript" type="text/javascript">
function CheckForm(ObjForm) {
  if(ObjForm.Password.value == '') {
    alert('请输入授权密码!');
    ObjForm.Password.focus();
    return false;
  }
  if(ObjForm.ReapPassword.value == '') {
    alert('请输入重复密码!');
    ObjForm.ReapPassword.focus();
    return false;
  }  
  if(ObjForm.ReapPassword.value != ObjForm.Password.value) {
    alert('两次密码输入不一致,请检查!');
    ObjForm.Password.focus();
    return false;
  }   
  if (ObjForm.Password.value.length<6)
  {
    alert('授权密码不能少于六位!');
    ObjForm.Password.focus();
    return false;
  }
 }
	</script>
<%   
   Dim department_id,student_no,ShowSearch,ShowSearchSql,Teacher_id,Class_id,student_id
       department_id=request.Form("department_id")
       student_no=request.Form("student_no")
       ShowSearchSql="select [student_id],[student_name],[teacher_id],[class_id] from [student] where [department_id]='"&department_id&"' and [student_no]='"&student_no&"'"
	   Set ShowSearch=Initialize_Conn.execute(ShowSearchSql)
	     If ShowSearch.eof and ShowSearch.bof then 
	      response.Write("<script>alert('学号不存在,请返回检查');location.href='admin_student.asp';</script>")
		  'Response.Write department_id&"&nbsp;"&student_no
	      Response.End()
         End if 
	Teacher_id=ShowSearch("Teacher_id")'此处为向SavePassword过程传递数值做准备
	Class_id=ShowSearch("Class_id")
	student_id=ShowSearch("student_id")
	student_name=ShowSearch("student_name")
	ShowSearch.close : Set ShowSearch=nothing
		 %>
<p>&nbsp;</p>
<form name="Form1" method="post" action="AdminSetStuPassword.asp?Action=SavePassword" onsubmit="return CheckForm(this)">
		<div align="center"><font color="red">【</font><a href="admin_student.asp">搜索学生</a><font color="red">】</font>&nbsp;&nbsp;<font color="red">此页面是为了解决学生密码丢失找回而设.</font>&nbsp;
		  <hr width="420" />
		</div>
 		<p><font color="red">&nbsp;<%=student_no%><%=student_name%></font> 同学修改密码
        </p>
		<p>输入密码:
		    <input type="Password" name="Password" />
  </p>
		  <p>重复密码:
		    <input type="Password" name="ReapPassword" />
</p>
		  <p>
		    <input type="hidden" name="department_id" value="<%=department_id%>" />
		    <input type="hidden" name="Teacher_id" value="<%=Teacher_id%>" />
		    <input type="hidden" name="Class_id" value="<%=Class_id%>" />
		    <input type="hidden" name="student_id" value="<%=student_id%>" />
		    <input type="submit" name="Submit" value="提交" />&nbsp;&nbsp;<input type="reset" name="Submit" value="取消" />
		  </p>
	</form>
</BODY>
</HTML>
<%
End sub
'保存密码的过程调用*******************************
Sub SavePassword()
    Dim Password,SavePasswordSql
	IF request.Form("ReapPassword") = "" or request.Form("Password")="" then 
	   Response.Write("<script>alert('密码或者重复密码不能为空,请返回检查!');history.go(-1);</script>")
	   response.End()
	END if   
	IF request.Form("ReapPassword") <> request.Form("Password") then
	   Response.Write("<script>alert('两次密码输入不一致,请返回检查!');history.go(-1);</script>")
	   response.End()
	END if   
	Password=md5(request.Form("Password"))
	SavePasswordSql="Update [Student] set [Student_pass]='"&Password&"' where [department_id]='"&request.Form("department_id")&"' and [teacher_id]='"&request.Form("teacher_id")&"' and [class_id]='"&request.Form("class_id")&"' and [Student_id]='"&request.Form("Student_id")&"'"
	Initialize_Conn.execute(SavePasswordSql)
	  Response.Write("<script>alert('密码修改成功,请您妥善保管。');location.href='admin_student.asp'; </script>")
	  Response.Cookies("Student_pass")=""
	  Response.Cookies("Student_pass")=Password
 End Sub
%>		

⌨️ 快捷键说明

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