Skip to content

A simple PHP based WebChat platform for anonymous / secure chatting.

License

Notifications You must be signed in to change notification settings

devgaganin/WebChat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WebChat – Anonymous Chat Module System

Lightweight β€’ Fast β€’ Secure β€’ PHP + MySQL
Created by devgagan


πŸ“Œ Introduction

WebChat is a simple and efficient anonymous chat system built using plain PHP, MySQL, and AJAX.
The goal is to offer a fast, lightweight chat experience without requiring heavy frameworks or complex server setups.

This project is ideal for:

  • Anonymous chat rooms
  • Temporary or private group chats
  • Learning PHP-based real-time communication
  • Embedding chat inside existing websites
  • Lightweight hosting (works perfectly even on shared hosting)

πŸ” Default Admin Credentials

After installation, login to the admin panel using:


Username: admin
Password: password

⚠ Important: Change the admin password immediately for security.


⭐ Features

  • βœ” Anonymous chatting
  • βœ” Admin panel included
  • βœ” Simple, clean UI
  • βœ” Secure file upload system
  • βœ” Realtime messaging via AJAX polling
  • βœ” Auto-cleanup system (via cron)
  • βœ” Works on shared hosting & VPS
  • βœ” Minimal setup β€” no frameworks required

πŸ“‚ File & Folder Structure

Path Description
assets/ JavaScript, CSS, images
index.php Home / login redirect
chat.php Main chat interface
auth.php Authentication logic
api.php Backend for sending/receiving messages
config.php Database configuration
register.php New user registration
login.php User login
logout.php Logout controller
files.php Secure file upload logic
serve.php Serve uploaded files safely
cron_cleanup.php Cleans old chats & unused uploads
spychat.sql SQL schema required for installation

🧰 Installation Guide (Local / Any Server)

1. Clone the Project

git clone https://github.com/devgaganin/WebChat.git
cd WebChat

2. Create Your Database

Login to MySQL:

mysql -u root -p

Create database:

CREATE DATABASE webchat_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. Import the Chat Tables

mysql -u root -p webchat_db < spychat.sql

4. Configure Database Login

Open config.php:

define('DB_HOST', 'localhost');
define('DB_NAME', 'webchat_db');
define('DB_USER', 'your_user');
define('DB_PASS', 'your_password');

Save the file.


5. Run the Application

Open your browser:

http://localhost/WebChat/

Login using:

admin / password

πŸŽ‰ WebChat is now ready!


🌐 Deployment on Shared Hosting (Hostinger)

This project is fully compatible with shared hosting like Hostinger, Bluehost, GoDaddy, etc.


βœ” Step 1: Upload Files

  1. Open hPanel β†’ Files β†’ File Manager
  2. Enter the public_html folder
  3. Upload the entire WebChat project
  4. Extract the ZIP (if uploaded as one)

βœ” Step 2: Create a MySQL Database

Navigate:

hPanel β†’ Databases β†’ MySQL Databases

Create:

  • Database
  • Username
  • Password

Hostinger will give you info like:

DB Host: mysql.hostinger.com  
DB Name: u00000000_chat  
DB User: u00000000_user  
DB Pass: ******

βœ” Step 3: Import spychat.sql

  1. Open phpMyAdmin
  2. Select your new database
  3. Click Import
  4. Upload spychat.sql
  5. Click Go

βœ” Step 4: Update config.php

Modify:

define('DB_HOST', 'mysql.hostinger.com');
define('DB_NAME', 'u00000000_chat');
define('DB_USER', 'u00000000_user');
define('DB_PASS', 'yourpassword');

βœ” Step 5: Visit Your Domain

https://your-domain.com/

Login β†’ admin / password Start chatting! πŸŽ‰


πŸ’Ž VPS Deployment Guide (Ubuntu 20/22)

Works on:

  • Hostinger VPS
  • DigitalOcean Droplet
  • Linode
  • Contabo
  • AWS EC2

πŸ–₯ Step 1: Update System

sudo apt update && sudo apt upgrade -y

πŸ–₯ Step 2: Install Apache, PHP & MySQL

sudo apt install apache2 php php-mysqli php-json php-gd php-curl php-zip unzip mysql-server -y

Enable Apache:

sudo systemctl enable apache2
sudo systemctl start apache2

πŸ›’ Step 3: Create Database

sudo mysql

Inside:

CREATE DATABASE webchat_db;
CREATE USER 'webchat_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON webchat_db.* TO 'webchat_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

πŸ“‚ Step 4: Upload Project to Server

Option 1: Upload via SFTP Option 2: Upload via SSH:

cd /var/www/html/
sudo rm -rf *
sudo wget https://your-download-link/WebChat.zip
sudo unzip WebChat.zip
sudo chown -R www-data:www-data /var/www/html/

πŸ—„ Step 5: Import SQL

mysql -u webchat_user -p webchat_db < spychat.sql

πŸ”§ Step 6: Configure config.php

define('DB_HOST', 'localhost');
define('DB_NAME', 'webchat_db');
define('DB_USER', 'webchat_user');
define('DB_PASS', 'StrongPassword123!');

⏱ Step 7: Setup Cron Job (Recommended)

crontab -e

Add:

0 * * * * /usr/bin/php /var/www/html/cron_cleanup.php

This removes old chat logs automatically.


πŸ”’ Security Recommendations

  • Change default admin password immediately
  • Use HTTPS (SSL)
  • Disable directory listing
  • Limit file upload types (configured in files.php)
  • Keep database credentials private
  • Run cleanup cron frequently
  • Avoid using weak MySQL passwords

🧩 Customization Ideas

You can extend WebChat with:

  • Multi-room chat
  • Private messaging
  • WebSocket real-time chat
  • Admin analytics dashboard
  • User avatars / profiles
  • Emotes, GIFs, stickers
  • Add dark mode
  • Add device-based login restrictions

🀝 Contributing

Pull requests are welcome! If you'd like to improve UI/UX, performance, or add features β€” feel free to contribute.


πŸ“ License

MIT


Thank you for using WebChat – Anonymous Chat Module System. Built with ❀️ by Gagan.

If you need help join us on Telegram

About

A simple PHP based WebChat platform for anonymous / secure chatting.

Topics

Resources

License

Stars

Watchers

Forks