Lightweight • Fast • Secure • PHP + MySQL
Created by devgagan
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)
After installation, login to the admin panel using:
Username: admin
Password: password
⚠ Important: Change the admin password immediately for security.
- ✔ 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
| 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 |
git clone https://github.com/devgaganin/WebChat.git
cd WebChatLogin to MySQL:
mysql -u root -pCreate database:
CREATE DATABASE webchat_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;mysql -u root -p webchat_db < spychat.sqlOpen config.php:
define('DB_HOST', 'localhost');
define('DB_NAME', 'webchat_db');
define('DB_USER', 'your_user');
define('DB_PASS', 'your_password');Save the file.
Open your browser:
http://localhost/WebChat/
Login using:
admin / password
🎉 WebChat is now ready!
This project is fully compatible with shared hosting like Hostinger, Bluehost, GoDaddy, etc.
- Open hPanel → Files → File Manager
- Enter the
public_htmlfolder - Upload the entire WebChat project
- Extract the ZIP (if uploaded as one)
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: ******
- Open phpMyAdmin
- Select your new database
- Click Import
- Upload
spychat.sql - Click Go
Modify:
define('DB_HOST', 'mysql.hostinger.com');
define('DB_NAME', 'u00000000_chat');
define('DB_USER', 'u00000000_user');
define('DB_PASS', 'yourpassword');https://your-domain.com/
Login → admin / password
Start chatting! 🎉
Works on:
- Hostinger VPS
- DigitalOcean Droplet
- Linode
- Contabo
- AWS EC2
sudo apt update && sudo apt upgrade -ysudo apt install apache2 php php-mysqli php-json php-gd php-curl php-zip unzip mysql-server -yEnable Apache:
sudo systemctl enable apache2
sudo systemctl start apache2sudo mysqlInside:
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;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/mysql -u webchat_user -p webchat_db < spychat.sqldefine('DB_HOST', 'localhost');
define('DB_NAME', 'webchat_db');
define('DB_USER', 'webchat_user');
define('DB_PASS', 'StrongPassword123!');crontab -eAdd:
0 * * * * /usr/bin/php /var/www/html/cron_cleanup.php
This removes old chat logs automatically.
- 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
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
Pull requests are welcome! If you'd like to improve UI/UX, performance, or add features — feel free to contribute.
MIT
Thank you for using WebChat – Anonymous Chat Module System. Built with ❤️ by Gagan.
If you need help join us on Telegram