PHP Classes

Guestbook v1: Post and display comments in a guestbook

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 70%Total: 1,026 All time: 3,579 This week: 71Up
Version License PHP version Categories
guestbook_v1 1.0.0Freely Distributable4Content management
Description 

Author

This class can be used to post and display comments in a guestbook.

It can generate the pages that display comment submission forms and the posted comments.

When a comment is posted the comment message and the author contact information is stored in a MySQL database table.

The comment author also receive a verification message in the e-mail address that they specify.

The message contains a special URL with a code that points to a page that the comment author needs to access to verify the address is authentic. The comment is only published when the author's e-mail address is verified.

Picture of Tom Taylor
Name: Tom Taylor <contact>
Classes: 1 package by
Country: United Kingdom

Example

<?php
require_once('inc/classes/paging.class.php');
require_once(
'inc/classes/guestbook.class.php');
$guestbook = new Guestbook(); // create a new instance of the guestbook
$guestbook->GuestbookPage = 'https://www.mydomain.com/guestbook.php'; // the location of the guestbook page on ur site.
$guestbook->EmailsFrom = 'GuestbookEntry@mydomain.com'; // where do the emails come from inrelation to the guestbook
$guestbook->ConfirmMessage = 0; // set this to 1 if you want to email whoever submits the form letting them know to that it has been submitted.
$guestbook->SubmitConfirmationEmail = 'This is the message which is sent to people if you set ConfirmMessage'; // the message which is sent to the person who submitted the form
$guestbook->myEmail = 'myemail@domain.com'; // set the email you want the guestbook entrys going to;

$guestbook->checkAddorDelete();

if(isset(
$_POST['addToGuestbook'])) {
    if(
$guestbook->CheckForm($_POST) == true) {
       
$guestbook->FormError = 'Guestbook submission sucessfull.';
       
$guestbook->SendConfirmEmail();
    } else {
        if(!isset(
$guestbook->FormError)) {
           
$guestbook->FormError = 'Please ensure "Name", "Title" and "Message" fields are filled in.';
        }
    }
}
?>




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Guestbook Example</title>
</head>

<body>

           
<?php

$guestbook
->TableWidth = 690; // set the width of the guestbook table
$guestbook->TableBorder = 0; // set the border of the table
$guestbook->NameAlign = 'right'; // does the author of each log, align left, right or middle ?
$guestbook->TableId = 'guestView'; // the id for the table
$guestbook->TdClass = 'rows'; // the class for the td's in the table .. padding, bg color..etc
$guestbook->DivTitleClass = 'guestTitle'; // the div class name for the title section
$guestbook->DivTimeClass = 'guestTime'; // the div class name for the time section
$guestbook->DivAuthorClass = 'guestAuthor'; // the div class name for the author section
$guestbook->Add_TextInputSize = '30'; // size for the input text fields in the add form
$guestbook->Add_TextareaSize = '550px'; // width for the text area, eg: 24em, 1em, 100%, 50%, 10px, 100px . . .
$guestbook->Add_TextareaHeight = '100px;'; // height for the textarea, eg: 24em, 1em, 100%, 50%, 10px, 100px . . .
$guestbook->MessageLimit = 500;


$guestbook->JavascriptMessageLimit();
$guestbook->JavascriptShowHide(); // make sure to include the javascript for the show / hide of the 'add to guestbook' link
$guestbook->showEntrys(); // draw the page elements
?>



</body>
</html>



  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file guestbook.class.php Class guestbook class file
Accessible without login Plain text file guestbook_example.php Example example of the guestbook class in use
Accessible without login Plain text file paging.class.php Class sql paging class - not mine
Accessible without login Plain text file SQLdump_guestbook.sql Data sql dump for creating the table for the guestbook class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,026
This week:0
All time:3,579
This week:71Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:70%StarStarStarStar
Rank:307
 
Works proper, very good source code.
13 years ago (egon olsen)
70%StarStarStarStar