Default.asp如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Default.asp</title>
</head><body>
<form action="SaveForm.asp" method="post">
用户名 <input name="uname" value=""> <br>
标 题 <input name="title" value=""> <br>
内 容 <br>
<textarea name="content" cols="40" rows="20"> </textarea> <br>
<input type=submit value="确定">
<input type=submit value="取消"> <br>
</form>
Copyright Vicent Corp. 1998--2005
</body>
</html>SaveForm.asp如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
ForReading=1
ForAppending=8
TristateUseDefault= -2
TristateTrue= -1
TristateFalse=0
servermap=server.MapPath("\bbs\log\")
'servermap=server.MapPath("\bbs\log\")
'temp=servermap&year(date)&month(date)&"\"
temp=servermap&year(date)&month(date)&"\"
if Not fs.FolderExists(temp) then
fs.CreateFolder(temp)
end if
dim syslog
dim tempname
dim tempfile
tempname=date
syslog=temp&tempname&".log"
user=Request.Form("uname")
letter=Request.Form("title")
text=Request.Form("content")
li=user& "&" &Now& "&" &Request.ServerVariables("REMOTE_ADDR")& "&" &tempfile& "&" &letter& "&" &text
if fs.FileExists(syslog) then
Set ss=fs.OpenTextFile(syslog,ForAppending,true)
Else
Set ss=fs.CreateTextFile(syslog,ForWriting,false)
end if
ss.WriteLine(li)
ss.Close'----------log文件写入结束----------'
'Response.Redirect("ShowForm.asp")
%>
</body>
</html>ShowForm.asp如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>留言板</title>
</head><body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
servermap=Server.MapPath("\bbs\log"&year(date)&month(date)&"\")
syslog=servermap&date&".log"
Set ts=fs.OpentextFile(syslog,1) <-- 说这文件未找到 ??
Response.Write (ts.readAll)
ts.Close
%>
</body>
</html>
在填写Defaule.asp网页后,点击确定后内容保存在 log 里,运行后出错,老师说主要是 ShowForm.asp 的问题
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Default.asp</title>
</head><body>
<form action="SaveForm.asp" method="post">
用户名 <input name="uname" value=""> <br>
标 题 <input name="title" value=""> <br>
内 容 <br>
<textarea name="content" cols="40" rows="20"> </textarea> <br>
<input type=submit value="确定">
<input type=submit value="取消"> <br>
</form>
Copyright Vicent Corp. 1998--2005
</body>
</html>SaveForm.asp如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
ForReading=1
ForAppending=8
TristateUseDefault= -2
TristateTrue= -1
TristateFalse=0
servermap=server.MapPath("\bbs\log\")
'servermap=server.MapPath("\bbs\log\")
'temp=servermap&year(date)&month(date)&"\"
temp=servermap&year(date)&month(date)&"\"
if Not fs.FolderExists(temp) then
fs.CreateFolder(temp)
end if
dim syslog
dim tempname
dim tempfile
tempname=date
syslog=temp&tempname&".log"
user=Request.Form("uname")
letter=Request.Form("title")
text=Request.Form("content")
li=user& "&" &Now& "&" &Request.ServerVariables("REMOTE_ADDR")& "&" &tempfile& "&" &letter& "&" &text
if fs.FileExists(syslog) then
Set ss=fs.OpenTextFile(syslog,ForAppending,true)
Else
Set ss=fs.CreateTextFile(syslog,ForWriting,false)
end if
ss.WriteLine(li)
ss.Close'----------log文件写入结束----------'
'Response.Redirect("ShowForm.asp")
%>
</body>
</html>ShowForm.asp如下:<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>留言板</title>
</head><body>
<%
Set fs=Server.CreateObject("Scripting.FileSystemObject")
servermap=Server.MapPath("\bbs\log"&year(date)&month(date)&"\")
syslog=servermap&date&".log"
Set ts=fs.OpentextFile(syslog,1) <-- 说这文件未找到 ??
Response.Write (ts.readAll)
ts.Close
%>
</body>
</html>
在填写Defaule.asp网页后,点击确定后内容保存在 log 里,运行后出错,老师说主要是 ShowForm.asp 的问题
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货