Interact PHP - comment system


Code - 17-08-2018

Purpose

Interact is a simple PHP open-source comment system that can be added to any website in minutes to improve interactivity and user's involvement. Client-side, it is very lightweight (<6KB CSS and JS combined) and intuitive (no logins, no cookies,...). Server-side, it is very easy to setup, manage and even customize to fit your needs.

Interact PHP with the modern interface

Similarly to its older brother HashOver, Interact does not use an SQL database but stores comments as XML files. Many third-party comment systems like Disqus, IntenseDebate, Livefyre, Facebook Comments and Google+ Comments, suffer from these problems and impose them and many restrictions onto their users, meaning you and your website's visitors.

Features

  • Fast and convenient for your users with responsive design.
  • Very simple setup: no database to configure, just install it and add 2 lines of PHP where you want your comment section to be.
  • Customizable style and behavior to match the look & feel of your website.
  • Anti-Spam system using Google's reCAPTCHA v2 (optional).
  • Pure JS (no JQuery required).
  • Secure by design.
  • New: Inline markdown syntax support in comments (bold, italics, strikethrough and inline code)

Installation and setup

  1. Download Interact on GitHub.
  2. Extract it under your website's root.
  3. Customize Interact's behavior to your needs by editing the /lib/Interact_PHP/settings.php file.
  4. Give the directory that will contain the comments the 777 permission (chmod 777 path/to/Interact_PHP/Comments).

Hurray, Interact is ready to go! To add a comment section to a page, just insert the following PHP:

<?php 
    include_once($_SERVER['DOCUMENT_ROOT'].'/lib/Interact_PHP/Interact_PHP.php');
    \Interact_PHP\Interact_PHP(); 
?>

Parameters and cutomization

All of the parameters of Interact are in the settings.php file. There are a lot of comments to assist you in the configuration process.

If you want to add your own style, copy an existing CSS file to get started... and commit it on GitHub if you want to contribute to Interact's ongoing developpement!

Interact PHP with various CSS

Troubleshooting

This section describes the various problems you may encounter while installing/using Interact. If you don't find a solution here, please add a GitHub issue.

  • I can't add comments

You should check the permissions of the folder containing the comments (Interact/Comments by default). The PHP user must be able to write there. Setting 777 works (chmod -R 777 Comments). For some reason, the libxml PHP library was not enabled on PHP7 on one of my servers. Installing it fixed the issue (apt-get install php7.0-xml, reboot when completed).

  • The CSS does not load

The path of the library relative to the root of your website is probably incorrect. Make sure it matches with the value in settings.php. By default, it is /lib/Interact.

  • I am getting reCAPTCHA errors even after checking the box

You need to make sure that your reCAPTACHA public and secret keys are correct. Interact uses reCAPTCHA v2. More info at https://developers.google.com/recaptcha/docs/display

Future features

  • A simple admin interface to manage comments (Work In Progress)
  • A tag to identify the admin (Work In Progress)

Author: Charles Grassin


What is on your mind?

  • #1 leo

    nice!

    on April 11 2019, 0:39

  • #2

    Simple and useful 测试中文

    on April 11 2019, 0:44

  • #3 Charles

    Test comment:
    This is a Markdown syntax test.
    Markdown is bad.
    [MD XSS](javascript:alert("xss"))
    <script>alert("XSS test!");</script>

    on May 12 2019, 0:57

  • #4 dfaff

    ffhfj

    on July 31 2019, 3:28

  • #5 DaAds

    dDDsdS

    on August 5 2019, 16:01

  • #6 Aaa

    Prooob

    on August 6 2019, 9:21

  • #7 Vlad

    Testing

    on August 11 2019, 12:15

  • #8 hghgh

    jkhjkhjk

    on August 30 2019, 1:02

  • #9 ggggggggggggggggg

    jkgjkhjk

    on August 30 2019, 1:03

  Back to projects

Related articles