Comment-Guestbook Script Version 1.2

Thank you for trying out my little script. This project was born when I was looking for something in between a guestbook and a shoutbox, and couldn't find one quite like I wanted. The original version was hard-coded to my site, and administration was done through phpMyAdmin. One day, someone asked if they could borrow my script, and many hours later I came up with this version. This can be used on any site that has PHP and a MySQL database of any recent versions.

Features:

Configuration and Installation:

1.

Download the zipped package name 'commentsv12-dist.zip' and extract its contents (you might have done that already). You should have folder named 'commentsv12' containing:

In the docs folder - No need to upload this to your server:

2.

Before uploading the files to your server you need to modify some values in the main script, 'comments.php'. They are contained in a section labelled **SET THE VARIABLES BELOW** . The following instructions are repeated within the script file itself. It is clearly marked in the script when you should stop editing. You will need to use a text editor like Notepad, or similar. Don't use a word processor, as it will introduce formatting codes into the script that will make it not function. Here's the information you need to supply:

The first 4 items are database connection details:

The next 2 items are specific to your running of this comment script. It's kind of important to understand the relationship between these 2 items, which becomes clearer if you read this entire document:

That said, as an example, if your name is Bob, you might set your $admin_name to 'Bob_xyz' (or whatever), then....

This next item sets the table name that will be created when you run the installer script. Comments posted to your guestbook will be saved in this database table:

That is the end of required edits. The last item is optional. To change the display of flags on or off:

No further edits are needed for your script to run. If you want to modify the CSS styles or the bad word filter, you can move on further down the script, taking care to not disrupt any of the other coding.

You can save the script with the default name 'comments.php', or rename it to anything you like (must end with .php). The installer will ask you for the new name. DO NOT rename or modify the administration script, 'commadmin.php', or the installer, 'comminstall.php'.

3.

Upload these files to your webserver:

They need to be in the same directory, but can be in a sub-directory. Then you use your web browser to open the installer script, eg:

http://www.yourwebsite.com/comments/comminstall.php

Enter the name of the script if you have renamed it, and press 'Create Table'. If you have entered all the information correctly, a table will be created and you will go to a success screen where you can visit and test your new guestbook directly. If there is a problem, there will be some suggestions as to how to correct them.

It's probably a good idea to remove the installer script from your server. If you need to install additional guestbooks at a later date, you can upload it again. While on the topic of multiple guestbooks, if it requires further explanation, here's an overview:

Configure you first script with all the required variables. The only things that will change for additional scripts will be the script name and $tablename in the variables section. So, for example, if want 3 comment areas:

Website Integration :

The simplest method of showing the guestbook on your site is with an iframe. On the page you wish to show it, insert this HTML code:

<iframe src="comments.php" width=520 height=140 border=0 vspace=3></iframe><br />

This would display your guestbook as you see it illustrated in this document. You can freely modify these values, google for more information on iframe. You could also have it open in it's own window:

<a href="comments.php" target="_blank">Open My Guest Book!</a>

In fact this method is useful if just for your own purposes in seeing how the script works at different widths - you will find that it currently doesn't work too well in narrower displays with out some hacking of the input areas. If you want it to run on it's own page, you probably want to modify the 'body' section of the CSS to control the margins and width. See CSS customization section below.

Interface Description and Usage

Some of these areas might seem to be self explanatory, but here's a few notes:

This status will be displayed when a visitor first enters your site, or attempts to send with a blank name or comment, or simply presses the send button, or attempts to use the 'admin' comment when they are not the administrator (no comment will be entered):

Enter your name and a comment. Thanks!

This status will be displayed if a visitor attempts to enter a comment with a name matching $display_name (your name) :

The name you used is reserved by the site owner. Please use another name.

This status is displayed when you enter your $admin_name (your administrator password) and the word 'admin' in the comment box (without quote marks) and you press SEND. This is your gateway to the administration panel:

Click Here To Open The Admin Window

This status will be displayed after you or a visitor post a valid comment:

Your comment has been added, (poster name). Thank You!

Administration

Your gateway to the administration panel is to enter your administration password as a name, enter the word 'admin' in the comment box (without quotes), and press SEND. The Status Bar will display a link:

Click Here To Open The Admin Window

Security Note - the script has been engineered so that you (or any user) cannot directly open the commadmin.php script; it must be opened from the status bar link. (during a browser session, if you have previously accessed the admin panel through the status bar link, you may find that you can in fact access commadmin.php directly, but it probably won't function correctly. If you quit your browser then try again to access commadmin.php directly, you should see a 'You are not authorized...' message)

Clicking this link will open the Administration Window as a popup:

CSS Customization

The image below points to the relevant CSS sections you might like to modify in the script, and represents the way your script will look on initial installation. After fairly extensive testing on several browser/platform combinations the 'stock' CSS setup displays quite consistently (it looks quite awful on some older browsers, but my care factor is zero for outdated browsers). There are plenty of good resources on the web for help on CSS if it's new to you:

CSS Notes:

Here's an example of a simple 5 minute hack, just playing with colors, fonts, and turning flags off:

 

Support

I'm just a regular guy with a job and other obligations, so I don't have a lot of time to help you with this if you have problems and you haven't already done some homework. Please don't ask me questions like 'how do I set up a database', or 'how do I upload the files', or you used a word processor for editing php files, or you didn't read the readme. Otherwise, feel free to write bryhal@rogers.com.