向記事本里寫入數據、一個修改密碼的判斷方法(用記錄本處理密碼的方式)

<%@language="Vbscript"%>
<% Response.Expires=0 %>
<% if Session("fz_login") = "8" then %>
<%
  if Request.ServerVariables("HTTP_METHOD")="POST" And checkme<>"true" then
      username=Request.Form("username")
      password=Request.Form("password")
      set fs=server.CreateObject("Scripting.FileSystemObject")
      Set f = fs.OpenTextFile(server.MapPath("userpw.asp"), 2, True)
      f.writeline "<%"
      f.writeline "P_username=" & chr(34) & username & chr(34)
      f.writeline "P_password=" & chr(34) & password & chr(34)
      f.writeline chr(37) & ">"
      f.close
      set f=nothing
      set fs=nothing
      session("logusername")=username
      session("logpassword")=password
      edit_ok
  end if
%>
<%sub edit_ok()%>
<script language="javascript">
  alert("您的用戶名與密碼已成功修改!");
  document.location.href="welcome.htm";
</script>
<%end sub%>

<script language="javascript">
function checkform(){
  if (document.form1.username.value==""){
      alert("請輸入新用戶名,並不能爲空!");
      document.form1.username.focus();
      return false;
  }
 
  if (document.form1.password.value==""){
      alert("請輸入新密碼!");
      document.form1.password.focus();
      return false;
  }
 
  if (document.form1.username.value.length<6 || document.form1.password.value.length<6){ 
      alert("爲了網絡安全,請輸入大於6個字符的用戶名和密碼!");
      document.form1.username.value="";
      document.form1.password.value="";
      document.form1.password1.value="";
      return false;
  }
 
  if (document.form1.password1.value!=document.form1.password.value){
      alert("您輸入的密碼不一致!");
      document.form1.password1.focus();
      document.form1.password1.value="";
      return false;  
  }
     
  if (confirm("您真的要修改密碼嗎?")==false){
      document.location.href="welcome.htm";
      return false;}
  else
      return true;       

}
</script>
<html><head><title>修改密碼</title>
<META NAME="robots" CONTENT="none">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="images/font.css" type="text/css">
</head>

<body bgcolor="#9CC7EF" leftMargin=0 marginwidth="0" topmargin=0>
<table width=530 border="0" cellspacing="0" cellpadding="0" align="center"> 
  <tr align="center" bgcolor="<%=main_color%>">
    <td>
      <table width="100%" border="1" cellspacing="1" cellpadding="4" class="p9" bordercolorlight="#1059A5" bordercolordark="#9CC7EF">
        <form name="form1" method="post" action="edit_pws.asp" οnsubmit="javascript:return checkform();">
          <tr>
            <td height="40">
              <div align="center" ><span style="font-size:14.9px"><b><font color="<%=maintitle_color%>">修
                改 管 理 員 帳 號</font></b></span></div>
            </td>
          </tr>               
          <tr bgcolor="<%=textzero_color%>">
            <td height="30" align="center"> 新用戶名:<input type="text" name="username" size=30 class="p9"> 
            </td>
          </tr>
          <tr bgcolor="<%=textzero_color%>">
            <td align="center" height="30"> 新  密  碼:<input type="password" name="password" size=30 class="p9">
            </td>
          </tr>
          <tr bgcolor="<%=textzero_color%>">
            <td align="center" height="30">驗證密碼:<input type="password" name="password1" size=30 class="p9">
             </td>
          </tr>
          <tr height="30" bgcolor="<%=textzero_color%>">
            <td align="center">
                <input type="submit" name="Submit" value="  保 存  " class="s02" style="height:27; width:82">
                &nbsp;&nbsp;&nbsp;&nbsp
                <input type="reset" name="close" value="  取 消  " class="s02" style="height:27; width:82">            
            </td>
          </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
<%else%>
<% response.redirect "login.asp" %>
<%end if%>

 

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1839860

 
發佈了39 篇原創文章 · 獲贊 1 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章