This is a PHP-AJAX script to add comments in the website; created with PHP, MySQL (using OOP technology, classes and objects (Object Oriented Programming)), and JavaScript (with jQuery).
- If the page(s) of your website has tens of comments, it's a good ideea to paginate them; the page will load faster and the content is easy to read. With this script, the comments can be paginated to a number of comments per page defined by the administrator, and they are displayed with jQuery effects.
The script paginate the comments, without affecting the rest of the page content, or page URL, and it can be included in both HTML, and PHP files (but the server must have installed PHP).

• To Download it, click: Comments script with pagination

To test this Script, click -> Test- Comments script with pagination

- By default, the script will allow all visitors to post comments, but if you have a register /login script, you can set that only the logged users to add comments.
- The script can be used with multiple pages of a site, whatever the type of the page URL (modified or not with mod-rewrite).
- The comments are stored into a MySQL table and displayed in UTF-8 encoding. Thus can be added less common character sets, such as diacritics, special characters, or characters specific to other languages. For MySQL queries it is used PHP PDO.
- In the comments can be added "smiles" and an image uploaded by the user on the server. The image is proportioned in the comment to a width of 125 pixels, but when you click on it, will be displayed in full page. The text in comments can be formated with bold, italic, and underline.
- Maximum comment size is set to 600 characters, and the user can add a website address to be associated with his name.
- For anti-spam protection, the form to add comment has a verification code (captcha), and the time when the comment is added it is stored in Session and Cookie, so, the user can add only one comment in an interval of 5 minutes.
- The script can send email notifications when new comments are added, if the user select this option.
- In the notification mail, the user receives a link to the page with the comments, and a link to unsubscribe if he/she wants to not receive other notification when new comments are added in that page.
- In the database it is stored the IP of the user which posted the comment, visible only for admin.
- Management of the comments (modification, delete) can be easily done by the administrator, directly in the current page. The admin can log in with the form that appears after clicking on the Administrator. When Admin logs in, to each comment appears the options: MODIFY, DELETE, as you can see in this image (click on it):
Admin - Comments script with pagination
- This script is free (does not provide support or personal modifications).
More details about installation, and other settings, you'll find in a "Read.html" file, in the archive with the script.

- The comments will look like in this image:
Comments script with pagination

It was successfully tested with Mozilla Firefox, Internet Explorer, and Opera, for a general configuration on localhost with XAMPP, and also on the server of the website If on other systems does not work properly, depends on their configuration. Problems can appear especially on free hostings which can have restrictions on the "session", or not support PDO; or if you modify something in the script code, without knowing PHP and JavaScript.

Daily Test with Code Example

Which meta tag provides a short description of the page?
<meta content="..."> <meta description="..."> <meta http-equiv="...">
<meta name="description" content="70-160 characters that describes the content of the page" />
Which CSS property is used to stop the wrapping effect of the "float"?
clear text-align position
#some_id {
  clear: both;
Click on the method which gets an array with all the elements in the document that have a specified tag name.
getElementsByName() getElementById() getElementsByTagName()
var divs = document.getElementsByTagName("div");
var nr_divs = divs.length;
Indicate the PHP function which returns the number of elements in array.
is_[) count() strlen()
$arr =[7, 8, "abc", 10);
$nri = count($arr);
echo $nri;        // 4
Script comments with pagination

Last accessed pages

  1. innerHTML and outerHTML to Get and Replace HTML content (22146)
  2. Insert, Select and Update NULL value in MySQL (44323)
  3. Multi-Level Menu Creator (1976)
  4. JQZoom Image Magnifier (10567)
  5. jQuery Drag and Drop Rows between two similar Tables (8453)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (1391)
  2. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (1361)
  3. Contact page - CoursesWeb (1342)
  4. Tabs effect with CSS (1342)
  5. Insert, Select and Update NULL value in MySQL (845)