This guestbook stores all of its data in a flat text file, so no database is needed. This makes it easy to use for people who want their own guestbook and have webspace with PHP support, but no access to a MySQL database, which often costs more and is not needed for smaller web projects. That does not mean that you have to live with less comfort - this script offers some features known from other guestbook and bulletin board / forum scripts, among them
This guestbook script does not need much; it basically comes down to this:
I created this script on 3 machines (my home machine, my office machine, my notebook) with Windows XP on all of them, Apache 1.3.26 and 1.3.27 as web server, and different PHP 4 versions. I also tested it on my own webspace for hettenhausen.net (don't ask me which operating system of web server they use), on my Linux box running Debian (sid), and on SourceForge.net for the demo. You probably saw it running before you downloaded it. I guess that means it it is very likely it will run on your webspace out-of-the-box, but for sure with a little tweaking. Contact me if you need help or post in the official flatPHPbook forums at the SourceForge project page.
The flatPHPbook archive contains the following files (in alphabetical order):
Just copy all these files into the same directory on your web space.
If you are upgrading beware:
Do not overwrite your old guestbook.db file or all your posts will be deleted and gone forever
(unless your server contains some undelete feature and you have access to it).
You might also want to make sure to check if you made any update to the guestbook.php file
(the "welcome message") and/or the stylesheet (guestbook.css) instead of creating your own/using a modified copy.
Welcome Messages now go into a separate file called welcomeMessage.html.
I will not explain FTP here, I guess you know how to work with this if you want to install this script. Of course, if you are really low on space: the license and this readme file are not necesary. But then, if you are that low on space, you should not run a guestbook...
You might have to explicitly label the script as "executable". You will see this is necessary if you know for sure that PHP is enabled for you but you only get to see the code instead of a nice looking guestbook.
To do so, load your favorite FTP program (I use SmartFTP on Windows and gFTP on Linux, but every ftp program should be fine), and open the directory where you put these files. Now this is where it is probably different with each FTP program - with SmartFTP you right-click on the file guestbook.php and select "Properties / CHMOD" from the context menu. At the bottom of the new window, you can set so-called flags ("read", "write", "execute") for either "user", "group" and "other", and also a field with a 3-digit number. The number has to be 660, which corresponds to executable for other.
The file guestbook.php is the PHP script itself, but you can of course open it with any text editor you have at hand and take a look at it.
Pretty much at the top, you can see a line reading
// global variables such as filenames and settings
and following that, some lines which configure some parts of the script. Some of these do not change anything visible (name of the guestbook database file), but others do change the behaviour (how many posts per page, sort order for posts, etc.). You really should change $adminusername and $adminpassword to something else. You can change everything else in there, it should be pretty much self explanatory with the variable names and the comments directly behind them.
I do not have any checks in there to catch problems if you set e.g. the number of posts per page to below zero - this is not something someone from outside is going to hack, and I think you will be wise enough to fill in valid numbers. After all, you want this to work...
The file guestbook.css is a CSS file for the guestbook. If you know how to write HTML and used CSS yourself, go ahead and play with it. This is just regular CSS, no magic involved. Make the guestbook fit your own webpage with this. If you do not know what CSS is, either be daring and play around, or go learn something about it first. There are some pretty good online tutorials for CSS and HTML.
The file guestbook.js contains the JavaScript functions for the buttons: the ones insert the BBcode into the message and those that make the help appear when hovering over the buttons. The same caveat as with the CSS applies: if you don't know this, you might break something while playing around with it.
This guestbook is brought to you by Thomas Hettenhausen and released under the GPL. I wrote this little script because I intended to move my web presence from a HTML-only host to one allowing PHP, but not MySQL (a matter of money), and I did not find any suitable PHP-based guestbook. Right now I do have MySQL, but hey - that does not mean I cannot finish a project I start! On the other hand, free guestbook services might have been ok, too, but they usually display advertisements, are often slow in response time (after all, they are free, and their companies do not want to spent lots of money for their free services), and they often are not exactly easy to modify in their appearance, so they never quite fit your web page design.
And since I am a student of computer science (at the University of Bielefeld, Germany), I might as well just write my own if I need it.
The editor I used writing this script is SciTE, an editor around the Scintilla cross-platform editing component. It's Open Source software, available for Win32 and GTK and really feature-rich (while not as hard to learn as Emacs...). Give it a try!
If you like this guestbook, drop me a line and tell me! I would love to hear from installations, and I can also put up links to some of the sites that use it.
Thomas Hettenhausen, July/August 2003
http://www.hettenhausen.net
flatPHPbook @ SourceForge
Here I will document e.g. the structure of the database file (guestbook.db) for all those who want to edit it manually.
Each line in this file represents a post, new ones being appended at the end of the file. The line consists of the entries in the post, separated by the delimiter stored in the variable $delimiter. The order of the fields is:
A typical line might look like this:
El Gringo::elgringo@provider.com::www.provider.com/elgringo/::2003-08-12::19:23:01::129.70.102.13::That is a nice guestbook you have!
This would show up in the guestbook as follows:
El Gringo | 2003-08-12, 19:23:01 |
![]() ![]() |
That is a nice guestbook you have! |