<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../inc/setup.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/sql.asp"-->
<%
	End If
	action=Trim(Request.QueryString("action"))
	
	if action="pwd" then
		username=ReplaceBadChar(Trim(Request.Form("username")))
		password=mistake(Trim(Request.Form("password")))
		newpassword=mistake(Trim(Request.Form("newpassword")))
		set rs=server.createobject("adodb.recordset")
		sql="select * from school where sname='"&ReplaceBadChar(Request.Cookies("admin_school_name"))&"' and pwd='"&password&"'"
		rs.open sql,conn,2,3
		if rs.eof and rs.bof then
			response.write"<SCRIPT language=JavaScript>alert('对不起原密码错误，现在正为您返回，请稍等');"
			response.write"window.location.href = 'pwd.asp'"&" </script>"
		else
		rs("pwd")=newpassword
		email=rs("email")
		rs.update
		set rs=nothing
		
   
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * from sendmail"
	rs.open sql,conn,1,1
	if rs("open1")=0 then
	mailaddress=rs("mailaddress")
	mailusername=rs("mailusername")
	mailuserpass=rs("mailuserpass")
	mailname=rs("mailname")
	mailsend=rs("mailsend")


	'发送邮件
	'if Forum_Setting(47)=1 then
	On Error Resume Next
	'发送注册邮件
	topic="["&homename&"]信息：您在"&homename&"的修改密码的资料"
	
	mailbody="<html>"
	mailbody=mailbody & "<title>用户信息</title>"
	mailbody=mailbody & "<body>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	mailbody=mailbody & ""&Request.Cookies("admin_school_name")&"，您好：<br><br>"
	mailbody=mailbody & "您在"&homename&"注册的帐号信息发生改变，下面是你最新的帐号信息！<br>"
	mailbody=mailbody & "下面是您在"&homename&"的注册信息：<br><br>"
	mailbody=mailbody & "注册名："&Request.Cookies("admin_school_name")&"<br>"
	mailbody=mailbody & "密  码："&Trim(Request.Form("newpassword"))&"<br>"
	mailbody=mailbody & "网站地址：<a href='"&homeurl&"' target='_blank'>"&homeurl&"</a><br><br>"
	mailbody=mailbody & ""&rs("mailtext")&"<br><br><br>"
	mailbody=mailbody & "<center><font color=red>再次感谢您注册"&homename&"</font>"
	mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
	mailbody=mailbody & "</body>"
	mailbody=mailbody & "</html>"
	rs.close
	
	Set JMail=Server.CreateObject("JMail.Message")
	JMail.Charset="gb2312"
	JMail.ContentType = "text/html"
	jmail.from = mailsend
	jmail.silent = true
	jmail.Logging = true
	jmail.FromName = mailname
	jmail.mailserverusername = mailusername
	jmail.mailserverpassword = mailuserpass
	jmail.AddRecipient email
	jmail.body=mailbody
	JMail.Subject=topic
	if not jmail.Send ( mailaddress ) then
	SendMail=""
	else
	SendMail="OK"
	end if
	if SendMail="OK" then
	sendmsg="<p>· 您的注册信息已经发往您的邮箱，请注意查收!</p>"
	else
	sendmsg="<p>· 系统出错，注册信息资料未能发送到您的邮箱!</p>"
	end if
	else
	rs.close
	end if   
		
			response.write"<SCRIPT language=JavaScript>alert('密码修改成功，现在正为您返回，请稍等');"
			response.write"window.location.href = 'pwd.asp'"&" </script>"
		end if
		
	end if
	
	if action="answer" then
		username=ReplaceBadChar(Trim(Request.Form("username")))
		question=Trim(Request.Form("question"))
		answer=Trim(Request.Form("answer"))
		set rs=server.createobject("adodb.recordset")
		sql="select * from school where sname='"&username&"'"
		rs.open sql,conn,2,3
		if rs.eof and rs.bof then
			response.write"<SCRIPT language=JavaScript>alert('对不起系统出错，现在正为您返回，请稍等');"
			response.write"window.location.href = 'pwd.asp'"&" </script>"
		else
		rs("question")=question
		rs("answer")=answer
		email=rs("email")
		rs.update
		set rs=nothing
		
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * from sendmail"
	rs.open sql,conn,1,1
	if rs("open1")=0 then
	mailaddress=rs("mailaddress")
	mailusername=rs("mailusername")
	mailuserpass=rs("mailuserpass")
	mailname=rs("mailname")
	mailsend=rs("mailsend")


	'发送邮件
	'if Forum_Setting(47)=1 then
	On Error Resume Next
	'发送注册邮件
	topic="您在"&homename&"的修改密码保护问题的资料"
	
	mailbody="<html>"
	mailbody=mailbody & "<title>用户信息</title>"
	mailbody=mailbody & "<body>"
	mailbody=mailbody & "<TABLE border=0 width='95%' align=center><TBODY><TR>"
	mailbody=mailbody & "<TD valign=middle align=top>"
	mailbody=mailbody & ""&Request.Cookies("admin_school_name")&"，您好：<br><br>"
	mailbody=mailbody & "您在"&homename&"注册的帐号信息发生改变，下面是你最新的帐号信息！<br>"
	mailbody=mailbody & "下面是您在"&homename&"的注册信息：<br><br>"
	mailbody=mailbody & "注册名："&Request.Cookies("admin_school_name")&"<br>"
	mailbody=mailbody & "密码保护问题："&question&"<br>"
	mailbody=mailbody & "密码保护答案："&Trim(Request.Form("answer"))&"<br>"
	mailbody=mailbody & "网站地址：<a href='"&homeurl&"' target='_blank'>"&homeurl&"</a><br><br>"
	mailbody=mailbody & ""&rs("mailtext")&"<br><br><br>"
	mailbody=mailbody & "<center><font color=red>再次感谢您注册"&homename&"</font>"
	mailbody=mailbody & "</TD></TR></TBODY></TABLE><br><hr width=95% size=1>"
	mailbody=mailbody & "</body>"
	mailbody=mailbody & "</html>"
	rs.close
	
	Set JMail=Server.CreateObject("JMail.Message")
	JMail.Charset="gb2312"
	JMail.ContentType = "text/html"
	jmail.from = mailsend
	jmail.silent = true
	jmail.Logging = true
	jmail.FromName = mailname
	jmail.mailserverusername = mailusername
	jmail.mailserverpassword = mailuserpass
	jmail.AddRecipient email
	jmail.body=mailbody
	JMail.Subject=topic
	if not jmail.Send ( mailaddress ) then
	SendMail=""
	else
	SendMail="OK"
	end if
	if SendMail="OK" then
	sendmsg="<p>· 您的注册信息已经发往您的邮箱，请注意查收!</p>"
	else
	sendmsg="<p>· 系统出错，注册信息资料未能发送到您的邮箱!</p>"
	end if
	'response.write mailbody
	'end if
	else
	rs.close
	end if   
		
			response.write"<SCRIPT language=JavaScript>alert('密码问题修改成功，现在正为您返回，请稍等');"
			response.write"window.location.href = 'pwd.asp'"&" </script>"
		end if
	end if
	
%>
<HTML>
<head>
<meta http-equiv=Content-Language content=zh-cn>
<meta http-equiv=Content-Type content=text/html; charset=gb2312>
<link href="images/1.css" rel="stylesheet" type="text/css">
<link href="images/2.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../inc/checkpwd.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
   if(checkspace(document.userinfo.password.value)) {
	document.userinfo.password.focus();
    alert("对不起，请填写旧密码！");
	return false;
  }
  if(document.userinfo.newpassword.value != document.userinfo.confirmpassword.value) {
	document.userinfo.newpassword.focus();
	document.userinfo.newpassword.value = '';
	document.userinfo.confirmpassword.value = '';
    alert("两次输入的新密码不同，请重新输入！");
	return false;
  }
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkuser()
{
   if(checkspace(document.answer.question.value)) {
	document.answer.question.focus();
    alert("对不起，请填写密码提问！");
	return false;
  }
  if(document.answer.answer.value != document.answer.confirmanswer.value) {
	document.answer.answer.focus();
	document.answer.answer.value = '';
	document.answer.confirmanswer.value = '';
    alert("两次输入的答案不同，请重新输入！");
	return false;
  }
}
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>
</head>
<body topmargin="0">
<%
	set rs=server.createobject("adodb.recordset")
	sql="select * from school where sname='"&Request.Cookies("admin_school_name")&"'"
	rs.open sql,conn,1,1
	if rs.eof then
		response.write"<SCRIPT language=JavaScript>alert('非法操作！');"
		response.write"this.location.href='login.asp';</SCRIPT>"
		response.end
	else
%>
<table width="550"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="images/m_11.gif" width="550" height="9"></td>
  </tr>
  <tr>
    <td background="images/m_13.gif">
      <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top"><img src="images/jianli-8.gif" width="136" height="33"></td>
        </tr>
		<TR>
          <TD bgColor=#83b629 height=21><FONT style="FONT-SIZE: 13px" face=Verdana color=#ffffff><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;帐号密码维护</STRONG></FONT></TD>
         </TR>
		 <tr><TD height=5></TD></TR>
 		<tr>
          <td valign="top">
<form name="userinfo" action="?action=pwd" method="post" onSubmit="return check()">
                  <TABLE width=42% border=0 align="center" cellPadding=0 cellSpacing=1 bgcolor="#E8E8E8">
                    <TBODY>
                      <TR>
                        <TD bgcolor="#FFFFFF">
						<TABLE height=0 cellSpacing=0 cellPadding=0 width="100%" border=0>
                            <TBODY>
                              <TR>
                                <TD></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                          <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                              <TBODY>
                                <TR>
                                  <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 用 户 名 ：
                                    <input name="username" type="text" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" value="<%= Request.Cookies("admin_school_name") %>" maxlength="20"  readonly>
                                          <BR>
                                  </div></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                              <TBODY>
                                <TR>
                                  <TD background="../company/images/contents_dotline.gif" height=5></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                              <TBODY>
                                <TR>
                                  <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 原 密 码 ：
                                    <input name="password" type="password" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" maxlength="20">
                                          <BR>
                                  </div></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                              <TBODY>
                                <TR>
                                  <TD background=../company/images/contents_dotline.gif height=5></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                              <TBODY>
                                <TR>
                                  <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 新 密 码 ：
                                    <input name="newpassword" type="password" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" maxlength="20" onChange="javascript:EvalPwd(this.value);" onKeyUp="javascript:EvalPwd(this.value);"><BR>
                                    <table width="284" border="0">
                                      <tr>
                                        <td width="77">&nbsp;</td>
                                        <td width="197"><table width="100%" height="20" border="0" cellpadding="0" cellspacing="0" id="pwdpower">
                                          <tr>
                                            <td align="center" id="pweak" style="">弱</td>
                                            <td align="center" id="pmedium" style="">中</td>
                                            <td align="center" id="pstrong" style="">强</td>
                                          </tr>
                                        </table></td>
                                      </tr>
                                    </table>
                                  </div>
								  </TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                              <TBODY>
                                <TR>
                                  <TD background=../company/images/contents_dotline.gif height=5></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                              <TBODY>
                                <TR>
                                  <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 确认密码 ：
                                    <input name="confirmpassword" type="password" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" maxlength="20">
                                          <BR>
                                  </div></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                              <TBODY>
                                <TR>
                                  <TD background=../company/images/contents_dotline.gif height=5></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                              <TBODY>
                                <TR>
                                  <TD width="100%" height="30"><div align="center">
                                      <input type="submit" name="Submit" value="确 定" style="width:60px;font-size:12px;">
                                    
                                    <input type="reset" name="botton2" value="清空" style="width:60px;font-size:12px;">
                                    <BR>
                                  </div></TD>
                                </TR>
                              </TBODY>
                          </TABLE>
                          <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                              <TBODY>
                                <TR>
                                  <TD background=../company/images/contents_dotline.gif height=5></TD>
                                </TR>
                              </TBODY>
                          </TABLE></TD>
                      </TR>
                    </TBODY>
                  </TABLE>
              </form>
		  </td>
        </tr>
		<tr><TD height=5></TD></TR>
		<tr><TD bgColor=#83b629 height=21><FONT style="FONT-SIZE: 13px" face=Verdana color=#ffffff><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;帐号密码维护</STRONG></FONT></TD>
         </TR>
		<tr><TD height=5></TD></TR>
 		<tr>
          <td valign="top"><form name="answer" action="?action=answer" method="post" onSubmit="return checkuser()">
            <TABLE width=42% border=0 align="center" cellPadding=0 cellSpacing=1 bgcolor="#E8E8E8">
              <TBODY>
                <TR>
                  <TD bgcolor="#FFFFFF">
				  <TABLE height=0 cellSpacing=0 cellPadding=0 width="100%" border=0>
                    <TBODY>
                      <TR>
                        <TD></TD>
                      </TR>
                    </TBODY>
                  </TABLE>
                          <div align="center"> </div>
                    <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                            <TBODY>
                              <TR>
                                <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 用 户 名 ：
                                  <input name="username" type="text" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" value="<%= Request.Cookies("admin_school_name") %>" maxlength="20" readonly>
                                        <BR>
                                </div></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                            <TBODY>
                              <TR>
                                <TD background=../company/images/contents_dotline.gif height=5></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                            <TBODY>
                              <TR>
                                <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 新提示问题 ：
                                  <input name="question" type="text" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" maxlength="20">
                                        <BR>
                                </div></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                            <TBODY>
                              <TR>
                                <TD background=../company/images/contents_dotline.gif height=5></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                            <TBODY>
                              <TR>
                                <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 新回复答案 ：
                                  <input name="answer" type="text" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" maxlength="20">
                                        <BR>
                                </div></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                            <TBODY>
                              <TR>
                                <TD background=../company/images/contents_dotline.gif height=5></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                            <TBODY>
                              <TR>
                                <TD width="100%" height="30"><div align="center"><span class="style61">*</span> 确认回复答案 ：
                                  <input name="confirmanswer" type="text" style="width:200px;font-size:12px;border:0; border-bottom:1 solid #999999;" maxlength="20">
                                        <BR>
                                </div></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                            <TBODY>
                              <TR>
                                <TD background=../company/images/contents_dotline.gif height=5></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE cellSpacing=0 cellPadding=3 width="100%" border=0>
                            <TBODY>
                              <TR>
                                <TD width="100%" height="30"><div align="center">
                                    <input type="submit" name="Submit2" value="确 定" style="width:60px;font-size:12px;">
                                    <input type="reset" name="botton22" value="清空" style="width:60px;font-size:12px;">
                                    <BR>
                                </div></TD>
                              </TR>
                            </TBODY>
                          </TABLE>
                    <TABLE width=450 border=0 align="center" cellPadding=0 cellSpacing=0>
                            <TBODY>
                              <TR>
                                <TD background=../company/images/contents_dotline.gif height=5></TD>
                              </TR>
                            </TBODY>
                        </TABLE></TD>
                </TR>
              </TBODY>
            </TABLE>
          </form>
		  </td>
		</tr>
      </table>
   </td>
  </tr>
  <tr>
    <td background="images/m_13.gif"></td>
  </tr>
  <tr>
    <td><img src="images/m_12.gif" width="550" height="9"></td>
  </tr>
</table>
<%
	End If
%>
</body>
</html>