Old 04-21-2009   #1 (permalink)
Registered User
 
Rtouch's Avatar
 

Join Date: Oct 2006
Location: Sweden,Eksjö
Posts: 398
Images: 192

Question problem with asp code

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>&nbsp;<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>
__________________
Retouch me...

Last edited by Man1c M0g; 04-21-2009 at 06:57 PM.
Rtouch is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-21-2009   #2 (permalink)
Janitor of Lunacy
 
Tamlin's Avatar
 

Join Date: May 2006
Location: Sitting in the Wishing Chair
Posts: 5,758
Blog Entries: 2
Images: 530

Battle Wins: 20 (rank: #1)
Quote:
Originally Posted by Rtouch View Post
it just won't work
I'd need a bit more to go on than that.
Error messages? Have you tried contacting the script's author? (his email address is in the code)
__________________

"I might join your century, but only as a doubtful guest"
Tamlin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-22-2009   #3 (permalink)
Janitor of Lunacy
 
Tamlin's Avatar
 

Join Date: May 2006
Location: Sitting in the Wishing Chair
Posts: 5,758
Blog Entries: 2
Images: 530

Battle Wins: 20 (rank: #1)
OK - I had a bit of spare time so I had a look at this.

When you run it, do you get a "permission denied" error at line 125? That's this line:
Code:
Set objFile = objFSO.OpenTextFile(strFile, 8, True)
If so, it's because you need to grant Write permission on your target folder (on your web server) to the IUSR_ account.

I've tried it and that fixed it for me. If you're getting a different error, you'll need to post the text of the error message.
__________________

"I might join your century, but only as a doubtful guest"

Last edited by Tamlin; 04-22-2009 at 06:15 AM.
Tamlin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-24-2009   #4 (permalink)
Registered User
 
Rtouch's Avatar
 

Join Date: Oct 2006
Location: Sweden,Eksjö
Posts: 398
Images: 192

hi
thanks for the help by the way
but i solved i put it on another server and i just changed the server.mappath and the
<!--#include virtual... line>
and it worked.
but thanks again for the help
__________________
Retouch me...

Last edited by Rtouch; 04-28-2009 at 06:35 PM.
Rtouch is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-28-2009   #5 (permalink)
Registered User
 
Rtouch's Avatar
 

Join Date: Oct 2006
Location: Sweden,Eksjö
Posts: 398
Images: 192

you can check the site out if you want to the adress is:
Ask u: Home

hope the link will work and you can also write me some feedback on it if you want to.
I would actullay like if you give me some feedback.

see ya
__________________
Retouch me...
Rtouch is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worpress Code help altus HTML / PHP / ASP / JS 2 04-02-2008 02:11 AM
Code Issues SaikonoYume HTML / PHP / ASP / JS 3 04-21-2007 06:48 PM
Code DevineBabyGurl HTML / PHP / ASP / JS 2 09-26-2006 10:40 AM
Php Code Denial HTML / PHP / ASP / JS 1 06-17-2005 09:15 AM
Two code requests Denial HTML / PHP / ASP / JS 3 06-14-2005 06:32 AM


All times are GMT +1. The time now is 08:07 PM.

Powered by vBulletin Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT