leName,UserInfo)
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(FileName) = False Then
fs.CreateTextFile (FileName)
End If
'以添加方式打开文件
Set f = fs.OpenTextFile(FileName, 8)
'用户信息开始标志
f.WriteLine ("`" & UserName & "`")
f.WriteLine (UserInfo)
'用户信息结束标志
f.WriteLine ("`e`")
f.Close
Set f = Nothing
Set fs = Nothing
End Sub
'读取用户信息
Function ReadUser(UserName,FileName)
Dim i
Dim s
Dim ret
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=false then
Set fs=Nothing
ReadUser=""
Exit Function
end if
'以只读方式打开文件
Set f = fs.OpenTextFile(FileName, 1)
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s = "`" & UserName & "`" Then
s = f.ReadLine
ret=""
Do While s <> "`e`"
if ret="" then
ret = ret + s
else
ret = ret + Chr(13) & Chr(10)+s
end if
s = f.ReadLine
Loop
Exit Do
End If
Loop
f.Close
Set f = Nothing
Set fs = Nothing
ReadUser = ret
End Function
'删除用户信息
Sub DeleteUser(UserName,FileName)
Dim i
Dim s
Dim tmp
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=false then
Set fs=Nothing
Exit Sub
end if
Set f = fs.OpenTextFile(FileName, 1)
tmp=""
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s <> "`" & UserName & "`" Then
if tmp="" then
tmp = tmp + s
else
tmp = tmp + Chr(13) & Chr(10)+ s
end if
Else
Do While s <> "`e`"
s = f.ReadLine
Loop
End If
Loop
f.Close
Set f = fs.CreateTextFile(FileName, True)
f.WriteLine tmp
f.Close
Set f = Nothing
Set fs = Nothing
End Sub
'修改用户信息
Sub ModifyUser(UserName,FileName,NewUserInfo)
Dim i
Dim s
Dim tmp
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=false then
Set fs=Nothing
Exit Sub
end if
Set f = fs.OpenTextFile(FileName, 1)
tmp=""
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s <> "`" & UserName & "`" Then
if tmp="" then
tmp = tmp + s
else
tmp = tmp + Chr(13) & Chr(10)+ s
end if
Else
Do While s <> "`e`"
s = f.ReadLine
Loop
if tmp="" then
tmp = tmp + "`" & UserName & "`"
else
tmp = tmp + Chr(13) & Chr(10)+ "`" & UserName & "`"
end if
tmp = tmp + Chr(13) & Chr(10)+ NewUserInfo
tmp = tmp + Chr(13) & Chr(10) + "`e`"
End If
Loop
f.Close
Set f = fs.CreateTextFile(FileName, True)
f.WriteLine tmp
f.Close
Set f = Nothing
Set fs = Nothing
End Sub
'判断用户是否已存在
Function UserExist(UserName,FileName)
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=False then
Set fs=Nothing
UserExist=False
Exit Function
end if
Set f = fs.OpenTextFile(FileName, 1)
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s = "`" & UserName & "`" Then
UserExist = True
Exit Function
End If
Loop
f.Close
Set f = Nothing
Set fs = Nothing
UserExist = False
End Function
%>
'********************index.htm*************************************
<html>
<body>
<a href="register.htm">用户注册 </a><br>
<a href="login.htm">用户登陆 </a><br>
<a href="modify.htm">用户修改 </a><br>
<a href="delete.htm">用户删除 </a><br>
</body>
</html>
'****************register.htm***************************************
<html>
<body>
用户注册
<form name="form1" method="post" action="regsubmit.asp">
<table border="0">
<tr>
<td width="28%">用户名</td>
<td width="72%">
<input type="text" name="edtUserNm">
</td>
</tr>
<tr>
<td width="28%">密码</td>
<td width="72%">
<input type="text" name="edtUserPwd">
</td>
</tr>
<tr>
<td width="28%">姓名</td>
<td width="72%">
<input type="text" name="edtNm">
</td>
</tr>
<tr>
<td width="28%">性别</td>
<td width="72%">
<input type="text
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(FileName) = False Then
fs.CreateTextFile (FileName)
End If
'以添加方式打开文件
Set f = fs.OpenTextFile(FileName, 8)
'用户信息开始标志
f.WriteLine ("`" & UserName & "`")
f.WriteLine (UserInfo)
'用户信息结束标志
f.WriteLine ("`e`")
f.Close
Set f = Nothing
Set fs = Nothing
End Sub
'读取用户信息
Function ReadUser(UserName,FileName)
Dim i
Dim s
Dim ret
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=false then
Set fs=Nothing
ReadUser=""
Exit Function
end if
'以只读方式打开文件
Set f = fs.OpenTextFile(FileName, 1)
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s = "`" & UserName & "`" Then
s = f.ReadLine
ret=""
Do While s <> "`e`"
if ret="" then
ret = ret + s
else
ret = ret + Chr(13) & Chr(10)+s
end if
s = f.ReadLine
Loop
Exit Do
End If
Loop
f.Close
Set f = Nothing
Set fs = Nothing
ReadUser = ret
End Function
'删除用户信息
Sub DeleteUser(UserName,FileName)
Dim i
Dim s
Dim tmp
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=false then
Set fs=Nothing
Exit Sub
end if
Set f = fs.OpenTextFile(FileName, 1)
tmp=""
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s <> "`" & UserName & "`" Then
if tmp="" then
tmp = tmp + s
else
tmp = tmp + Chr(13) & Chr(10)+ s
end if
Else
Do While s <> "`e`"
s = f.ReadLine
Loop
End If
Loop
f.Close
Set f = fs.CreateTextFile(FileName, True)
f.WriteLine tmp
f.Close
Set f = Nothing
Set fs = Nothing
End Sub
'修改用户信息
Sub ModifyUser(UserName,FileName,NewUserInfo)
Dim i
Dim s
Dim tmp
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=false then
Set fs=Nothing
Exit Sub
end if
Set f = fs.OpenTextFile(FileName, 1)
tmp=""
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s <> "`" & UserName & "`" Then
if tmp="" then
tmp = tmp + s
else
tmp = tmp + Chr(13) & Chr(10)+ s
end if
Else
Do While s <> "`e`"
s = f.ReadLine
Loop
if tmp="" then
tmp = tmp + "`" & UserName & "`"
else
tmp = tmp + Chr(13) & Chr(10)+ "`" & UserName & "`"
end if
tmp = tmp + Chr(13) & Chr(10)+ NewUserInfo
tmp = tmp + Chr(13) & Chr(10) + "`e`"
End If
Loop
f.Close
Set f = fs.CreateTextFile(FileName, True)
f.WriteLine tmp
f.Close
Set f = Nothing
Set fs = Nothing
End Sub
'判断用户是否已存在
Function UserExist(UserName,FileName)
Dim fs, f
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FileExists(FileName)=False then
Set fs=Nothing
UserExist=False
Exit Function
end if
Set f = fs.OpenTextFile(FileName, 1)
Do While f.AtEndOfStream <> True
s = f.ReadLine
If s = "`" & UserName & "`" Then
UserExist = True
Exit Function
End If
Loop
f.Close
Set f = Nothing
Set fs = Nothing
UserExist = False
End Function
%>
'********************index.htm*************************************
<html>
<body>
<a href="register.htm">用户注册 </a><br>
<a href="login.htm">用户登陆 </a><br>
<a href="modify.htm">用户修改 </a><br>
<a href="delete.htm">用户删除 </a><br>
</body>
</html>
'****************register.htm***************************************
<html>
<body>
用户注册
<form name="form1" method="post" action="regsubmit.asp">
<table border="0">
<tr>
<td width="28%">用户名</td>
<td width="72%">
<input type="text" name="edtUserNm">
</td>
</tr>
<tr>
<td width="28%">密码</td>
<td width="72%">
<input type="text" name="edtUserPwd">
</td>
</tr>
<tr>
<td width="28%">姓名</td>
<td width="72%">
<input type="text" name="edtNm">
</td>
</tr>
<tr>
<td width="28%">性别</td>
<td width="72%">
<input type="text