0% found this document useful (0 votes)
8 views40 pages

Project Report34

The document certifies the completion of a summer project titled 'Customer Relationship Management System' by Bhanu Bhakta Shrestha under the supervision of Er. Dhiraj Kumar Jha, as part of the requirements for a Bachelor of Information Management at Tribhuvan University. It outlines the project's objectives, methodologies, and the development process, emphasizing the system's role in managing customer interactions and issue tracking. The project aims to enhance customer relationships by organizing and prioritizing customer issues effectively.

Uploaded by

Dhiraj Jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views40 pages

Project Report34

The document certifies the completion of a summer project titled 'Customer Relationship Management System' by Bhanu Bhakta Shrestha under the supervision of Er. Dhiraj Kumar Jha, as part of the requirements for a Bachelor of Information Management at Tribhuvan University. It outlines the project's objectives, methodologies, and the development process, emphasizing the system's role in managing customer interactions and issue tracking. The project aims to enhance customer relationships by organizing and prioritizing customer issues effectively.

Uploaded by

Dhiraj Jha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

STUDENT DECLARATION

This is to certify that I have completed the summer project entitled "Customer
Relationship Management System" under the guidance of "Er. Dhiraj Kumar Jha" in
partial fulfillment of the requirement for the degree of Bachelor of Information
Management at Faculty of Management, Tribhuvan University. This is my original
work and I have not submitted it earlier elsewhere.

Date: 2025 /04/13

Signature:

Name: Bhanu Bhakta Shrestha

Roll No: 13270/21

i
CERTIFICATION FROM THE SUPERVISOR
This is to certify that the summer project entitled “customer Relationship
Management System” is academic work done by “ Bhanu Bhakta Shrestha
(13270/21)” submitted in the partial fulfillment of the requirements for the degree
of Bachelor of Information Management at Faculty of Management, Tribhuvan
University under my guidance and supervision. To the best of my knowledge, the
information presented by him in the project report has not been submitted earlier.

Signature of the Supervisor


Name: Er. Dhiraj Kumar Jha
Designation Date:

ii
APPROVAL SHEET
this is to certify that the project titled Customer Relationship Management system
submitted by Bhanu Bhakta Shrestha (13270/21) has been examined and approved.
In our opinion, it meets the required scope and quality standards for a project
submitted in partial fulfillment of the requirements for the degree of Bachelor of
Information Management (BIM).

Approval Panel:
S.No. Name Designation Signature

1 Er. Dhiraj Kumar Jha Project Supervisor

2 Er. Nipun Thapa Program


Coordinator
3 Hemant Mehta Internal Examiner

4 External Examiner

iii
ACKNOWLEDGMENTS
I have taken efforts in this project. However, it would not have been possible without
the kind support and help of many individuals and the organization. I will like to extend
my sincere thanks to all of them. I am highly indebted to our college, our coordinator
"Er. Dhiraj Kumar Jha" for their guidance and constant supervision as well as for
providing necessary information regarding the project and also for their support in
completing the project. I would like to express gratitude towards "Leading
Professional Technology" for their Kind co-operation and encouragement which help
me in completion of the project. My thanks and appreciation also go to my college
mates in the developing the project and people who have willingly helped me out with
their abilities.

Sincerely,
Bhanu Bhakta Shrestha
BIM 6th Semester
Orchid International College

iv
ABSTRACT
The purpose of Customer Relationship Management (CRM) System is to provide a
comprehensive and efficient way to manage the interactions with customers and
prospects. The primary goal of an CRM system is to organize and analysis customer
data in order to improve customer relationships. The system allows customers to send
the issues they are facing about the provided software and see the status of issue if they
are ongoing or fixed. The management solves the issues on the basis of the category.
The critical issues are prioritized and solved earlier by the management.

In order to develop this system, various methodology and techniques were used.
Primary methods like: Personal interviews, Observation and Secondary methods like:
external sources have helped a lot to collect the required information for the system.

Keywords: Customer Relationship Management, Issue Tracking System, User


Authentication, Role-based Dashboard, Admin Panel, Customer Support, Issues
Management, Feedback System, Web-based CRM, PHP MySQL Application

v
TABLE OF CONTENTS
STUDENT DECLARATION : .................................................................. i

CERTIFICATE FROM THE SUPERVISOR: .............................................. ii

APPROVAL SHEET :................................................................................. ii

ACKNOWLEDGEMENTS:......................................................................... iv

ABSTRACT : .............................................................................................. v

TABLE OF CONTENTS: ............................................................................ vi

LIST OF TABLES : .................................................................................. viii

LIST OF FIGURES: ................................................................................... ix

LIST OF ABBREVIATIONS: ...................................................................... x

CHAPTER I INTRODUCTION ............................................................. 1


1.1 Background of the project ................................................................... 1
1.2 Problem statement ............................................................................... 1
1.3 Objectives ........................................................................................... 1
1.4 Review of Related Work Literature .................................................... 1
1.5 Development Methodology ................................................................. 2
1.6 Scope and Limitations ......................................................................... 3
1.7 Report Organization ............................................................................ 4

CHAPTER II SYSTEM DEVELOPMENT PROCESS .......................... 6


2.1 Analysis .......................................................................................... 6

2.1.1 Requirement Analysis .............................................................. 6

2.1.2 Feasibility Study ...................................................................... 7

2.1.3 Object Oriented Modeling ....................................................... 8

2.2 Design ............................................................................................ 12

2.2.1 Object-Oriented Models ........................................................... 13

vi
2.2.2 Schedule Feasibility .................................................................. 14

2.3 Implementation ..................................................................................... 15

2.3.1 Tools and Technologies used .......................................................... 16

2.3.2 Module Description......................................................................... 17

2.3.4 Testing ............................................................................................ 19

CHAPTER III DISCUSSION AND CONCLUSION .................................. 20

3.1 Summary ............................................................................................ 20

3.2 conclusion........................................................................................... 20

3.3 Recommendation ................................................................................ 20

REFERENCES ............................................................................................. 21

APPENDIX ................................................................................................... 22

vii
LIST OF FIGURES
Figure 1.1 The Waterfall Model of SDLC .................................................. 3

Figure 2.1 Use Case Diagram ..................................................................... 8

Figure 2.2 Login page ................................................................................ 13

Figure 2. 3 User Dashboard ........................................................................ 15

Figure 2.4 Er -Diagram ............................................................................. 16

Figure 2.5 Activity Diagram UC- 2 (Report issue)...................................... 17

Figure 2.6 Activity Diagram UC -3 (View issue) ........................................ 18

viii
LIST OF TABLES
Table 2.1 UC description create issue: ...................................................... 9

Table 2.2 UC Description Report issue: ..................................................... 9

Table 2.3 UC description view issue : ........................................................ 9

Table 2.4 UC Description Manage issue: ................................................... 10

Table 2.5 UC Description update status : ................................................... 10

Table 2.6 UC Description view status :....................................................... 11

Table 2.7 UC Description Give Feedback:.................................................. 19

Table 2.8 UC Description View Feedback: ................................................ 19

Table 2.9 test case for login: ...................................................................... 19

Table 2.10 Test case for feedback: ............................................................ 19

ix
LIST OF ABBREVIATIONS

BIM: Bachelor of Information Management

TU: Tribhuvan University

CRM: Customer Relationship Management

SRS: Software Requirement Specification

NRF: Non Functional Requirements

UC: Use Case

GUI: Graphical User Interface

x
CHAPTER I: INTRODUCTION

1.1 Background

A CRM (Customer Relationship Management) system is a software tool that businesses


use to manage their interactions with customers and prospects. It helps companies to
organize and analyze customer data in order to improve customer relationships. The
system typically includes modules for managing customer data, analytics and reporting.
The CRM system is a powerful tool for businesses to better understand and engage with
their customers, ultimately leading to increased customer satisfaction and loyalty.

1.2 Problem Statement

The organization receives the issues from the customers that occurs in the software. But
it is hard to keep track of the records that is similar to previous issues for the
organization and to prioritize the critical issues first. It is hard for the customer as well
since they have to keep asking about the status of the problem that is to be solved. To
overcome that problem, CRM system is necessary as it stores all the previous record. It
provides the status of the issue to the customer. The issues sent by the customers are
also prioritized on the basis of categories which helps to solve critical issues earlier.

1.3 Objectives

• To build web application to keep track of issues to avoid similar scenario.

• To maintain positive relationship with customer through interactions.

• To prioritize critical issues earlier.

1.4 Literature Review


Customer Relationship Management (CRM) is the 'core business strategy' that
combines internal processes and functions, and external networks, to create and deliver
value to targeted customers at a profit (Buttle. F,2008). CRM system helps to keep track
of issues to avoid similar scenario and to prioritize critical issues earlier. It is grounded
on high quality customer related data and support by information technology. Customer
relationship management can further be defined as a complete set of activities covering
all functions of the organisation, relating with and supporting a consumer. Such

1
activities build customer satisfaction by way of providing to their needs, and want over
a long period of time (Wimshurst & Mackay, 2002).

Customer Relationship Management is defined as a business attitude. Customer


Relationship Management (CRM) is an IT-enhanced value process, which identifies,
mature, combine and focuses the various capabilities of the organisation to the
customer's opinion in order to deliver long term exceptional customer value, at a profit,
to well-known existing and future customer segments. (Starky & Woodcock, 2000)

Customer Relationship Management (CRM) affiliates business processes with


customer's strategies to build customer loyalty and to increase profit long term. In their
definition the words technology and software were not cited. In order words the authors
believe that customer relationship management (CRM) is seen as a set of customer
strategies and processes, supported by the pertinent software, for the purpose of
improving customer loyalty and ultimately, corporate profitability. (Rigby, Reichheld
and Schefter, 2002)

2
1.5 Methodology

Requirements

Design

Implementation

Verification& validation

Operation & Maintenence

Figure 1.1 : waterfall Model

The waterfall Methodology is used to complete this project . The system and user
needs are clearly specified, Thus, there is less need to update the system ,which is
why this methodology is being considering this methodology is as follow:

 All steps and requirements are defined before design.


 Easier to understand and implement.
1.6 SCOPE AND LIMITATION

Scope

 Admin dashboard to manage customer issues.


 Customer dashboard to submit issues and view status.
 Issue status updates (Open, In Progress, Resolved).
 Communication tracking between admin and customer.
 Simple and user-friendly interface.

3
Limitation
 No real-time chat or messaging.
 No email or SMS notifications.
 No option to upload files with issues.
 No advanced reports or analytics.
 No support for multiple admins or departments.

1.7 REPORT ORGANIZATION


This report is divided into different section to explain the project clearly :

Chapter I: Introduction
The Customer Relationship Management (CRM) System is designed to improve the
way businesses handle customer issues and support. This project focuses on creating a
simple web-based platform where customers can submit their problems or concerns,
and administrators can review, manage, and resolve those issues efficiently. The goal
of the system is to enhance communication between customers and support teams,
reduce response times, and maintain a record of issue histories. The scope of the project
includes two main user roles: Admin and Customer. Customers can log in to submit
issues and view their status, while Admins can manage all submissions and update their
progress. However, the system has certain limitations, such as the absence of real-time
chat, file uploads, and automated notifications. Despite these, the system provides a
solid foundation for structured customer support.

Chapter II: System development Process

The development of the CRM system followed a structured approach that included
system analysis, design, implementation, and testing. In the analysis phase, the specific
needs of the users were identified—customers needed an easy way to submit support
requests, while admins required tools to track and manage these issues. During the
design phase, diagrams such as Use Case and Entity-Relationship Diagrams (ERDs)
were created to visualize how data and users interact within the system. The
implementation phase involved using technologies like PHP, MySQL, HTML, and CSS
to build both the Admin and Customer dashboards. These dashboards support essential

4
functionalities like issue submission, status tracking, and updates. After development,
the system underwent testing to ensure that all features functioned correctly, including
login security, issue flow, and dashboard performance. Test cases confirmed that the
system met its intended objectives.

Chapter III: Conclusion and Recommendation

In conclusion, the CRM system successfully provides a basic yet functional platform
for customer issue management. It enables clear communication between customers
and administrators and helps maintain a record of all submitted and resolved issues.
The system addresses the primary goal of improving customer support in a small to
medium-sized organization. However, to further enhance the system, several
improvements are recommended. These include integrating real-time chat for faster
communication, allowing customers to attach files for better issue reporting, adding
automated notifications via email or SMS, and improving mobile responsiveness.
Implementing these features in future versions would make the CRM system more
comprehensive and efficient.

5
CHAPTER III: SYSTEM DEVELOPMENT PROCESS

2.1 Analysis
2.1.1 Requirement Analysis
A software requirements specification (SRS) is a description of a software system to
be developed. The software requirements specification lays out functional and
nonfunctional requirements, and it may include a set of use cases that describe user
interactions that the software must provide to the user for perfect interaction.

Functional Requirement
Functional requirements may involve calculations, technical details, data manipulation
and processing, and other specific functionality that define what a system is supposed
to accomplish. It describes a software system or its component. A function is nothing
but inputs to the software system, its behaviour, and outputs. It can be a calculation,
data manipulation, business process, user interaction, or any other specific functionality
which defines what function a system is likely to perform.

Functional Requirement can range from the high-level abstract statement of the
sender's necessity to detailed mathematical functional requirement specifications.
Functional software requirements help you to capture the intended behaviour of the
system.

It describes the functions of system and its components. The 'Customer Relationship
Management System' shall contain the admin who could be able to view the details of
customers, category and issues information and the customers who can generate issues
to report the issues. The admin can also send the notification to the customers about the
progress of issues.

Non Functional Requirements

Software complexity of a system is a factor of several criteria such as maintainability,


performance, robustness, reliability etc. These criteria are known as non-functional
requirements(NRFs). These criteria are essential specially during the selection of

6
different design workflows and technological tools for building the application. The
non-functional requirements of Customer Relationship Management system are as
follows:

• The system should have a user friendly interface.

• The system shall provide the reliable source of information.

• The system should be maintainable when required.

• The privacy of users should be properly maintained.

• The system should be fast enough to process the data

2.1.2 Feasibility Study

A feasibility study sometimes called a feasibility analysis or feasibility report is a way


to evaluate whether or not a project plan could be successful. A feasibility study
evaluates the practicality of your project plan in order to judge whether or not you're
able to move forward with the project.

Operational Feasibility
Our system is based on easily understandable GUI. The operation is quite feasible. The
users can add, remove, assign very easily as well as view data with just a few clicks of
a button.

Schedule Feasibility
Schedule feasibility refers to validating that a system confronts to the given time
constraints. There is possibility of updating or maintaining this system from time to
time without any hassle, under given time constraints.

System Analysis
System is the process of collecting, interpreting and analyzing the facts, identifying the
problems, and decomposition of a system into its components. It is conducted for
studying a system or its parts to identify its objectives. It is a problem-solving technique
that improves the system and ensures that all the components of the system work
efficiently to accomplish their purpose.

7
Use Case Modeling

A use case diagram is a way to summarize details of a system and the users within that
system. It is generally shown as a graphic depiction of interactions among different
elements in a system. Use case diagrams will specify the events in a system and how
those events flow, however, use case diagram does not describe how those events are
implemented.

Figure 2.1 : Use case Diagram for customer Relationship Management system

8
Table 2.1 Use case Description (create issue)
Use -case identifier Uc2: create issue
Primary Actor Customer
Secondary Actor Admin
Description Customer should be able to generate
issue
Pre- condition The customer already logged in
Post- condition Admin will manage /check issue
Success scenario Issue is successfully generated
Failure Scenario Failed to generate issue

Table 2.2 Use Case Description (Report Issue)

Use- Case identifier UC4: Report Issue


Primary Actor Customer
Secondary Actor Admin
Description Customer should be able to report issues
related to bugs
. Pre-condition condition The issued is already managed
Post-condition The admin must be able to view the
reported issue
Success Scenario The issues are successfully report
Failure Scenario Scenario Failed to report issues

Table 2.3 Use Case Description (View Issues)

Use-Case Identifier UCS: View Issues


Primary Actor Admin
Secondary Actor customer
Description Admin should be able to view issues sent
by customer

9
Pre-condition The issues are already reported by
customer
Post-condition The issues will be stored in
knowledgebase
Success Scenario The issues can be viewed by admin
Failure Scenario Database is not updated

Table 2.4 Use Case Description (Manage issue)

Use-Case identifier UC6: Manage issue


Primary Actor Admin
Secondary Actor customer

Description Admin should be able to categorize the


issue and solve it based on its priority
Pre-condition The issues are already viewed by the
admin
Post-condition condition The categorized issues will
now be stored in manage issue
Success Scenario Scenario The category can be sorted by
admin
Failure Scenario Database is not updated

Table 2.5 Use Case Description (Update Status)

Use-Case Identifier UC8: Update Status

Primary Actor Admin

Secondary Actor customer

Description Admin should be able to update the status


of issue

Pre-condition The knowledgebase is already updated

10
Post-condition The admin and customer can view the
status of issue

Success Scenario The status is updated

Failure Scenario The database is not updated

Table 2.6 Use Case Description (View Status)

Use-Case Identifier UC9: View Status

Primary Actor Customer ,admin

Secondary Actor -

Description Adin and customer should be able to


view the status of issues

Pre-condition The admin has already updated the status


of issues

Post-condition The admin will then provide feedback to


customer about their issue being solved

Success Scenario The status is visible by both admin and


customer

Failure Scenario The redirection page is not appropriate


Failed to load page

11
2.2 Design

The design of the Customer Relationship Management (CRM) System is centered


around simplicity, functionality, and ease of use for both administrators and customers.
The system is structured with two main user roles: Admin and Customer. Customers
can register, log in, and submit issues or complaints through a user-friendly dashboard.
Admins, on the other hand, have access to a separate dashboard where they can view
all submitted issues, update their status, and respond to customers accordingly. The
design process began with the creation of Use Case Diagrams to represent how users
interact with the system. This was followed by Entity-Relationship Diagrams (ERDs)
to map out the structure of the database, including tables such as users, issues, and status
logs.

The system architecture is based on a client-server model, with a web interface


developed using HTML, CSS, and JavaScript for the front-end, and PHP and MySQL
for the back-end logic and database. The Admin and Customer dashboards are designed
with a clean, responsive layout to ensure usability across devices. Each dashboard
provides clearly labeled navigation menus, forms for input, and tables for displaying
issue information. The user interface emphasizes clarity, with visual indicators for issue
status (e.g., Open, In Progress, Resolved) and timestamps to track updates. The
database design supports relationships between customers and their submitted issues,
ensuring that each record is securely stored and easily retrievable for review or action.
Overall, the system design ensures efficient interaction between users and smooth data
flow throughout the application.

2.1.1 User Interface Design:

Login page:

The login page of the Customer Relationship Management (CRM) system provides a
simple and user-friendly interface that allows users to securely access their accounts.
At the center of the page, a neatly styled login form is presented within a white, rounded
container, creating a clean and modern look against the light gray background. The
form includes a bold title labeled "Login" to clearly indicate its purpose. Below the title,
there are two input fields: one for the Username and another for the Password. The

12
username field uses a light border with placeholder text to guide the user, while the
password field is slightly emphasized with a darker border, likely styled for better
visibility or focus. The password input is designed to hide the characters for security.
Below the input fields, a prominent green Login button is displayed, which submits the
form when clicked. This button uses green to signal a positive action and encourage
user interaction. The overall design is intuitive, responsive, and accessible, making it
easy for both Admin and Customer users to log in to their respective dashboards.
Although not visible in the image, the system is expected to validate user credentials
and provide feedback for incorrect logins. This interface serves as the secure entry point
for managing customer issues and accessing system features based on user roles.

Figure 2.2: Login page

User Dashboard:

The customer dashboard serves as the main interface for users after logging into the
CRM system. It features a clean and organized layout, divided into two main sections:

13
a dark sidebar on the left for navigation, and a content area on the right for interactive
actions. At the top of the screen, a green welcome banner greets the user by name (in
this case, "Welcome, user"), confirming that the login was successful and personalized.

The sidebar menu provides links to essential sections of the CRM system. It includes
options such as Dashboard, Submit Issue, View Status, View Feedback, and Logout.
This navigation pane ensures that the user can quickly access any part of the system
with ease.

On the main content area, three key action cards are displayed:

 Submit Issue – Allows the user to report a new problem or request by


clicking the green "Submit Issue" button.
 View Status – Lets the user view the progress or current state of
previously submitted issues by clicking "View".
 View Feedback – Provides access to feedback or responses from the
admin regarding submitted issues.

Each section is styled consistently with white containers and green action buttons,
giving the interface a modern and cohesive look. The dashboard ensures customers can
easily perform their tasks without confusion, contributing to a smooth and efficient user
experience within the CRM system.

14
Figure 2.3: user Dashboard

ER Diagram:
An entity relationship diagram shows the relationships of entity sets stored in a
database. An entity in this context is an object , a component of data.

15
Figure2.4: ER Diagram of customer relationship management system

16
Activity diagram

Activity diagrams are graphical representations of workflows of stepwise activities.


Activity diagrams are intended to model both computational and organizational
processes. Activity diagrams are constructed from a limited number of shapes,
connected with arrows

Figure 2.5:Activity Diagram of Uc-2 Report issue

17
Figure 2.6 Activity Diagram UC-3 View issue

18
2.3.System Testing

In testing, the different inputs were tested as input to GUI forms which can be shown
below with the help of table as well as figure:

Table 2.8: Test Case for login

Unit Effected Test Input Actual Result Expected Remarks


Data Result
Admin Login Username= Login error Error in login Fail
admin message is
Password= displayed
admin
Customer Username= Login Login should pass
Login Bhanu successful be successful
Password=
bhanu123

Table 2.9: Test Case for feedback

Unit effected Test Data Actual Result Expected Remarks


input result
Feedback Message= Message Message Fail
required required

Table 2.10 : Test Case for Updating issues

Unit Effected Test Data Input Actual Expected Remarks


result result
Update Issue Title= App Please fill Error. Please Fail
records Crash Issue up all the fill up all the
Description= information information
Solution
Description=
Date Resolved

19
CHAPTER III: CONCLUSION AND
RECOMMENDATION

3.1 Summary
"Customer Relationship Management System" is web based application made for easy
managing of the work for "Leading Professional Technology". The software is able to
generate ticket to different customer. The customer can report the issues they are facing
in the provided software through the generated ticket and see the status of issue if they
are ongoing or fixed. The issues are then prioritized on the basis of the category. The
critical issues are solved first. The system allows the customer to easily interact with
the management in order to issues.

3.2 Conclusion
The system was successfully completed in time as per the objectives. The web based
application helps its customer to easily generate ticket to report issues and get the
possible solution or update from the admin. It helps admin to monitor the number of
issues the customers are facing. Working on this project helped me acquire a more in-
depth knowledge about real time working procedure in an organization and has also
helped me enhance my skills.

3.3 Recommendation
While the current CRM system successfully meets its basic goals of enabling
customers to submit issues and allowing administrators to respond and manage them,
there are several areas where enhancements can significantly improve the system’s
functionality and user experience. First, it is recommended to implement real-time
notifications (via email or in-system alerts) so that both customers and admins are
immediately informed of any status updates or responses. This will improve
communication efficiency and responsiveness.

20
References

Andajani, E., & Badriyah, N. (2017). The role of customer relationship management
in Indonesia business. Jurnal Ilmiah Bidang Akuntansi dan Manajemen (JEMA),
14(1).

Chen, J. S., Yen, H. R., Li, E. Y., & Ching, R. K. (2009). Measuring CRM
effectiveness: Construct development, validation and application of a process-oriented
model. Total Quality Management, 20(3), 283–299.
https://doi.org/10.1080/14783360902719267

Xu, Y., Yen, D. C., Lin, B., & Chou, D. C. (2002). Adopting customer relationship
management technology. Industrial Management & Data Systems, 102(8), 442–452.
https://doi.org/10.1108/02635570210445871

21
Appendix

Figure : Admin login

Figure : admin Dashboard

22
Figure :Admin status

Figure: Admin Feedback

23
Figure: User registration

24
Figure: admin status

Figure : customer list

25
Figure :customer dashboard

Figure : Feedback

26
Figure : customer status

Figure : customer generate issue

27
User Registration Code:
Handles user sign -up by validating input fields , securely storing passwords using
hashing.

<?php
require 'config.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['username'];
$email = $_POST['email'];
$password = password_hash($_POST['password'],
PASSWORD_DEFAULT);

$sql = "INSERT INTO users (username, email, password) VALUES


('$name', '$email', '$password')";

if (mysqli_query($conn, $sql)) {
echo "Registration successful! <a href='login.php'>Login
here</a>";
} else {
echo "Error: " . mysqli_error($conn);
}
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Register</title>
</head>
<body>
<h2>Register</h2>
<form action="" method="POST">
<input type="text" name="name" placeholder="Full Name"
required><br>
<input type="email" name="email" placeholder="Email"
required><br>
<input type="password" name="password"
placeholder="Password" required><br>
<button type="submit">Register</button>
</form>
<p>Already have an account? <a href="login.php">Login</a></p>
</body>
</html>

28
User Login Code
Authenticates users by verifying email and passwords credentials against stored
hashed password

Process POST login


if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = trim($_POST["username"]);
$password = trim($_POST["password"]);

// Validate empty fields


if (empty($username) || empty($password)) {
echo "<script>alert('All fields are required!');
window.location.href='login.php';</script>";
exit();
}

// Admin login check


if ($username === "admin" && $password === "admin123") {
$_SESSION["admin_name"] = "admin";
header("Location: dashboard.php");
exit();
}

// Normal user login check


$sql = "SELECT id, username, password FROM users WHERE
username = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $username);
$stmt->execute();
$result = $stmt->get_result();

// If user exists
if ($result->num_rows === 1) {
$row = $result->fetch_assoc();

if (password_verify($password, $row["password"])) {
$_SESSION["user_id"] = $row["id"];
$_SESSION["username"] = $row["username"];
$_SESSION["customer_name"] = $row["username"];
header("Location: custmoerdashbord.php");
exit();
} else {
echo "<script>alert('Incorrect password!');
window.location.href='login.php';</script>";
}
} else {

29
echo "<script>alert('User not found!');
window.location.href='login.php';</script>";
}

$stmt->close();
$conn->close();
}
?>

30

You might also like