An AJAX Chat
| | |

How to Make a Live Group Chat on Your Website for Free, With No Discord

How to Install & Use Ajax Chat

AJAX Chat is a relatively old innovation, and the project is abandoned, but it still works. It doesn’t just work. It works quite well. If you want a way to engage with your community and have your community engage with themselves, then look into AJAX Chat. In this tutorial, I will show you how to install and use AJAX Chat.

An AJAX Chat
This is my friend’s AJAX Chat that he has on his site.

What You Need

There are several prerequisites for installing AJAX Chat. Here they are:

  1. A Website (See the tutorial on How to Make Your Own Website For Free (Except Domain Names)).
  2. A working installation of PHP
  3. A MySQL Server
  4. myBB or other forum software (optional)
  5. HTML5 (Client-Side)
  6. JavaScript (Client-Side)
  7. An internet connection

Tutorial

Alright, so let’s get on with the tutorial. This will be a bit more difficult than most tutorials, but it will still be doable.

Downloading AJAX Chat

As you need to download AJAX Chat to your server instead of just to your computer. I will send you the website to download the zip file, but also send the command to download it straight to your site. Here is the link to the downloads on the site (use this link if you want to integrate it with myBB or another forum software): https://frug.github.io/AJAX-Chat/. Now, here is the command to download the standalone directly to your server directory:

cd /var/www/html
sudo wget https://github.com/Frug/AJAX-Chat/archive/0.8.8-standalone.tar.gz

The AJAX Chat Website
The AJAX Chat Website

Installing AJAX Chat

Alright, time for the installation. In this tutorial, we will be using the .tar.gz. If you downloaded the zip, use the unzip command. Otherwise, follow my instructions. (Replace AJAX-Chat-0.8.8-standalone with the tar you downloaded.)

See also  How to Use Quadspinner Gaea for Minecraft

cd /var/www/html
sudo tar -xvzf AJAX-Chat-0.8.8-standalone.tar.gz
sudo rm AJAX-Chat-0.8.8-standalone.tar.gz

Now that we have extracted all of the files, it is time to proceed with the installation of the chat program. Perform the following command:

sudo mv AJAX-Chat-0.8.8-standalone/chat .

Set up MySQL

Now, it is time to set up AJAX Chat with the MySQL Server. Log into your SQL server and enter in the following queries:

CREATE DATABASE Ajax_Chat;
CREATE USER 'ajax_chat' IDENTIFIED BY '[PASSWORD]';
GRANT ALL PRIVILEGES ON 'Ajax_Chat' . * TO 'ajax_chat';
FLUSH PRIVILEGES;

Now, you will want to tell AJAX Chat what user it will be logging in on. Enter in the following commands:

cd /var/www/html/chat/lib
sudo cp config.php.example config.php
sudo nano config.php

Now, you should be in an editor. Replace the following lines in the document:

$config['dbConnection']['host'] = 'localhost';
$config['dbConnection']['user'] = 'root';
$config['dbConnection']['pass'] = '';
$config['dbConnection']['name'] = 'chat';

With the following values:

$config['dbConnection']['host'] = '[SQL SERVER IP]';
$config['dbConnection']['user'] = 'ajax_chat';
$config['dbConnection']['pass'] = '[AJAX_CHAT USER PASSWORD]';
$config['dbConnection']['name'] = 'Ajax_Chat';

The Variables You Will Want to Edit
The Database Variables on AJAX Chat

Now that you have done that, it’s time to write the tables.

Writing the AJAX Chat Tables

In your web browser, go to the following URL: [YOUR WEBSITE]/chat/install.php

This will write the tables to your database, and you will be all set. Now, it is time to create your Admin user.

Creating the Admin User

If you are using AJAX Chat will myBB or another forum integration, you will not need to do this step. However, if you aren’t, you will have to manually write each user credentials, or figure out a way to write a custom registration page (I may have a tutorial on this later, but it won’t be easy.)

See also  How To Optimize Minecraft 1.17-1.18.2 for M1

To do that, perform the following commands:

cd /var/www/html/chat/lib/data
sudo nano users.php

This users file is filled with vulnerabilities. You will want to get rid of the example users as soon as possible.  To start with, delete all of the users except for the very top one, which is necessary if you want to have guest users. Now, write the following user in for yourself:

$users[1] = array();
$users[1]['userRole'] = AJAX_CHAT_ADMIN;
$users[1]['userName'] = '[YOUR USERNAME]';
$users[1]['password'] = '[YOUR PASSWORD]';
$users[1]['channels'] = array(0, 1);

Now that you have done that feel free to write down any friends. You can use the roles AJAX_CHAT_USER and AJAX_CHAT_MODERATOR to elevate the ranks of your friends.

Do NOT Mess with the Guest Variable
Do NOT mess with these guest user variables at the top of users.php

Logging In

Logging in is very simple. Just go to www.[YOUR WEBSITE].com/chat/. Now, enter the username and password you put in the users.php file. Now, enjoy your chat. I will probably be adding many more tutorials on AJAX Chat in the future, as it is highly customizable and incredibly useful. My friend Ashton who runs a subsite at https://buttered.infotoast.org has his chat, and he loves to use it (even though he can’t get many people to join it.)

My friend's website, Buttered
My friend’s website, Buttered. Check it out. It’s a great site!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *