Post by JackWebb on Jun 23, 2009 0:38:36 GMT -5
I've been wanting to post some code here for a while, but I never seem to have enough time.. So here's one anyway. Hopefully I can post some more in the next few..?? Enjoy!
JackWebb
JackWebb
'-- ------------------------------------------------------
'-- RbGuestBook By JackWebb
'--
'-- Feel free to copy modify distribute and use as you wish.
'-- Give credit if you wish, but you don't have to
'--
'-- Thanks to E.K. Virtanen for the original concept
'-- I liked the simplicity and clean look of his guestbook,
'-- so I decided I wanted one to call my own.
'--
'-- Many thanks to the RunBASIC community for their help
'-- and support. And thanks to Carl Gundel for making
'-- RunBASIC a reality.
'--
'-- To install, just Copy then paste into your RB editor
'-- put in your own values for DefaultDir$, MyUrl$ and
'-- DefaultUserUrl$
'--
'-- RUN then modify the HTML pages to suit your website
'-- you can start over by deleteing the RbGuestBook directory
'-- ------------------------------------------------------
GLOBAL MyUrl$
DefaultDir$ = "c:\rbp101" '-- Default path to RB server
MyUrl$ = "http://YourUrlGoesHere.com" '-- Full HTTP URL to your server
DefaultUserUrl$ = "MySpace.com/UserName" '-- Default user URL or leave blank
CALL MakeFiles DefaultDir$ '-- You can REM this out after first run
CLS
HTML "<body bgcolor='aliceblue'>"
HTML "<center>"
HTML "<iframe src='" + MyUrl$ + "/rbguestbook/banner.htm' height='100' width='100%' align='top' scrolling='no' frameborder='0'></iframe>"
BUTTON #sign, "Sign", [SignGuestBook]
HTML "<iframe src='" + MyUrl$ + "/rbguestbook/MainLeftPanel.htm' height='400' width='20%' align='top' scrolling='no' frameborder='0'></iframe>"
HTML "<iframe src='" + MyUrl$ + "/rbguestbook/refresh.htm' height='400' width='60%' align='top' scrolling='yes' frameborder='0'></iframe>"
HTML "<iframe src='" + MyUrl$ + "/rbguestbook/MainRightPanel.htm' height='400' width='20%' align='top' scrolling='no' frameborder='0'></iframe>"
HTML "<iframe src='" + MyUrl$ + "/rbguestbook/footer.htm' height='100' width='60%' align='top' scrolling='no' frameborder='0'></iframe>"
HTML "</center>"
HTML "</body>"
WAIT
[SignGuestBook]
CLS
HTML "<body bgcolor='aliceblue'>"
HTML "<center>"
HTML "<iframe src='" + MyUrl$ + "/rbguestbook/banner.htm' height='100' width='100%' align='TOP' scrolling='no' frameborder='0'></iframe>"
HTML "</center>"
HTML "<font face='verdana' color='black'>Your Name: </font>"
TEXTBOX #PostedBy, "" : #PostedBy setfocus()
HTML "<font face='verdana' color='black'>Your URL: </font>"
TEXTBOX #UserURL, DefaultUserUrl$, 65
HTML "<font face='verdana' color='black'>Message: </font>"
TEXTAREA #MessageBody, "", 50, 3
BUTTON #save, "Save", [SaveMessage]
BUTTON #start, "Cancel", StartOver
HTML "</body>"
WAIT
[SaveMessage]
MessageBody$ = #MessageBody contents$()
IF TRIM$(MessageBody$) = "" THEN
CALL StartOver handle$
END IF
PostedBy$ = #PostedBy contents$()
IF TRIM$(PostedBy$) = "" THEN
PostedBy$ = "Someone"
END IF
UserURL$ = "<A href=http://" + #UserURL contents$() + " target='_blank'>"
OPEN DefaultDir$ + "\public\rbguestbook\guestbook.htm" FOR append AS #FreeFile
PRINT #FreeFile, "<fieldset>"
PRINT #FreeFile, "<legend> On " + Date$() + " " + UserURL$ + PostedBy$ + "</A>" + " Wrote:</legend>"
PRINT #FreeFile, "<p>"
PRINT #FreeFile, MessageBody$
PRINT #FreeFile, "</p>"
PRINT #FreeFile, "</fieldset>"
CLOSE #FreeFile
CALL StartOver handle$
SUB MakeFiles DefaultDir$ '-- Only used for first run
X = MKDIR(DefaultDir$ + "\public\RBguestBook") '-- Used to test if directory exist's.
IF X >= 0 THEN '-- If not then create dirctory + files.
OPEN DefaultDir$ + "\public\RBguestBook\Refresh.htm" FOR output AS #FreeFile '-- Initialise HTML files when no directory exists
PRINT #FreeFile, "<html>"
PRINT #FreeFile, "<head>"
PRINT #FreeFile, "<meta http-equiv=""refresh"" content=""0;url=" + MyUrl$ + "/rbguestbook/guestbook.htm""/>"
PRINT #FreeFile, "</head>"
PRINT #FreeFile, "</html>"
CLOSE #FreeFile
OPEN DefaultDir$ + "\public\RBguestBook\GuestBook.htm" FOR binary AS #FreeFile
PRINT #FreeFile, "<html>"
PRINT #FreeFile, "<head>"
PRINT #FreeFile, "<style type='text/css'>"
PRINT #FreeFile, "a { text-decoration:none }"
PRINT #FreeFile, "</style>"
PRINT #FreeFile, "<style fprolloverstyle>A:hover"
PRINT #FreeFile, " {"
PRINT #FreeFile, " COLOR: red; FONT-WEIGHT: bold"
PRINT #FreeFile, " }"
PRINT #FreeFile, "</style>"
PRINT #FreeFile, "</head>"
PRINT #FreeFile, "<body bgcolor='aliceblue' vlink='blue' alink='blue'>"
PRINT #FreeFile, "</body>"
PRINT #FreeFile, "<font face='verdana' color='black'>"
CLOSE #FreeFile
OPEN DefaultDir$ + "\public\RBguestBook\Banner.htm" FOR output AS #FreeFile
PRINT #FreeFile, "<html>"
PRINT #FreeFile, "<body bgcolor='black'>"
PRINT #FreeFile, "<font face='verdana' color='blue'>"
PRINT #FreeFile, "<h1>Sign My Guestbook!</h1>"
PRINT #FreeFile, "</font>"
PRINT #FreeFile, "</body>"
PRINT #FreeFile, "</html>"
CLOSE #FreeFile
OPEN DefaultDir$ + "\public\RBguestBook\Footer.htm" FOR output AS #FreeFile
PRINT #FreeFile, "<body bgcolor='aliceblue' link='black' vlink='black'>"
PRINT #FreeFile, "<br><br>"
PRINT #FreeFile, "<fieldset>"
PRINT #FreeFile, "<p align='center'>"
PRINT #FreeFile, "<font face='verdana' size='1' color='black'>"
PRINT #FreeFile, "RBguestBook CopyLeft 2009 Programmed By JackWebb, Powered By"
PRINT #FreeFile, "<A href='http://runbasic.com' target='_blank'>RunBASIC!</a>"
PRINT #FreeFile, "</font>"
PRINT #FreeFile, "</p>"
PRINT #FreeFile, "</fieldset>"
PRINT #FreeFile, "</body>"
CLOSE #FreeFile
OPEN DefaultDir$ + "\public\RBguestBook\MainRightPanel.htm" FOR output AS #FreeFile
PRINT #FreeFile, "<html>"
PRINT #FreeFile, "<head>"
PRINT #FreeFile, "<style fprolloverstyle>A:hover"
PRINT #FreeFile, " {"
PRINT #FreeFile, " COLOR: red; FONT-WEIGHT: bold"
PRINT #FreeFile, " }"
PRINT #FreeFile, "</style>"
PRINT #FreeFile, "</head>"
PRINT #FreeFile, "<body bgcolor='aliceblue' link='blue' vlink='blue' alink='blue'>"
PRINT #FreeFile, "<p align=center>"
PRINT #FreeFile, "<a href='http://google.com' target='_blank'>"
PRINT #FreeFile, " <FONT face='verdana'>"
PRINT #FreeFile, " Your Ad Here"
PRINT #FreeFile, "</a>"
PRINT #FreeFile, "</font>"
PRINT #FreeFile, "</p>"
PRINT #FreeFile, "</body>"
PRINT #FreeFile, "</html>"
CLOSE #FreeFile
OPEN DefaultDir$ + "\public\RBguestBook\MainLeftPanel.htm" FOR output AS #FreeFile
PRINT #FreeFile, "<html>"
PRINT #FreeFile, "<head>"
PRINT #FreeFile, "<style fprolloverstyle>A:hover"
PRINT #FreeFile, " {"
PRINT #FreeFile, " COLOR: red; FONT-WEIGHT: bold"
PRINT #FreeFile, " }"
PRINT #FreeFile, "</style>"
PRINT #FreeFile, "</head>"
PRINT #FreeFile, "<body bgcolor='aliceblue' link='blue' vlink='blue' alink='blue'>"
PRINT #FreeFile, "<p align=center>"
PRINT #FreeFile, "<a href='http://google.com' target='_blank'>"
PRINT #FreeFile, " <FONT face='verdana'>"
PRINT #FreeFile, " Your Ad Here"
PRINT #FreeFile, "</a>"
PRINT #FreeFile, "</font>"
PRINT #FreeFile, "</p>"
PRINT #FreeFile, "</body>"
PRINT #FreeFile, "</html>"
CLOSE #FreeFile
END IF
END SUB
SUB StartOver handle$
EXPIRE MyUrl$ + "/seaside/go/runbasicpersonal?app=RBguestBook"
END
END SUB