向記事本裡寫入資料、一個修改密碼的判斷方法
來源:互聯網
上載者:User
<%@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="";