Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 03-04-2005, 09:52 PM Guest Book Help
Ogi
Novice Talker

Posts: 5
Trades: 0
I'm new to this forum. I was looking for a website forum where I could come at times when I'm stuck and get help, and I found this on google.com.

So my question is I'm having some problems with my GuestBook making.

This is what I have- \/

One file (Notepad): Form.html
(and in that one this is the info I put)

<center><a href=guestbook.asp>View Guestbook</a><p>
<FORM ACTION="guestbook.asp" METHOD=post>
<b>Name</b><br>
<input type=text name=visitorsname size=25><br>
<b>Email</b><br>
<input type=text name=visitorsemail size=25><br>
<b>Message</b><br>
<textarea name=visitorsmessage rows=6 Cols=40>
</textarea><BR>

<br><input type="submit" value="Submit">
<input type="reset" value="Restart">
</FORM><center>





Then I have another file: GuestBook.asp
(and this is what I have in there)

<%
Set fs = CreateObject("Scripting.FileSystemObject")
Folderpath=server.mappath("\") & "/cgi-bin/guestbook"
Wcounter=Folderpath &"/counter.txt"

if request.form<>"" then
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FolderExists(Folderpath) then
Set a = fs.OpenTextFile(Wcounter)
counter = Clng(a.ReadLine)
counter = counter + 1
a.close
else
Set a = fs.CreateFolder(Folderpath)
counter=1
end if

Set a = fs.CreateTextFile(Wcounter,True)
a.WriteLine(counter)
a.Close
Set fs=nothing

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(Folderpath & "\" & counter & ".txt")
a.WriteLine("<b><a HREF=mailto:" & Request.Form("visitorsname") & ">" & Request.Form("visitorsname") & "</a></b>")
a.WriteLine(Request.Form("visitorsmessage"))
a.Close
Set a=nothing
Set fs=nothing

end if

Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Folderpath)
Set fc = f.Files

Response.Write ("<HTML><HEAD><TITLE>Guest book</TITLE></HEAD>")
Response.Write ("<BODY BGCOLOR=FFFFFF>")
Response.Write ("<TABLE BORDER=0 Width=100" & CHR(37) & ">")
Response.Write ("<TR><TD BGCOLOR=C0C0C0>")
Response.Write ("<FONT SIZE=5><B>Guest book: posted messages</B></FONT>")
Response.Write ("</TD></TR></TABLE>")

For Each f1 in fc
Wfile=f1.name
if Wfile<>"counter.txt" then
FiletoCheck=Folderpath & "/" & Wfile
Set a=fs.OpenTextFile(FiletoCheck)
Theinfo=a.ReadAll
Response.write("<pre>" & Theinfo & "</pre><hr>")
end if
Next
'to show last message in the top,
'remove previous 4 lines and write next 4 lines instead
' Theinfo="<pre>" &a.ReadAll & "</pre><hr>" & Theinfo
' end if
'Next
'Response.write(Theinfo)
Response.write("<div align=right><font size=2>Script provided by <a href=http://www.asptutorial.info>asptutorial.info</a></font></div>")

Response.Write ("</BODY></HTML>")
%>

----------------------------------------------------------------------------------------
Everytime I try posting a message in it as a test it just goes into another IE window and shows the GuestBook.asp info?
What am I doing wrong here?


If anyone can help, post back here or contact me by email, my email is ostijacic@hotmail.com.
Thanks

Ogi. S

Last edited by Ogi; 03-04-2005 at 10:11 PM..
Ogi is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-05-2005, 09:41 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
You mean it shows the code of the page as text?
That most likely means your server is not set up to to process ASP Scripts. How you set it up depends on your server...
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to Guest Book Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10339 seconds with 12 queries