Customer Relationship Management (CRM) System
Using PHP
Project Structure
│── assets/ │── css/ │ ├──
style.css │ ├──
dashboard.css │── js/ │ ├──
script.js │ ├──
dashboard.js │── images/ │ ├──
logo.png │ ├──
user-avatar.png │── config/ │── config.php │── constants.php │── controllers/ │──
AuthController.php │──
LeadController.php │──
CustomerController.php │──
SalesController.php │── CommunicationController.php │── models/ │── User.php │── Lead.php │── Customer.php │──
Communication.php │── views/ │── auth/ │ ├──
login.php │ ├──
register.php │── dashboard/ │ ├──
index.php │── leads/ │ ├──
add_lead.php │ ├──
list_leads.php │── customers/ │ ├──
add_customer.php │ ├──
list_customers.php │── communications/ │ ├──
log_call.php │ ├──
list_communications.php │── public/ │── uploads/ │──
profile_pictures/ │── index.php │── routes/ │── web.php │── includes/ │── header.php │── footer.php │── navbar.php │── database/ │──
crm_database.sql │── index.php │── .htaccess │── README.md |
Here’s a
breakdown of all the files for a Customer Relationship Management (CRM) system
structure, with detailed content for each file:
File Structure │── assets/ │── css/ │ ├──
style.css │ ├──
dashboard.css │── js/ │ ├──
script.js │ ├──
dashboard.js │── images/ │ ├──
logo.png │ ├── user-avatar.png
|
1. CSS Files
style.css
This file will contain the general styling for the CRM's
front-end design.
/* General body and font settings */ body
{ font-family: Arial,
sans-serif; margin: 0; padding: 0; background-color: #f4f4f4; } /* Navbar styles */ .navbar
{ background-color: #2c3e50; color: white; padding: 10px
20px; text-align: center; } .navbar
a { color: white; text-decoration: none; margin: 0
15px; } .navbar
a:hover { color: #e74c3c; } /* Main container styling */ .container
{ width: 90%; margin: 20px
auto; } /* Button styles */ button
{ background-color: #3498db; color: white; padding: 10px
20px; border: none; cursor: pointer; } button:hover
{ background-color: #2980b9; } /* Footer styling */ footer
{ text-align: center; padding: 20px; background-color: #2c3e50; color: white; position: fixed; bottom: 0; width: 100%; }
|
dashboard.css
This file is specific to the dashboard page of the
CRM.
/* Dashboard layout */ .dashboard
{ display: flex; flex-direction: row; justify-content: space-between; padding: 20px; } /* Sidebar styling */ .sidebar
{ background-color: #34495e; width: 250px; padding: 20px; color: white; } .sidebar
a { color: white; display: block; padding: 10px; text-decoration: none; } .sidebar
a:hover { background-color: #1abc9c; } /* Main dashboard content */ .dashboard-content
{ flex-grow: 1; background-color: #ecf0f1; padding: 20px; border-radius: 8px; } /* User stats and charts styling */ .stats
{ display: flex; justify-content: space-between; margin-bottom: 20px; } .stats
.card { background-color: #3498db; color: white; padding: 20px; width: 23%; text-align: center; border-radius: 8px; } .stats
.card:hover { background-color: #2980b9; } |
2. JS Files
script.js
This file will handle general JavaScript functionality
for the CRM system (like form validation, AJAX requests, etc.).
// Form validation function
validateForm(form) { const
name = form['name'].value; const
email = form['email'].value; if
(name === ''
|| email === '')
{ alert('All fields are required!'); return
false; } return
true; } // AJAX request example for getting
user data function
fetchUserData() { const
xhr = new XMLHttpRequest(); xhr.open('GET', 'getUserData.php',
true); xhr.onload = function()
{ if
(xhr.status === 200)
{
const data =
JSON.parse(xhr.responseText);
document.getElementById('user-name').innerText
= data.name; } }; xhr.send(); } // Call the function on page load window.onload = fetchUserData; |
dashboard.js
This file will handle JavaScript functionality
specific to the CRM dashboard (like interactive charts, stats, etc.).
// Example function for updating
dashboard statistics dynamically function
updateDashboardStats(stats) {
document.getElementById('new-customers').innerText
= stats.newCustomers;
document.getElementById('total-sales').innerText
= stats.totalSales;
document.getElementById('pending-requests').innerText
= stats.pendingRequests; } // Example data to update stats const
stats = { newCustomers: 120, totalSales: 500000, pendingRequests: 30 }; // Update stats when page loads window.onload = function()
{
updateDashboardStats(stats); };
|
3. Images
logo.png
This image should be the logo of your CRM system. It
will be used in the header or navbar. The file will typically be in PNG format.
- Example: Upload a logo image to the
images/
directory and reference it in HTML:
<img src="assets/images/logo.png" alt="CRM Logo">
user-avatar.png
This image will be used to display user avatars on the
dashboard or profile pages. Like the logo image, it should be a PNG file.
- Example:
<img src="assets/images/user-avatar.png" alt="User Avatar" class="user-avatar">
4. Folder Structure
Here’s the final layout of the project:
/assets
/css
style.css
dashboard.css
/js
script.js
dashboard.js
/images
logo.png
user-avatar.png
Summary:
- CSS Files:
style.css
for global styling anddashboard.css
for dashboard-specific styles. - JS Files:
script.js
for general JavaScript functions anddashboard.js
for dashboard-specific interactive functionality. - Image Files:
logo.png
for the CRM logo anduser-avatar.png
for user profile images.
File Structure
│── config/
│ ├── config.php
│ ├── constants.php
1. config/config.php
This file is responsible for managing the database
connection, storing the database credentials, and making the connection
available throughout the CRM application.
<?php // Include the constants.php file to
use constants require_once
'constants.php'; /** * Function to connect to the
database using PDO (PHP Data Objects) * * @return
PDO */ function
getDBConnection() { try
{ //
Creating a PDO instance to connect to the database $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME; $username
= DB_USER; $password
= DB_PASS; //
Options for PDO connection $options
= array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false, ); //
Creating a new PDO instance $pdo = new
PDO($dsn, $username, $password, $options); //
Returning the PDO object to be used for queries return
$pdo; } catch
(PDOException $e) { //
If there's an error, display the message die("Connection failed: " .
$e->getMessage()); } } ?>
|
Explanation:
- getDBConnection():
This function uses PHP’s PDO (PHP Data Objects) to connect to the MySQL
database. It grabs the host, database name, username, and password from
constants defined in
constants.php
(which we'll define next). It handles the connection and returns a PDO object that can be used to interact with the database. - The function also handles connection errors by
catching the exception and displaying an error message.
2. config/constants.php
This file is where we define constants for database
credentials and other configuration values that are globally needed across the
application (e.g., site name, admin email, etc.).
<?php // Database configuration constants define('DB_HOST', 'localhost');
// Hostname or IP address of the
database server define('DB_NAME', 'crm_system');
// Name of the database define('DB_USER', 'root');
//
Database username (default is 'root' for localhost) define('DB_PASS', '');
//
Database password (set to '' if there is no password) // Site-wide constants define('SITE_NAME', 'My CRM System');
// Name of the CRM system (for title, branding,
etc.) define('ADMIN_EMAIL', 'admin@example.com');
// Admin email address for system alerts and
notifications // Other configuration constants define('MAX_LOGIN_ATTEMPTS', 5);
// Max login attempts before account
is locked define('PASSWORD_RESET_EXPIRY', 3600); //
Password reset link expiry time in seconds (1 hour) // Email configuration constants
(SMTP setup for sending emails) define('SMTP_HOST', 'smtp.example.com'); define('SMTP_PORT', 587); define('SMTP_USER', 'no-reply@example.com'); define('SMTP_PASS', 'smtp_password'); // Define paths for image upload
directories define('UPLOAD_DIR', '/path/to/uploads/'); define('PROFILE_IMAGE_DIR', UPLOAD_DIR . 'profile_images/'); define('DOCUMENT_DIR', UPLOAD_DIR . 'documents/'); ?>
|
Explanation:
- Database credentials:
Defines constants like
DB_HOST
,DB_NAME
,DB_USER
, andDB_PASS
, which are used throughout the application to connect to the database. - SITE_NAME:
Defines the CRM system's name, which can be used for branding in titles,
headers, etc.
- ADMIN_EMAIL:
The email used by the system for notifications (e.g., for error alerts or
password reset).
- Security:
Defines constants like
MAX_LOGIN_ATTEMPTS
to limit login attempts andPASSWORD_RESET_EXPIRY
for how long a password reset link is valid. - SMTP configuration:
Provides constants for sending emails using SMTP, including the host,
port, and credentials.
- Upload directories:
Defines directories for storing uploaded files, such as user profile
images and documents.
Using These Configuration
Files in Your CRM Application
Example 1: Using
the Database Connection
In your CRM application, to get a database connection,
you can include the config.php
file and call the getDBConnection()
function.
<?php // Include the config file to use the
database connection require_once
'config/config.php'; // Get the PDO connection object $pdo = getDBConnection(); // Example query to fetch data from a
table $query = "SELECT * FROM users"; $stmt = $pdo->query($query); // Fetch and display results while
($row = $stmt->fetch()) { echo "User ID: " . $row['id'] . "<br>"; echo "Name: " . $row['name'] . "<br>"; } ?>
|
Example 2: Using
Constants in Your Application
You can also use the constants defined in constants.php
across your application, for instance:
<?php // Include constants file require_once
'config/constants.php'; // Display the site name echo "Welcome to " . SITE_NAME; // Send an email using the SMTP configuration
constants mail('recipient@example.com', 'Subject', 'Message body',
'From: ' . SMTP_USER); ?> |
Summary:
1.
config/config.php
:
Manages the database connection and ensures a central place to configure and
establish the connection using PDO.
2.
config/constants.php
:
Defines various constants (like database credentials, site-wide settings, and
other configurations) that can be used throughout the application.
These configuration files help keep your application modular and easily configurable. By using constants for sensitive information, you avoid hardcoding such values throughout your application, making it easier to maintain and more secure.
│── controllers/
│ ├── AuthController.php
│ ├── LeadController.php
│ ├── CustomerController.php
│ ├── SalesController.php
│ ├── CommunicationController.php
1. controllers/AuthController.php
The AuthController.php
is responsible for user authentication functionalities like login,
registration, and password reset.
<?php require_once
'config/config.php'; require_once
'models/User.php'; class
AuthController { //
Handle user login public
function login() { if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$email = $_POST['email'];
$password = $_POST['password'];
// Check if user exists and password is correct
$user = User::getUserByEmail($email);
if ($user &&
password_verify($password, $user['password']))
{
$_SESSION['user_id']
= $user['id'];
$_SESSION['user_role']
= $user['role'];
header('Location: dashboard.php');
} else
{
$_SESSION['error']
= 'Invalid credentials!';
header('Location: login.php');
} } else
{
require 'views/login.php'; } } //
Handle user logout public
function logout() {
session_start();
session_destroy(); header('Location: login.php'); } //
Handle user registration public
function register() { if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$password = password_hash($_POST['password'],
PASSWORD_DEFAULT);
// Add the new user to the database
if
(User::createUser($name, $email, $password)) {
$_SESSION['success']
= 'Registration successful! Please log in.';
header('Location: login.php');
} else
{
$_SESSION['error']
= 'Registration failed!';
header('Location: register.php');
} } else
{
require 'views/register.php'; } } } ?>
|
Explanation:
login()
: Handles user login. It checks if the credentials are correct and sets session variables if successful.logout()
: Destroys the session and redirects the user to the login page.register()
: Handles user registration. It hashes the password and inserts the user data into the database.
2. controllers/LeadController.php
The LeadController.php
handles
operations related to managing leads, such as creating, updating, and viewing
leads.
<?php require_once
'config/config.php'; require_once
'models/Lead.php'; class
LeadController { //
Create a new lead public
function createLead() { if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$status = $_POST['status'];
if (Lead::createLead($name,
$email, $phone, $status)) {
$_SESSION['success']
= 'Lead created successfully!';
header('Location: leads.php');
} else
{
$_SESSION['error']
= 'Failed to create lead!';
header('Location: create_lead.php');
} } else
{
require 'views/create_lead.php'; } } //
View all leads public
function viewLeads() { $leads =
Lead::getAllLeads(); require
'views/leads.php'; } //
Edit a lead public
function editLead($id) { $lead =
Lead::getLeadById($id); if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$status = $_POST['status'];
if
(Lead::updateLead($id, $name, $email, $phone, $status)) {
$_SESSION['success']
= 'Lead updated successfully!';
header('Location: leads.php');
} else
{
$_SESSION['error']
= 'Failed to update lead!';
header('Location: edit_lead.php?id='
. $id);
} } else
{
require 'views/edit_lead.php'; } } //
Delete a lead public
function deleteLead($id) { if
(Lead::deleteLead($id)) {
$_SESSION['success']
= 'Lead deleted successfully!'; } else
{
$_SESSION['error']
= 'Failed to delete lead!'; } header('Location: leads.php'); } } ?>
|
Explanation:
createLead()
: Handles creating a new lead.viewLeads()
: Displays all leads.editLead()
: Handles editing a lead's details.deleteLead()
: Deletes a lead by its ID.
3. controllers/CustomerController.php
The CustomerController.php
manages customer data and interactions, such as adding, updating, and viewing
customers.
<?php require_once
'config/config.php'; require_once
'models/Customer.php'; class
CustomerController { //
View all customers public
function viewCustomers() { $customers
= Customer::getAllCustomers(); require
'views/customers.php'; } //
Create a new customer public
function createCustomer() { if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
if
(Customer::createCustomer($name, $email, $phone, $address)) {
$_SESSION['success']
= 'Customer created successfully!';
header('Location: customers.php');
} else
{
$_SESSION['error']
= 'Failed to create customer!';
header('Location: create_customer.php');
} } else
{
require 'views/create_customer.php'; } } //
Edit a customer's details public
function editCustomer($id) { $customer
= Customer::getCustomerById($id); if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$address = $_POST['address'];
if
(Customer::updateCustomer($id, $name, $email, $phone, $address)) {
$_SESSION['success']
= 'Customer updated successfully!';
header('Location: customers.php');
} else
{
$_SESSION['error']
= 'Failed to update customer!';
header('Location: edit_customer.php?id='
. $id);
} } else
{
require 'views/edit_customer.php'; } } //
Delete a customer public
function
deleteCustomer($id) { if
(Customer::deleteCustomer($id)) {
$_SESSION['success']
= 'Customer deleted successfully!'; } else
{
$_SESSION['error']
= 'Failed to delete customer!'; } header('Location: customers.php'); } } ?>
|
Explanation:
viewCustomers()
: Displays all customers.createCustomer()
: Adds a new customer to the database.editCustomer()
: Updates a customer's details.deleteCustomer()
: Deletes a customer by their ID.
4. controllers/SalesController.php
The SalesController.php
manages
sales-related functionalities, such as tracking sales, viewing sales history,
and updating sales information.
<?php require_once
'config/config.php'; require_once
'models/Sale.php'; class
SalesController { //
View all sales public
function viewSales() { $sales =
Sale::getAllSales(); require
'views/sales.php'; } //
Create a new sale public
function createSale() { if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$customer_id = $_POST['customer_id'];
$product_id = $_POST['product_id'];
$amount = $_POST['amount'];
$date = $_POST['date'];
if
(Sale::createSale($customer_id, $product_id, $amount, $date)) {
$_SESSION['success']
= 'Sale created successfully!';
header('Location: sales.php');
} else
{
$_SESSION['error']
= 'Failed to create sale!';
header('Location: create_sale.php');
} } else
{
require 'views/create_sale.php'; } } } ?>
|
Explanation:
viewSales()
: Displays all sales records.createSale()
: Creates a new sale entry, linking customers, products, and amounts.
5. controllers/CommunicationController.php
The CommunicationController.php
is responsible for managing customer communications, such as emails, calls, or
messages.
<?php require_once
'config/config.php'; require_once
'models/Communication.php'; class
CommunicationController { //
View all communications public
function
viewCommunications() {
$communications = Communication::getAllCommunications(); require
'views/communications.php'; } //
Create a new communication record public
function
createCommunication() { if
($_SERVER['REQUEST_METHOD']
=== 'POST') {
$customer_id = $_POST['customer_id'];
$type = $_POST['type'];
// Email, Call, Meeting, etc.
$details = $_POST['details'];
$date = $_POST['date'];
if (Communication::createCommunication($customer_id,
$type, $details, $date)) {
$_SESSION['success']
= 'Communication recorded successfully!';
header('Location: communications.php');
} else
{
$_SESSION['error']
= 'Failed to record communication!';
header('Location:
create_communication.php');
} } else
{
require 'views/create_communication.php'; } } } ?>
|
Explanation:
viewCommunications()
: Displays all communications related to customers.createCommunication()
: Adds a new communication record, linking it with the customer and specifying the type and details of the communication.
Summary:
- AuthController:
Manages user login, registration, and logout functionalities.
- LeadController:
Handles the creation, viewing, updating, and deletion of leads.
- CustomerController:
Manages customer records, including viewing, adding, updating, and
deleting customers.
- SalesController:
Manages sales records and the creation of new sales entries.
- CommunicationController:
Handles the logging and viewing of customer communications.
Each controller follows a similar
structure where it processes requests, performs CRUD operations on the database
(via the corresponding model), and then redirects or renders the appropriate
views.
MODELS:
User.php
, Lead.php
, Customer.php
, and Communication.php
.
1. User.php
This file handles the user-related functionalities, such as
storing user data and managing login authentication.
<?php // models/User.php namespace
App\Models; use PDO; class
User { private
$conn; private
$table = 'users'; public
$id; public
$name; public
$email; public
$password; public
$role; //
Constructor to initialize DB connection public
function __construct($db) { $this->conn
= $db; } //
Method to create a new user public
function create() { $query = 'INSERT INTO '
. $this->table . ' (name, email, password, role) VALUES (:name, :email, :password,
:role)'; $stmt = $this->conn->prepare($query); //
Bind data
$stmt->bindParam(':name',
$this->name);
$stmt->bindParam(':email',
$this->email);
$stmt->bindParam(':password',
password_hash($this->password,
PASSWORD_DEFAULT));
$stmt->bindParam(':role',
$this->role); //
Execute query if
($stmt->execute()) {
return true; } return
false; } //
Method to check user login public
function login() { $query = 'SELECT id, name, email, password, role FROM '
. $this->table . ' WHERE email = :email'; $stmt = $this->conn->prepare($query);
$stmt->bindParam(':email',
$this->email);
$stmt->execute(); if
($stmt->rowCount() > 0)
{
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (password_verify($this->password,
$row['password'])) {
return
$row;
} } return
false; } //
Method to get all users public
function getAllUsers() { $query = 'SELECT id, name, email, role FROM '
. $this->table; $stmt = $this->conn->prepare($query);
$stmt->execute(); return
$stmt; } } ?> |
2. Lead.php
This file handles the lead data, including storing new
leads and fetching lead details.
<?php // models/Lead.php namespace
App\Models; use PDO; class
Lead { private
$conn; private
$table = 'leads'; public
$id; public
$name; public
$email; public
$phone; public
$status; public
$created_at; //
Constructor to initialize DB connection public
function __construct($db) { $this->conn
= $db; } //
Method to add a new lead public
function create() { $query = 'INSERT INTO '
. $this->table . ' (name, email, phone, status) VALUES (:name, :email, :phone,
:status)'; $stmt = $this->conn->prepare($query); //
Bind data
$stmt->bindParam(':name',
$this->name);
$stmt->bindParam(':email',
$this->email);
$stmt->bindParam(':phone',
$this->phone);
$stmt->bindParam(':status',
$this->status); //
Execute query if
($stmt->execute()) {
return true; } return
false; } //
Method to get all leads public
function getAllLeads() { $query = 'SELECT id, name, email, phone, status FROM '
. $this->table; $stmt = $this->conn->prepare($query);
$stmt->execute(); return
$stmt; } //
Method to get lead details by ID public
function getLeadById($id) { $query = 'SELECT id, name, email, phone, status FROM '
. $this->table . ' WHERE id = :id'; $stmt = $this->conn->prepare($query);
$stmt->bindParam(':id',
$id);
$stmt->execute(); return
$stmt->fetch(PDO::FETCH_ASSOC); } } ?> |
3. Customer.php
This file handles customer-related functionalities,
like managing customer information.
<?php // models/Customer.php namespace
App\Models; use PDO; class
Customer { private
$conn; private
$table = 'customers'; public
$id; public
$name; public
$email; public
$phone; public
$address; public
$created_at; public
$updated_at; //
Constructor to initialize DB connection public
function __construct($db) { $this->conn
= $db; } //
Method to add a new customer public
function create() { $query = 'INSERT INTO '
. $this->table . ' (name, email, phone, address) VALUES (:name, :email, :phone,
:address)'; $stmt = $this->conn->prepare($query); //
Bind data
$stmt->bindParam(':name',
$this->name);
$stmt->bindParam(':email',
$this->email);
$stmt->bindParam(':phone',
$this->phone);
$stmt->bindParam(':address',
$this->address); //
Execute query if
($stmt->execute()) {
return true; } return
false; } //
Method to get all customers public
function getAllCustomers() { $query = 'SELECT id, name, email, phone, address FROM '
. $this->table; $stmt = $this->conn->prepare($query);
$stmt->execute(); return
$stmt; } //
Method to get customer details by ID public
function
getCustomerById($id) { $query = 'SELECT id, name, email, phone, address FROM '
. $this->table . ' WHERE id = :id'; $stmt = $this->conn->prepare($query);
$stmt->bindParam(':id',
$id);
$stmt->execute(); return
$stmt->fetch(PDO::FETCH_ASSOC); } } ?> |
4. Communication.php
This file stores and manages communications such as
emails, phone calls, etc., between the company and its customers or leads.
<?php // models/Communication.php namespace
App\Models; use PDO; class
Communication { private
$conn; private
$table = 'communications'; public
$id; public
$lead_id; public
$customer_id; public
$message; public
$date_time; public
$type; // Type of communication (e.g., email, call,
message) //
Constructor to initialize DB connection public
function __construct($db) { $this->conn
= $db; } //
Method to create a new communication entry public
function create() { $query = 'INSERT INTO '
. $this->table . ' (lead_id, customer_id, message, date_time, type) VALUES (:lead_id,
:customer_id, :message, :date_time, :type)'; $stmt = $this->conn->prepare($query); //
Bind data
$stmt->bindParam(':lead_id',
$this->lead_id);
$stmt->bindParam(':customer_id',
$this->customer_id);
$stmt->bindParam(':message',
$this->message);
$stmt->bindParam(':date_time',
$this->date_time);
$stmt->bindParam(':type',
$this->type); //
Execute query if
($stmt->execute()) {
return true; } return
false; } //
Method to get all communications public
function
getAllCommunications() { $query = 'SELECT id, lead_id,
customer_id, message, date_time, type FROM '
. $this->table; $stmt = $this->conn->prepare($query);
$stmt->execute(); return
$stmt; } //
Method to get communication details by ID public
function
getCommunicationById($id) { $query = 'SELECT id, lead_id,
customer_id, message, date_time, type FROM '
. $this->table . ' WHERE id = :id'; $stmt = $this->conn->prepare($query);
$stmt->bindParam(':id',
$id);
$stmt->execute(); return
$stmt->fetch(PDO::FETCH_ASSOC); } } ?> |
Database Setup
(SQL Example)
You can create the corresponding tables for each
model:
-- users table CREATE
TABLE users ( id INT
AUTO_INCREMENT PRIMARY KEY, name
VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL
UNIQUE, password
VARCHAR(255) NOT NULL, role
VARCHAR(50) NOT NULL, created_at TIMESTAMP
DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP
DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP ); -- leads table CREATE
TABLE leads ( id INT
AUTO_INCREMENT PRIMARY KEY, name
VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, phone VARCHAR(20), status
VARCHAR(50), created_at TIMESTAMP
DEFAULT CURRENT_TIMESTAMP ); -- customers table CREATE
TABLE customers ( id INT
AUTO_INCREMENT PRIMARY KEY, name
VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, phone VARCHAR(20), address
TEXT, created_at TIMESTAMP
DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP
DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP ); -- communications table CREATE
TABLE communications ( id INT
AUTO_INCREMENT PRIMARY KEY, lead_id INT, customer_id INT, message
TEXT, date_time TIMESTAMP
DEFAULT CURRENT_TIMESTAMP, type
VARCHAR(50), FOREIGN
KEY (lead_id) REFERENCES
leads(id), FOREIGN
KEY (customer_id) REFERENCES
customers(id) );
|
VIEWS:
1. auth/login.php
This file will allow users to log in to the system.
<!-- views/auth/login.php --> <?php if (isset($_SESSION['error'])) { echo "<p>{$_SESSION['error']}</p>"; unset($_SESSION['error']); } ?> <form
action="login_process.php"
method="POST"> <label for="email">Email:</label> <input type="email"
name="email"
required> <label for="password">Password:</label> <input type="password"
name="password"
required> <button type="submit">Login</button> </form> <p>Don't
have an account? <a
href="register.php">Register here</a></p> |
2. auth/register.php
This page allows new users to register.
<!-- views/auth/register.php
--> <?php if (isset($_SESSION['error'])) { echo "<p>{$_SESSION['error']}</p>"; unset($_SESSION['error']); } ?> <form
action="register_process.php"
method="POST"> <label for="name">Name:</label> <input type="text"
name="name"
required> <label for="email">Email:</label> <input type="email"
name="email"
required> <label for="password">Password:</label> <input type="password"
name="password"
required> <label for="role">Role:</label> <select name="role"
required> <option value="admin">Admin</option> <option value="user">User</option> </select> <button type="submit">Register</button> </form> <p>Already
have an account? <a
href="login.php">Login here</a></p>
|
3. dashboard/index.php
This file serves as the main dashboard, showing an
overview of the CRM system.
<!-- views/dashboard/index.php
--> <?php session_start(); if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit(); } ?> <h1>Welcome,
<?php echo $_SESSION['user_name']; ?>!</h1> <p>Dashboard
Overview</p> <!-- Add links to manage leads,
customers, and communications --> <ul> <li><a href="../leads/list_leads.php">View Leads</a></li> <li><a href="../customers/list_customers.php">View Customers</a></li> <li><a href="../communications/list_communications.php">View Communications</a></li> </ul>
|
4. leads/add_lead.php
This page allows users to add new leads.
<!-- views/leads/add_lead.php
--> <?php if (isset($_SESSION['error'])) { echo "<p>{$_SESSION['error']}</p>"; unset($_SESSION['error']); } ?> <form
action="../controllers/lead_controller.php"
method="POST"> <label for="name">Lead Name:</label> <input type="text"
name="name"
required> <label for="email">Email:</label> <input type="email"
name="email"
required> <label for="phone">Phone:</label> <input type="text"
name="phone"
required> <label for="status">Status:</label> <select name="status"
required> <option value="new">New</option> <option value="contacted">Contacted</option> <option value="converted">Converted</option> </select> <button type="submit">Add Lead</button> </form>
|
5. leads/list_leads.php
This page lists all the leads in the system.
<!-- views/leads/list_leads.php
--> <?php session_start(); if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit(); } ?> <h1>List
of Leads</h1> <?php // Fetch leads from the database and
display $leads = getLeads(); //
Assuming getLeads() fetches leads from DB if ($leads) { foreach
($leads as $lead) { echo "<p>Name: {$lead['name']} | Status:
{$lead['status']}</p>"; } } else
{ echo "<p>No leads found.</p>"; } ?> <a
href="add_lead.php">Add New Lead</a>
|
6. customers/add_customer.php
This page allows users to add new customers.
<!--
views/customers/add_customer.php --> <?php if (isset($_SESSION['error'])) { echo "<p>{$_SESSION['error']}</p>"; unset($_SESSION['error']); } ?> <form
action="../controllers/customer_controller.php"
method="POST"> <label for="name">Customer Name:</label> <input type="text"
name="name"
required> <label for="email">Email:</label> <input type="email"
name="email"
required> <label for="phone">Phone:</label> <input type="text"
name="phone"
required> <label for="address">Address:</label> <textarea name="address"
required></textarea> <button type="submit">Add Customer</button> </form>
|
7. customers/list_customers.php
This page lists all the customers in the system.
<!--
views/customers/list_customers.php --> <?php session_start(); if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit(); } ?> <h1>List
of Customers</h1> <?php // Fetch customers from the database
and display $customers = getCustomers(); //
Assuming getCustomers() fetches customers from DB if ($customers) { foreach
($customers as $customer) { echo "<p>Name: {$customer['name']} | Email:
{$customer['email']}</p>"; } } else
{ echo "<p>No customers found.</p>"; } ?> <a
href="add_customer.php">Add New Customer</a>
|
8. communications/log_call.php
This page allows users to log communications such as
calls, emails, etc.
<!--
views/communications/log_call.php --> <?php if (isset($_SESSION['error'])) { echo "<p>{$_SESSION['error']}</p>"; unset($_SESSION['error']); } ?> <form
action="../controllers/communication_controller.php"
method="POST"> <label for="customer_id">Customer:</label> <select name="customer_id"
required> <?php //
Assuming getCustomers() fetches customer data
$customers = getCustomers(); foreach
($customers as $customer) {
echo "<option value='{$customer['id']}'>{$customer['name']}</option>"; } ?> </select> <label for="message">Message:</label> <textarea name="message"
required></textarea> <label for="type">Communication Type:</label> <select name="type"
required> <option value="call">Call</option> <option value="email">Email</option> <option value="message">Message</option> </select> <button type="submit">Log Communication</button> </form>
|
9. communications/list_communications.php
This page lists all the communications in the system.
<!--
views/communications/list_communications.php --> <?php session_start(); if (!isset($_SESSION['user_id'])) { header('Location: login.php'); exit(); } ?> <h1>List
of Communications</h1> <?php // Fetch communications from the
database and display $communications =
getCommunications(); // Assuming getCommunications()
fetches communications from DB if ($communications)
{ foreach
($communications as $communication) { echo "<p>Customer: {$communication['customer_name']} | Type:
{$communication['type']} | Message:
{$communication['message']}</p>"; } } else
{ echo "<p>No communications found.</p>"; } ?> <a
href="log_call.php">Log New Communication</a>
|
Backend Logic for
Fetching Data (Assumed Example)
For the above views to work properly, there are some
PHP backend files that need to handle database interactions. For example, getLeads()
, getCustomers()
, getCommunications()
would likely be in controller files.
You can use methods to interact with the database and fetch required data for
the views.
Conclusion
1. public/index.php
This file serves as the entry point for the CRM application.
Typically, this file handles routing, initialization, and loads other
components of the application.
<?php // Start the session to handle user
authentication session_start(); // Autoload dependencies (assuming
you are using Composer) require
'../vendor/autoload.php'; // Load the routes (assuming routing
is handled via a simple routing mechanism like Composer's PSR-4 autoloader) require_once
'../routes/web.php'; // Handle requests based on routing $router = new
Router(); // Assuming you have a Router class $router->dispatch(); ?> |
2. public/uploads/
This directory is for uploaded files (e.g., documents,
images) and is usually referenced within your application. Files here are
publicly accessible but could be restricted to authenticated users.
You would have no PHP code in this folder directly,
just the media files your users upload.
For example, an uploaded file might look like:
public/uploads/document1.pdf
public/uploads/profile_pictures
/user1.jpg
3. public/profile_pictures/
This directory is dedicated to profile pictures
uploaded by users. Similar to the uploads/
folder, this is where users’ profile
images are stored. The images here should be publicly accessible via URLs.
public/profile_pictures/user1.jpg
In the application, you may allow users to upload and
update their profile picture by saving them in this folder.
4. routes/web.php
This file defines the routes for your CRM system, using
a basic routing mechanism.
<?php // routes/web.php // Simple routing structure (this can
be done using a router class, or via frameworks like Laravel) $router->get('/', function
() { include
'../views/dashboard/index.php';
// Dashboard page }); $router->get('/login', function
() { include
'../views/auth/login.php';
// Login page }); $router->post('/login', function
() { //
Process login credentials and authenticate include
'../controllers/auth/login_controller.php'; }); $router->get('/register', function
() { include
'../views/auth/register.php';
// Register page }); $router->post('/register', function
() { //
Process registration credentials include
'../controllers/auth/register_controller.php'; }); $router->get('/leads/add', function
() { include
'../views/leads/add_lead.php';
// Add Lead page }); $router->post('/leads/add', function
() { //
Handle new lead addition include
'../controllers/lead_controller.php'; }); $router->get('/leads/list', function
() { include
'../views/leads/list_leads.php';
// List Leads page }); // More routes can be added for
customers, communications, etc. $router->get('/customers/add', function
() { include
'../views/customers/add_customer.php';
// Add Customer page }); $router->post('/customers/add', function
() { //
Handle new customer addition include
'../controllers/customer_controller.php'; }); $router->get('/communications/log', function
() { include
'../views/communications/log_call.php';
// Log Communication page }); $router->post('/communications/log', function
() { //
Handle logging communication include
'../controllers/communication_controller.php'; }); ?> |
Routing
Explanation:
- GET requests:
These routes show the respective views like login, register, add lead,
etc.
- POST requests:
These routes handle form submissions for login, registration, lead
creation, customer creation, etc., by calling the appropriate controller
functions to process the data.
You will likely need a Router
class or a framework to handle
routing.
// A very basic router class
class Router {
private
$routes = [];
public
function get($uri, $callback) {
$this->routes[
'GET'][
$uri] =
$callback;
}
public
function post($uri, $callback) {
$this->routes[
'POST'][
$uri] =
$callback;
}
public
function dispatch() {
$uri =
$_SERVER[
'REQUEST_URI'];
$method =
$_SERVER[
'REQUEST_METHOD'];
if (
isset(
$this->routes[
$method][
$uri])) {
call_user_func(
$this->routes[
$method][
$uri]);
}
else {
echo
"Route not found!";
}
}
}
In this setup, each route corresponds to a function,
either for displaying views or processing POST data. The dispatch()
function executes the appropriate
callback when the URL matches a registered route.
5. Public Folder
Structure
The structure of your public/
folder might look something like
this:
public/
│── uploads/
│── profile_pictures/
│── index.php
// Main entry point
└── routes/
└── web.php
// Routing logic
This directory structure assumes that everything
related to the public-facing application (like uploaded files and images) is in
uploads/
and profile_pictures/
.
6. .htaccess
(Optional for Apache)
If you're using Apache as the web server, you may need
an .htaccess
file for URL rewriting, especially
for clean URLs.
# Enable URL rewriting
RewriteEngine On
# Redirect all requests to index.php, except for static files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
This will route all requests through index.php
(which in turn will handle the
routing logic you defined in web.php
).
Conclusion
The code snippets provided outline
the structure of your CRM's public folder and routing. The public/index.php
file acts as the entry point, and
the routing in web.php
connects the requests to the
appropriate views and controllers. The uploads/
and profile_pictures/
directories will hold media files,
such as documents and user profile images.
In a CRM system, the includes/
folder is typically used to store
reusable files like the header, footer, and navbar, which are included in
various pages to maintain consistency across the application.
Here is a detailed explanation and code for each of these
files (header.php
, footer.php
, and navbar.php
):
1. includes/header.php
The header.php
file typically includes HTML meta
tags, CSS, JavaScript files, and any other necessary global elements that
should appear on every page of the application. It often contains the start of
the HTML document, the head section, and sometimes the body tag.
<?php // This file contains the HTML
<head> section and some global resources ?> <!DOCTYPE
html> <html
lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport"
content="width=device-width,
initial-scale=1.0"> <title>CRM System</title> <!--
Include Bootstrap CSS for styling (you can adjust this as needed) --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css"
rel="stylesheet"> <!--
Include your custom CSS --> <link rel="stylesheet"
href="assets/css/style.css"> <!--
Font Awesome for icons --> <link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> <!--
Include jQuery (if needed for your app) --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <div class="container"> <!--
The navbar and other elements will be included in respective files -->
|
Explanation:
- Meta Tags:
Standard meta tags for character encoding and viewport settings.
- CSS Files:
Bootstrap for quick styling and your custom
style.css
file. - Font Awesome:
For using icons like
fa
, which might be used in buttons, navigation, etc. - jQuery:
If your app requires JavaScript libraries like jQuery, it's included here.
You could use pure JavaScript or a framework like React, but jQuery is
common for traditional applications.
2. includes/footer.php
The footer.php
file contains the footer section that
appears at the bottom of every page. It usually includes copyright information,
links, and footer-specific JavaScript or additional resources.
<?php
// This file contains the closing body and html tags, as well as footer content
?>
</div> <!-- Container div closure
from header.php -->
<!-- Footer section -->
<footer
class="text-center mt-4">
<p>© <?php echo date("Y"); ?> CRM System. All Rights Reserved.</p>
<p><a href="privacy-policy.php">Privacy Policy</a> | <a href="terms.php">Terms of Service</a></p>
</footer>
<!-- Bootstrap JS for interactive components like modals, dropdowns, etc. -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<!-- Your custom JS scripts -->
<script src="assets/js/main.js"></script>
</body>
</html>
Explanation:
- Footer Content:
It includes a copyright message that dynamically shows the current year
using PHP's
date("Y")
. - JavaScript:
At the end of the body, JavaScript files are included to ensure that all
HTML content is loaded before JS executes. Bootstrap's JS is included here
to provide functionality for components like modals, tooltips, and
carousels.
- Main JS File:
This is where you can add custom JavaScript for your CRM application (
main.js
).
3. includes/navbar.php
The navbar.php
file contains the navigation bar,
which is typically displayed at the top of the page and allows users to
navigate between different sections like Dashboard, Leads, Customers,
Communications, etc.
<?php // This file contains the navigation
bar that will be included on every page ?> <nav
class="navbar
navbar-expand-lg navbar-light bg-light"> <div class="container-fluid"> <a class="navbar-brand"
href="index.php">CRM System</a> <button class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle
navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse
navbar-collapse" id="navbarNav"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link
active" aria-current="page"
href="index.php">Dashboard</a> </li> <li class="nav-item"> <a class="nav-link"
href="leads/list_leads.php">Leads</a> </li> <li class="nav-item"> <a class="nav-link"
href="customers/list_customers.php">Customers</a> </li> <li class="nav-item"> <a class="nav-link"
href="communications/list_communications.php">Communications</a> </li> <li class="nav-item"> <a class="nav-link"
href="auth/logout.php">Logout</a> </li> </ul> </div> </div> </nav>
|
Explanation:
- Navbar Structure:
The
navbar
component uses Bootstrap's grid system to create a responsive navigation bar. It includes links to the Dashboard, Leads, Customers, and Communications sections of the CRM. - Logout Link:
There's a logout link that can be included in the navbar to allow users to
sign out.
Example Directory
Structure for includes/
Your directory structure for includes/
should look like this:
includes/
│──
header.php
// Contains the head and opening body tags
│──
footer.php
// Contains the footer content and closing tags
└──
navbar.php
// Contains the navigation bar
Example Usage in
Other Files
Now, in any other page of your CRM (e.g., dashboard/index.php
, leads/list_leads.php
), you can include these files to
ensure consistent page structure:
// Include the header and navbar for the page
include
'../includes/header.php';
include
'../includes/navbar.php';
?>
<!-- Page specific content -->
<div
class="content">
<h1>Welcome to the CRM Dashboard</h1>
<!-- More content goes here -->
</div>
<?php
// Include the footer
include '../includes/footer.php';
?>
Summary
header.php
: Contains the head section of the HTML (meta tags, CSS, JS, etc.), and begins the<body>
tag.footer.php
: Contains the footer section (copyright, policy links, JS files) and closes the HTML tags.navbar.php
: Contains the navigation bar with links to different sections of the CRM.
This setup ensures that all pages
share the same header, footer, and navbar, making it easy to update global
elements in one place.
1. database/crm_database.sql
This file contains the SQL schema for creating the database
and tables required for the CRM system. It will define the structure of tables
like users, leads, customers, communications, and any other necessary entities.
-- Create the CRM database
CREATE DATABASE IF
NOT
EXISTS crm_system;
USE crm_system;
-- Create the 'users' table
CREATE
TABLE IF
NOT
EXISTS users (
id
INT AUTO_INCREMENT
PRIMARY KEY,
name
VARCHAR(
255)
NOT
NULL,
email
VARCHAR(
255)
NOT
NULL
UNIQUE,
password
VARCHAR(
255)
NOT
NULL,
role ENUM(
'admin',
'user')
DEFAULT
'user',
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP,
updated_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
);
-- Create the 'leads' table
CREATE
TABLE IF
NOT
EXISTS leads (
id
INT AUTO_INCREMENT
PRIMARY KEY,
title
VARCHAR(
255)
NOT
NULL,
description TEXT,
status ENUM(
'open',
'contacted',
'closed')
DEFAULT
'open',
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP,
updated_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
);
-- Create the 'customers' table
CREATE
TABLE IF
NOT
EXISTS customers (
id
INT AUTO_INCREMENT
PRIMARY KEY,
name
VARCHAR(
255)
NOT
NULL,
email
VARCHAR(
255)
NOT
NULL
UNIQUE,
phone
VARCHAR(
15),
address TEXT,
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP,
updated_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
);
-- Create the 'communications' table
CREATE
TABLE IF
NOT
EXISTS communications (
id
INT AUTO_INCREMENT
PRIMARY KEY,
customer_id
INT
NOT
NULL,
communication_type ENUM(
'call',
'email',
'meeting')
NOT
NULL,
notes TEXT,
communication_date
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP,
created_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP,
updated_at
TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP,
FOREIGN KEY (customer_id)
REFERENCES customers(id)
ON
DELETE CASCADE
);
-- Insert a sample user (admin)
INSERT
INTO users (name, email, password, role)
VALUES (
'Admin User',
'admin@crm.com',
'hashed_password_here',
'admin');
Explanation:
users
Table: Stores user data, including login credentials and user role (admin or user).leads
Table: Stores information about leads, with a title, description, and status (open, contacted, closed).customers
Table: Stores customer data such as name, email, phone number, and address.communications
Table: Stores information on communications with customers, including type and date.
Note: The password should be hashed in
real-life applications. Use PHP’s password_hash()
function for this. The hashed_password_here
is just a placeholder for a real
hashed password.
2. index.php
The index.php
file is the main entry point for the
CRM system. It usually displays a welcome message, the dashboard, or the home
page when a user accesses the site.
<?php // Start session and include
necessary files session_start(); include
'includes/header.php'; include
'includes/navbar.php'; // Check if the user is logged in if (!isset($_SESSION['user_id'])) { header('Location: auth/login.php'); exit; } ?> <div
class="container"> <h1>Welcome to CRM System</h1> <p>This is your dashboard.</p> <a href="leads/list_leads.php"
class="btn
btn-primary">View
Leads</a> <a href="customers/list_customers.php"
class="btn
btn-primary">View
Customers</a> <a href="communications/list_communications.php"
class="btn
btn-primary">View
Communications</a> </div> <?php // Include the footer include
'includes/footer.php'; ?>
|
Explanation:
- Session Check:
If the user is not logged in (i.e.,
$_SESSION['user_id']
is not set), they are redirected to the login page. - Links:
Buttons that link to the leads, customers, and communications pages.
3. .htaccess
This file is used for configuration purposes in Apache
web servers. It can be used for things like URL rewriting, security settings,
or preventing unauthorized access to specific files.
# Enable URL rewriting
RewriteEngine On
# Redirect to index.php for all URLs (if your CRM follows clean URLs)
RewriteRule ^$ index.php [L]
RewriteRule ^index$ index.php [L]
RewriteRule ^(.*)$ index.php/$1 [L]
# Prevent access to certain directories or files (e.g., database)
RewriteRule ^database/ - [F]
# Set permissions for files
<Files .env>
Order Allow,Deny
Deny from all
</Files>
Explanation:
- URL Rewriting:
Routes all requests to
index.php
to handle routing. It allows cleaner URLs. - Security:
Denies direct access to sensitive files like
.env
or database-related files.
Note: The actual configuration for your
application might change based on the environment and web server setup.
4. README.md
The README.md
file provides essential information
about the project, including how to install and configure it, usage
instructions, and other helpful details.
# CRM System
## Introduction
This is a CRM (Customer Relationship Management) system designed for managing leads, customers, and communications. It helps businesses track interactions with customers and manage sales leads.
## Features
- User authentication (Admin and User roles)
- Manage Leads: Add, Edit, Delete, List
- Manage Customers: Add, Edit, Delete, List
- Log Communications with Customers (Calls, Emails, Meetings)
- User-friendly interface with Bootstrap
## Installation
### Prerequisites
- PHP >= 7.4
- MySQL or MariaDB
- Apache or Nginx (with URL rewriting enabled)
### Steps
1. Clone the repository or download the source files.
2. Import the
`crm_database.sql` file into your MySQL database.
3. Set up a
`.env` file (or modify database connection in the config) with your database credentials.
4. Run
`composer install` to install dependencies (if you use Composer).
5. Navigate to the project folder and open
`index.php` in your browser.
### Configuration
Edit the database configuration in
`config/database.php` (or use the
`.env` file to set up your credentials).
## Contributing
Feel free to fork this project and submit pull requests. Contributions are welcome!
## License
This project is open-source and available under the MIT License.
Explanation:
- Introduction:
A brief description of the CRM system and its purpose.
- Features:
Lists the features available in the CRM system.
- Installation Instructions:
Step-by-step guide to set up the system on a local machine or server.
- Contributing:
Encourages others to contribute to the project.
- License:
States the project license (MIT in this case).
Directory
Structure for database/
and Other Files:
/
database
│── crm_database.
sql //
SQL
schema
for the CRM
database
/
index.php // Main entry
point
to the CRM
system
/.htaccess // Apache
server
configuration
/README.md // Project documentation
Summary of Each
File:
1.
crm_database.sql
:
Contains SQL queries to create the database and all necessary tables (users,
leads, customers, communications).
2.
index.php
:
The landing page of the CRM that shows the dashboard and links to other
sections (leads, customers, etc.).
3.
.htaccess
:
Configures the Apache server for URL rewriting and restricts access to certain
files and directories.
4.
README.md
:
Provides an overview of the project, installation instructions, and
contribution guidelines.
This setup provides a solid
foundation for a CRM system with database management and essential
functionality, ensuring it's easy to use and extend for future improvements.