A PHP Chat based on LE CHAT

Overview

General Information:

This is a PHP Chat based on LE CHAT v.1.14. An up-to-date copy of this script can be downloaded at https://github.com/DanWin/le-chat-php The original perl LE CHAT script by Lucky Eddie can be downloaded at his site or via a tor2web proxy like this one if you don't have Tor installed. If you add your own cool features or have a feature request, please tell me and I will add them, if I like them. Please also let me know about any bugs you find in the code, so I can fix them. Now a piece of information about the origin of the name "LE CHAT" copied from the original script: The "LE" in the name you can take as "Lucky Eddie", or since the script was meant to be lean and easy on server resources, as "Light Edition". It may even be the French word for "the" if you prefer. Translated from French to English, "le chat" means: "the cat".

Features:

  • Optimized for Tor
  • No JavaScript needed
  • Cookies supported, but not needed
  • Captcha
  • Multiple languages
  • Members and guests
  • Waiting room for guests
  • Moderatoral approval of new guests
  • Public, member, moderator and admin only chats
  • Private messages
  • Multi-line messages
  • Change font, colour and refresh rate in profile settings
  • Autologout when inactive for some time
  • Image embedding
  • Notes for admins and moderators
  • Clone the chat to have multiple tabs
  • Kick chatters
  • Clean selected messages
  • Clean the whole room
  • Plain text message filter
  • Regex message filter
  • And more

Installation Instructions:

You'll need to have php with pdo, pcre, mbstring and date extension, and a web-server installed. You will also need the pdo_sqlite, pdo_mysql or pdo_pgsql extension, depending on which database you choose. Optionally, you can install:

  • the gd extension for the captcha feature
  • the json extension for save/restore
  • a memcached server and the memcached extension and change the configuration to use memcached. This will lessen the database load a bit.
  • a MySQL or PostgreSQL server to use as an external database instead of SQLite
  • the libsodium extension (PHP >= 7.2) for encryption of messages and notes in the database When you have everything installed and use MySQL or PostgreSQL, you'll have to create a database and a user for the chat. Then edit the configuration at the bottom of the script to reflect the appropriate database settings and to modify the chat settings the way you like them. Then copy the script to your web-server directory and call the script in your browser with a parameter like this: http://(server)/(script-name).php?action=setup Now you can create the Superadmin account. With this account you can administer the chat and add new members and set the guest access. As soon as you are done with the setup, all necessary database tables will be created and the chat can be used. Note: If you updated the script, please visit http://(server)/(script-name).php?action=setup again, to make sure, that any database changes are applied and no errors occur.

Translating:

Copy lang_en.php and rename it to lang_YOUR_LANGCODE.php Then edit the file and translate the messages into your language and change $I to $T at the top. If you ever use a ' character, you have to escape it by using \' instead or the script will fail. When you are done, you have to edit the chat script, to include your translation. Simply add a line with 'lang_code' =>'Language name', to the $L array in the load_lang() function at the bottom, similar to what I did for the German translation. Please share your translation with me, so I can add it to the official version. To update your translation, you can copy each new string to your translation file or edit the automated lang_update.php script to reflect you language and run it.

Regex:

Yes, the chat supports regular expression filtering of messages. As regex tends to be difficult for most people, I decided to give it an extra section here. Regex is very powerful and can be used to filter messages that contain certain expressions and replace them with something else. It can be used e.g. to turn BB Code into html, so it is possible to use BB Code in the chat to format messages. To do this, use this Regex-Match \[(u|b)\](.*?)\[\/\1\] and this Regex-Replace <$1>$2 and your text will be [b]bold[/b] or [u]underlined[/u]. You can also use smilies by using this Regex-Match (?-i::(cry|eek|lol|sad|smile|surprised|wink):) and this Regex-Replace :$1: And now if you enter :smile: an image with the smiley will be loaded from your server at /pictures/smile.gif. The following should be escaped by putting \ in front of it, if you are trying to match one of these characters / \ ^ . $ | ( ) [ ] * + ? { } ,. I used / as delimiter, so you will have to escape that, too. The only options I used is i to make the regex case insensitive. If you want to test your regex, before applying you can use this site and enter your Regex and Replacement there and click on preg_replace. If you never used regex before, check out this starting guide to begin with regular expressions.

Live demo:

If you want to see the script in action, you can visit my Tor hidden service or via my clearnet proxy if you don't have Tor installed. Considering this is a hidden service, you should be prepared for the worst case, as people tend to do illegal activities in the Tor network.

Comments
  • Got some errors while load the script for the first time.

    Got some errors while load the script for the first time.

    [Screenshot] https://imgur.com/a/JDWUkLl

    Warning: Use of undefined constant SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES - assumed 'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\index.php on line 4233

    Warning: Use of undefined constant SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES - assumed 'SODIUM_CRYPTO_AEAD_AES256GCM_KEYBYTES' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\index.php on line 4234

    Warning: substr() expects parameter 3 to be int, string given in C:\xampp\htdocs\index.php on line 4234

    Warning: Use of undefined constant SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES - assumed 'SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\index.php on line 4238

    Warning: Use of undefined constant SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES - assumed 'SODIUM_CRYPTO_AEAD_AES256GCM_NPUBBYTES' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\index.php on line 4239

    Warning: substr() expects parameter 3 to be int, string given in C:\xampp\htdocs\index.php on line 4239

    [The Old version of this chat script is working without any errors.] [Renamed the chat.php to index.php] [My configurations for the new updated script]

    function load_config(){ mb_internal_encoding('UTF-8'); define('VERSION', '1.24'); // Script version define('DBVERSION', 42); // Database layout version define('MSGENCRYPTED', true); // Store messages encrypted in the database to prevent other database users from reading them - true/false - visit the setup page after editing! define('ENCRYPTKEY_PASS', '13117132423542543653635467854326'); // Recommended length: 32. Encryption key for messages define('AES_IV_PASS', '012345678912'); // Recommended length: 12. AES Encryption IV define('DBHOST', 'localhost'); // Database host define('DBUSER', 'root'); // Database user define('DBPASS', ''); // Database password define('DBNAME', 'newupdate'); // Database define('PERSISTENT', true); // Use persistent database conection true/false define('PREFIX', ''); // Prefix - Set this to a unique value for every chat, if you have more than 1 chats on the same database or domain - use only alpha-numeric values (A-Z, a-z, 0-9, or _) other symbols might break the queries define('MEMCACHED', false); // Enable/disable memcached caching true/false - needs memcached extension and a memcached server.

    opened by Deepnerd 13
  • improving css style to look comfortable in home page

    improving css style to look comfortable in home page

    i want to improve the appearance of this website home page like improving navigation etc share this site with friends options and changing navigation slider according to this website layout

    opened by navnit0707 9
  • Extension Installation

    Extension Installation

    I want to use this on my TOR site but I don't know how to install PHP extensions on my Linux PC. Any help on installing the extensions would be amazing.

    opened by PyMaster22 9
  • [Help] - Login in with another system

    [Help] - Login in with another system

    I see the session DB so I can drop the information in to there, but what other things do I need to send or set to be able to use my own login system, I have a full profile and friends system I want to control the login to the chat.

    is there session I have to set in the browser and also passhash is also set in the session database, why is this if you could help on this it would be really helpful, I wouldn't mind bypassing the login and user settings fully in the chage but I am able to to save the login details to the members section of the chat db also if I need to.

    opened by LexShadow 7
  • Confusion on message encryption with public, staff, admin notes.

    Confusion on message encryption with public, staff, admin notes.

    Capture 3

    So when I saved an public note while || define('MSGENCRYPTED', true) || in the settings, public notes were showing like this. Capture 1

    BUT! When I saved a public note while || define('MSGENCRYPTED', false) || in the settings, public notes were normal. Capture 4 - after false encryption

    So why my public notes also encrypting like messages to the database and showing that encrypted data to public notes without showing the normal input? I think this is same in admin, staff notes also. but it's good to encrypt private, staff, admin notes but without showing that encrypted data, only showing the normal input back in the chat. And also no need to encrypt public notes since it's public. Is there a way to solve this while I'm using message encryption? Thank you daniel.

    opened by Deepnerd 6
  • Bug: Session Cookies are not validated across multiple clients

    Bug: Session Cookies are not validated across multiple clients

    The chat does not validate session cookies across multiple clients when the client is a guest username. This effectively allows a user to control a guest user's account without the user being authenticated, and thus allows "eavesdropping" and arbitrary control of a guest user's account. This was executed as a proof of concept at https://chat.danwin1210.me/ by specifying a guest username that is already logged in at the login prompt.

    opened by bakertaylor28 5
  • SQLite Problem creating tables

    SQLite Problem creating tables

    There is a bug, if I set it to sqlite as I don't have mysql for less attack vectors and resources but soon as I try set it up I get

    Warning: PDO::prepare(): SQLSTATE[HY000]: General error: 1 no such table:

    The sqlite file is created but after that it's does that error, the part that installs the db seems to be missing I see a trigger for it ever.

    The file size is 0 so there is no date been written to it

    Windows tested with Xampp, Laragon Apache and Nginx,

    Warning: PDO::prepare(): SQLSTATE[HY000]: General error: 1 no such table: main_settings in chat.php on line 4288
    
    Fatal error: Uncaught Error: Call to a member function execute() on bool in chat.php:4289 
    Stack trace: 
    #0 chat.php(3481): get_setting('imgembed') 
    #1 chat.php(379): send_headers() 
    #2 chat.php(916): print_start('init') 
    #3 chat.php(4373): send_init() 
    #4 chat.php(51): check_db() 
    #5 {main} thrown in chat.php on line 4289
    
    opened by LexShadow 4
  • Clean Out Chat Data

    Clean Out Chat Data

    Although this suggestion may not work because of the constant page-refreshing and lack of JavaScript, I believe this could save a lot of space by finding a way to clean out chat data by keeping it "client-sided." Meaning all the dialogue is shown on the user's screen, after the data is broadcasted from the server, but is wiped from the database.

    I know this idea brings into question of how important it is to preserve such logs for the sake of the chat server. To this, we should definitely discuss the matter.

    opened by ghost 4
  • BLANK PAGE IN THE PROFILE PAGE

    BLANK PAGE IN THE PROFILE PAGE

    The profile area is showing empty. I'm on my admin account. even normal user the same. how to fix this? Thank you very much for your time to resolve my problem. why

    opened by Deepnerd 3
  • What if we start a new project?

    What if we start a new project?

    Should we start a new chat project only compatible with PHP >= 7.4 using new PHP "strict" mode + objects and variable types + better security and encryption + better UI templates??

    opened by cypherbits 3
  • Fatal error: No connection to database?

    Fatal error: No connection to database?

    I'm using MySQL 5.5.48 netstat -an:

    tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN
    

    3306 port is opened, Why "No connection to database"?

    opened by ghost 3
  • Add a Report button for links

    Add a Report button for links

    Add a "Report" button in the chat for users to put disallowed links there, and with the approval of the Moderators, every new user who shares this link will be kicked.

    opened by DanWin 0
  • Sending a message gives me

    Sending a message gives me "session expired"

    I'm running this as a tor hidden service, and whenever I try to send a message, it gives me "session expired" so I click "reaload postbox" and it does the same thing, same with updating staff notes, but not changing the settings. The issue persists if I connect to it from LAN (not with tor). Am I doing something wrong? I have enabled encryption and memcached and I'm using SQLite.

    opened by JanSvobodaJenik 1
  • Add option to disable PMs just for guests

    Add option to disable PMs just for guests

    A spammer can abuse guest accounts to distribute questionable messages, without the staff being able to do anything about it, if they are unaware of the abusive guests. To keep the service quality high in such cases, an option should be implemented that allows disabling PMs for guests, while letting regular members still talk in private.

    opened by DanWin 0
  • How to reset shown internal filter number?

    How to reset shown internal filter number?

    hi..

    with every restore of the filters/linkfilters the internal shown number for both is increased every restore..

    how can this be reset?

    thx in advance

    opened by outofthecommon 2
  • Encryption is vulnerable

    Encryption is vulnerable

    We changed some time ago the message encryption to use the new, safer and faster AES GCM with libsodium.

    But we are reusing the IV/Nonce for the same Key. AES GCM is vulnerable in this cases. Nonces should be generated for each new message and stored with the message for decryption (a new DB column).

    Exploiting this is not that easy, so we should review our threat model and decide or not to change it or maybe just put a warning on the readme...

    opened by cypherbits 5
Web Based Chat Application For Students, Developers, Learners

Web Based Chat Application Motive of this chat Application is to connect similar interest students closer. Many students faces difficulties to solve t

Aman Tamboli 4 Nov 4, 2022
A framework agnostic PHP library to build chat bots

BotMan If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course. About BotMa

BotMan 5.8k Jan 1, 2023
Aplicación de chat usando HTML, CSS, PHP, JS and MySQL.

SYSTEMSGT Codigo fuente de aplicación CHAT - SYSTEMSGT Lenguajes HTML CSS PHP JS MySQL Pre-requisitos ?? Para poder utilizar esta aplicación necesitas

SYSTEMSGT 36 Dec 1, 2022
Simple custom chat bot developing framework for telegram, qq and more in PHP (the best language)

RinoBot RinoBot 是一个为统一聊天机器人扩展开发的框架,编写一份插件用于多种机器人协议。 简体中文 | English ?? 开发中 ?? 暂不适用于生产环境 特性 插件扩展机制 一份代码运行于多平台多协议机器人 并减小开发难度 插件提供 Yaml 配置 供使用者修改 基于机器人 We

LixWorth 3 Apr 18, 2022
This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

Kraken 48 Aug 11, 2021
You have just downloaded "Messenger-app" [A lightweight, minimalistic real-time chat application]

MESSENGER-APP You have just downloaded "Messenger-app" [A lightweight, minimalistic real-time chat application] Setup To get it working, follow these

Chr1st0ph3r SAB 1 Oct 29, 2021
crm_chatbot is an app which allows to create a chat for websites.

CRM Chatbot This app could be installed only in the Midrub CMS version 0.0.8.5+. In older versions it will break anything. DEMO VIDEO: https://youtu.b

null 2 Oct 27, 2022
Live chat with several people.

chat What can you do on this application? you can create an account you can talk live with several people you can edit any information on your account

Narcis Lazar 8 Nov 10, 2022
Chat over your local network: 127.0.0.1

#Howto: install packages: apache2 (or nginx but I wouldn't prefer it if you're using your local computer) php for ubuntu/debian instance: $ apt instal

Omer Erbilgin 1 Jan 12, 2022
A simple pocketmine plugin to chat by worlds on your server!

WorldChat Fix Per World Chat plugin for PocketMine-MP API 4.0 Category PocketMine-MP plugins | Php 8 Requirements PocketMine-MP API 4.0.0 and PHP 8 or

HenryDevMaster 7 Nov 2, 2022
The best profanity filter for chat with api for plugin developers!

xqwtxon/ProfanityFilter is moving on ReinfyTeam/ProfanityFilter ProfanityFilter ?? A best profanity filter for pocketmine. Controls hate speech and bl

Ace Sobremont 4 Jul 11, 2022
PocketMine-MP To Discord Chat Logging.

Welcome To PocketCord PocketCord is a PocketMine-MP plugin designed to link discord and your PocketMine-MP Server with quick and easy setup! Installat

null 2 Sep 15, 2022
A text-based, persistent browser-based strategy game (PBBG) in a fantasy war setting

Note: OpenDominion is still in development. Some features of the game have not been implemented yet. Introduction OpenDominion is a free and open-sour

null 180 Dec 28, 2022
Small convention based CQRS library for PHP

LiteCQRS for PHP Small naming-convention based CQRS library for PHP (loosely based on LiteCQRS for C#) that relies on the MessageBus, Command, EventSo

Benjamin Eberlei 560 Nov 20, 2022
Currency is a simple PHP library for current and historical currency exchange rates & crypto exchange rates. based on the free API exchangerate.host

Currency Currency is a simple PHP library for current and historical currency exchange rates & crypto exchange rates. based on the free API exchangera

Amr Shawky 19 Dec 12, 2022
PHP Machine Learning Rain Forecaster is a simple machine learning experiment in predicting rain based on a few forecast indicators.

PHP Machine Learning Rain Forecaster is a simple machine learning experiment in predicting rain based on a few forecast indicators.: forecasted "HighT

null 4 Nov 3, 2021
PHP Machine Learning with Naive Bayes to classify the right contraceptive based on your medical history

What is php-ml-bayes PHP-ML Bayes is a Machine Learning with Naive Bayes Algorithm to classify the right contraceptive based on your medical history.

Fikri Lazuardi 2 Jan 21, 2022
This project is very diverse and based upon many languages and libraries such as C++, Python, JavaScript, PHP and MQTT

ADMS-Real-time-project This project is very diverse and based upon many languages and libraries such as C++, Python, JavaScript, PHP and MQTT Advance_

Nitya parikh 1 Dec 1, 2021
CMS based on Phalcon PHP Framework with modular structure

Yona CMS Yona CMS - open source content management system (CMS). Written in Phalcon PHP Framework (version 3.x supported) Has a convenient modular str

Alexander Torosh 369 Dec 27, 2022