Messaging Web Application in PHP/OOP Free Source Code

Language

Introduction

This is a Messaging Web Application in PHP and MySQL Database. This project is a web-based messaging or chat platform where users can communicate with each other online. This project has multiple features that automatically load messages or chat updates. With the help of JavaScript, Ajax, and jQuery, users can have a better experience while using the application. The purpose of this project is to share this with the IT/CS students to have an idea of how does this kind of application was developed.

About the Messaging Web Application

I developed this project using the following:

  • XAMPP v3.3.0 as my local webserver that has a PHP Version 8.0.7
  • PHP Language
  • MySQL Database
  • HTML
  • CSS
  • JavaScript
  • jQuery
  • Ajax
  • Bootstrap

The project can be accessed by registered users only which means user registration is a must for using this web application. The system will require the users some personal information including their desired avatar. Talking about the functionalities, the user can view all the conversations of him/her with the other user. by default, the conversation box will only load 25 latest messages of both users and to load the previous messages, users must scroll to the oldest message shown to trigger the system to another 25 old messages. The sender can delete the message they sent but both users can see if the sender of the message deleted the message. The deleted message will not be totally deleted but it will only be shown a deleted message as the message content on the conversation box instead. The application also has an unread messages count for each conversion. The system does not require approval in order for users to send a message to others. The logged-in users can also view the other users' profile information.

Features

  • Secure Login and Registration
  • View Personal Profile
  • View Other Users Profile
  • Search User by Name and Email
  • List all Users that been Communicated With
    • Each item shows the user's name, email, and the last message
    • Shows an Unread Messages Count Badge Beside the User Avatar
    • Automatically updates unread messages count and the last message sent
    • Automatically Re-orders the list from latest to oldest
  • Conversation Box
    • Display 25 messages by default
    • Loads another 25 old messages when scrolling to the top
    • Automatically updates new messages without reloading
    • Shows "New Message" Button when a new message has been received and if not at the bottom of the convo box
    • Delete Sent Message
    • Shows Deleted Text for Messages that have been deleted
    • Automatically Change Deleted Message Content to Deleted text when sender deleted his/her sent message
    • "User Icon" serve as the button to redirects to the user profile
    • "Close/Times Icon" to close the conversation.
  • Manage Account Details/Credentials
  • Logout

System Snapshots of some Features

Home Page

Messaging Web Application

Conversation Field

Messaging Web Application

Search User

Messaging Web Application

User Profile

Messaging Web Application

How to Run ??

Requirements

  • Download and Install any local web server such as XAMPP/WAMP.
  • Download the provided source code zip file. (download button is located below)

Installation/Setup

  1. Open your XAMPP/WAMP's Control Panel and start Apache and MySQL.
  2. Extract the downloaded source code zip file.
  3. If you are using XAMPP, copy the extracted source code folder and paste it into the XAMPP's "htdocs" directory. And If you are using WAMP, paste it into the "www" directory.
  4. Browse the PHPMyAdmin in a browser. i.e. http://localhost/phpmyadmin
  5. Create a new database naming messaging_db.
  6. Import the provided SQL file. The file is known as messaging_db.sql located inside the database folder.
  7. Browse the Messaging Web Application in a browser. i.e. http://localhost/messaging/.

Sample User Access Information

Username: [email protected]
Password: jsmith

Username: [email protected]
Password: cblake123

DEMO VIDEO

That's it. You can now explore the features and functionalities of this Messaging Web Application in PHP. I hope this project will help you with what you are looking for and you'll find something useful for your future projects.

Explore more on this website for more Free Source Codes and Tutorials.

Enjoy :)

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

J'ai installé le code source sur un hébergeur mais on m''envoie sur la page 404. Qu'est-ce qui arrive?

Hi, I stumbled upon an error upon entering the http://localhost/messaging/. It says that Warning: mkdir(): Permission denied in C:\xampp\htdocs\messaging\DBConnection.php on line 4 Fatal error: Uncaught mysqli_sql_exception: No connection could be made because the target machine actively refused it in C:\xampp\htdocs\messaging\DBConnection.php:13 Stack trace: #0 C:\xampp\htdocs\messaging\DBConnection.php(13): mysqli->__construct('localhost', 'root', Object(SensitiveParameterValue), 'messaging_db') #1 C:\xampp\htdocs\messaging\DBConnection.php(43): DBConnection->__construct() #2 C:\xampp\htdocs\messaging\login.php(7): require_once('C:\\xampp\\htdocs...') #3 {main} thrown in C:\xampp\htdocs\messaging\DBConnection.php on line 13 I really hope you can help me on this matter. Thank you so much.

The warning mkdir(): Permission denied indicates that your script does not have the necessary permissions to create a directory in the specified location. Adjust the path like so to avoid confusion with relative paths: mkdir(__DIR__.'/db'); If you receive another error message warning: Warning: mkdir(): File exists. This indicates that the directory already exists, you now need to ensure your code only tries to create the directory if it doesn't already exist. Here’s how you can modify your code line 4 code: if (!is_dir(__DIR__.'/db')) { mkdir(__DIR__.'/db', 0755, true); } . Hope this helps

Add new comment