hi
i got some problem with this code it just won't work and i don't know where the problem is. becuse all the files exist. so i just wonder if anyone could help me with this here is the code :
Code:
<%
'-----------------------------------------
' ZERO ADMINISTRATION GUESTBOOK - Ver 1.30
' Copyright 2000-05 by Steven HTUT, Myanmars.NET. All rights reserved.
' dev@myanmars.net
'
' This asp code can be used/distributed free of charge, and
' this copyright notice should not be altered.
'-----------------------------------------
' SETUP INSTRUCTIONS
' Pls see at Zero Administration Guestbook - free ASP script
'-----------------------------------------
' CONFIGURE YOUR GUESTBOOK
'
Dim strFile, bDay, strBakFile, strDump, SiteTitle, WelcomeMessage, TextAttribute, LineAttribute, BodyAttribute, StyleDesp
SiteTitle = "My Zero Administration Guestbook"
WelcomeMessage = "Welcome to our guestbook. Please tell us what kind of thoughts, comments, or suggestions you have about our site..."
strFile = Server.MapPath("/guestbook.htm")
strLog = Server.MapPath("/guestbook.log")
LineAttribute = "<hr size='1' color='red'>" 'note the use of single quotes
TextAttribute = "<font face='Comic Sans MS' size='3' color='navy'>"
BodyAttribute = "<body bgcolor='#FFFFFF' link='#FF0000'>" 'note the use of single quotes
StyleDesp = "<style><!-- body { font-family: sans-serif; font-size: 10pt } A:hover { color: white; background-color: red; } A:link { color: red; } --> </style>"
'-----------------------------------------
' DON'T EDIT BELOW THIS LINE (except <!--#include virtual... line)
'-----------------------------------------
If Request.Form.Count = 0 Then
%>
<html><head>
<title>
<%
response.write (SiteTitle)
%>
Guestbook: thoughts, comments, suggestions...</title>
<% response.write (StyleDesp) %>
</head>
<% response.write (BodyAttribute) %>
<H1>
<% response.write (SiteTitle) %>
Guestbook</H1>
<% response.write (WelcomeMessage) %>
<FORM ACTION="guestbook.asp" METHOD="post">
<TABLE>
<TR>
<TD ALIGN="right" VALIGN="top"><B>Comment:</B></TD>
<TD><textarea rows="9" name="comment" cols="90"></textarea>
<TR>
<TD ALIGN="right"><B>Name:</B></TD>
<TD><INPUT TYPE="text" NAME="name" SIZE="30"></TD>
</TR>
<TR>
<TD ALIGN="right" valign="top"><B>Email:</B></TD>
<TD><INPUT TYPE="text" NAME="email" SIZE="30"><p>
<INPUT TYPE="submit" VALUE="Sign the Guestbook!"></INPUT></TD></TR>
</TABLE>
</FORM> <p>
<blockquote>
<H3>Thoughts, Comments, and Suggestions on
<%
response.write (SiteTitle) & "<br>"
response.write (MonthName(month(date)) & " " & year(date))
%>
</H3>
<!--#include virtual="/guestbook.htm"-->
</blockquote>
<%
response.Write (LineAttribute)
Else
'### CHECK DATE -- IF ANOTHER MONTH, BACKUP FILE
Dim objFSO, objFSOlog
Dim objFile, objFileLog
'### READ DATE LOG
Set objFSOlog = Server.CreateObject("Scripting.FileSystemObject")
Set objFileLog = objFSOlog.OpenTextFile(strLog, 1) '### OPEN GUESTBOOK.LOG
bDay = objFileLog.ReadAll
bDay = Trim(bDay)
objFileLog.Close
'### IF A MONTH ENDED
If Day(Date) < cByte(bDay) then
If Month(Date) = 1 then
strBakFile = Server.MapPath("" + Trim(CStr(year(date)-1)) +"-"+ "12.htm")
else
strBakFile = Server.MapPath("" + Trim(CStr(year(date))) +"-"+ Trim(CStr(month(date)-1)) + ".htm")
End if
response.write (strBakFile & "<br>")
'### DO BACK UP
'### READ OLD GUESTBOOK
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, 1) '### OPEN guestbook.htm
strDump = objFile.ReadAll
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
'### WRITE TO BAK FILE
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strBakFile, true)
objFile.write ("<html><head>")
objFile.write (StyleDesp + "</head>")
objFile.write (BodyAttribute)
objFile.write ("<h3>Guestbook of Year "+ Trim(CStr(year(date))) +", Month "+ Trim(CStr(month(date)-1))+"</h3>")
objFile.write (strDump)
objFile.write ("</body></html>")
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
'### INITIATE CURRENT GUESTBOOK
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(strFile, true)
objFile.write ("<hr size='1' color='red'>")
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
response.write ("Guestbook for the new month initiated...")
End If
'### Write the results to file
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile, 8, True)
objFile.Write (LineAttribute)
objFile.Write (TextAttribute)
objFile.Write Server.HTMLEncode(Request.Form("comment"))
objFile.Write "</p><p align='right'>"
objFile.Write Server.HTMLEncode(Request.Form("name"))
objFile.Write ", <a href='mailto:" & Server.HTMLEncode(Request.Form("email")) & "'>"
objFile.Write Server.HTMLEncode(Request.Form("email")) & "</a></font><br><font size='1'>"
objFile.Write now & " - ip address:"
objFile.Write (request.servervariables("remote_Addr")) & "</font></p>"
objFile.Close
'### WRITE DATE LOG
Set objFileLog = objFSOlog.OpenTextFile(strLog, 2, True)
objFileLog.Write Day(Date)
objFileLog.Close
Set objFile = Nothing
Set objFSO = Nothing
Set objFileLog = Nothing
Set objFSOlog = Nothing
%>
<H3>Your comments have been written to the file!</H3>
<A HREF="./guestbook.asp">Back to the guestbook</A><p>
<%
End If
%>
</body></html>