You are on page 1of 55

ID CARD BARCODE READER

Project report submitted to the Bharathiar University Coimbatore in partial fulfillment of the
requirements for the award of the degree of

BACHELOR OF COMPUTER SCIENCE


Submitted by

KEERTHANA.K.M

(Reg.No: 2122K0295)

Under the Guidance of

MS P.SRIDEVI BCA,MCA,M.Phil.,

Assistant Professor , PG and Research Department of Computer Science

PG and Research Department of Computer Science

KAAMADHENU ARTS AND SCIENCE COLLEGE

(Affiliated to Bharathiar University)

SATHYAMANGALAM-638 503
CERTIFICATE

This is to certify that the project report entitled, “ID CARD BARCODE READER”
submitted to the Bharathiar University in partial fulfillment of the requirements for the award of
the Degree of Bachelor of Science in Computer Science is a record of original project work
done by KEERTHANA.K.M (Reg. No: 2122K0295) during the period (2021- 2024) of her
study in the PG and Research Department of Computer Science at Kaamadhenu Arts and
Science College, Sathyamangalam under his supervision and guidance and that this project
report has not formed the basis for the award of any Degree / Diploma / Associate ship /
Fellowship or other similar title to any candidate of any University.

Head of the Department Signature of the Guide

Countersigned

Submitted for the viva – voce Examination held on

Internal Examiner External Examiner


DECLARATION

I am KEERTHANA.K.M Reg.no (2122K0295) hereby declare that the project report


entitled, “ID CARD BARCODE READER” submitted to the Bharathiar University in partial
fulfillment of the requirements for the award of the Degree of Bachelor of Science in Computer
Science is a record of original project work done by me during the period 2019-2022 under the
supervision and guidance of MS P.SRIDEVI BCA,MCA,M.Phil., Assistant Professor , PG
and Research Department of Computer Science, Kaamadhenu Arts And Science College,
Sathyamangalam and it has not formed the basis for the award of any Degree / Diploma /
Associate ship / Fellowship or other similar title to any candidate of any University.

Place: Sathyamangalam Signature of the Candidate

Date:
ACKNOWLEDGEMENT

The completion of this project was not just because of my ability but there are some well
wishers behind it. I am always thankful to them.

This project would not happen without the help of many people. I express my sincere
Thanks to our Chairman Thiru. R. PERUMALSAMY Avl., Kaamadhenu Arts and Science
College, Sathyamangalam for establishing my studies in this campus.

I would like to express gratitude to Secretary Ms.P.ARUNTHATHI,B.E.,M.S. and Join


Secretary Ms. P. MALARSELVI M.AM.Ed. Kaamadhenu Arts and Science College,
Sathyamangalam for updating us with the required information and had helped us in providing
all the necessities with appropriate assistance at the right time as and when needed.

I wish to record my deep sense of gratitude to our beloved Principal Dr


A.GURUMOORTHY, Kaamadhenu Arts and Science College, Sathyamangalam for his
inspiration which made me complete this project successfully.

I would like to acknowledge my gratitude to our beloved Head of the Department in


Computer Science DR R.RAJESH Diploma,B.Sc,MCA,M.Phil,Ph.D for her cheerful
encouragement and supporting me as a lot, with her valuable guidance and constructive
suggestions, this project has been completed within the stipulated time.

I would like to express my sincere thanks and gratitude to my project guide MS


P.SRIDEVI BCA,MCA,M.Phil Assistant Professor in PG and Research Department of
Computer Science, who have given me overwhelming support, kind cooperation and
encouragement throughout the project. Finally, I am also very much thankful to my parents and
friends who inspired us throughout.
CONTENTS

S.NO TITLE PAGE NO

I INTRODUCTION 2

1.1 ORGANIZATION PROFILE 1

1.2 SYSTEM SPECIFICATION 3

1.2.1 HARDWARE CONFIGURATION 3

1.2.2 SOFTWARE SPECIFICATION 3

II SYSTEM STUDY 12

2.1 EXISTING SYSTEM 12

2.1.1 DRAWBACKS 12

2.2 PROPOSED SYSTEM 13

2.2.1 FEATURES 13

III SYSTEM DESIGN AND DEVELOPMENT 14

3.1 FILE DESIGN 14

3.2 INPUT DESIGN 14

3.3 OUTPUT DESIGN 15

3.4 DATABASE DESIGN 15

3.5 SYSTEM DEVELOPMENT 16

3.5.1 DESCRIPTION OF MODULES 17

IV SYSTEM TESTING AND IMPLEMENTATION 19

V CONCLUSION 22

BIBLIOGRAPHY 23

APPENDICES 24

A.DATA FLOW DIAGRAM 24

B.TABLE STRUCTURE 25

C.SAMPLE CODING 27

D.SAMPLE INPUT 36

E.SAMPLE OUTPUT 43
SYNOPSIS

The "ID CARD BARCODE READER" project is aimed at improving card security and
information storage efficiency by implementing a barcode scanning system for ID cards. The
primary focus is on the efficient management of essential details, including personal information
and roll numbers, and the project is designed to accommodate both administrative and user
access.

1
1. INTRODUCTION

A barcode reader, also known as a barcode scanner, is an optical scanning device capable
of reading printed barcodes and decoding the data contained within the barcode on a
computer.The innovative ID card barcode scanner system is crafted to enhance card security and
optimize information management processes.

A crucial admin module is featured in the project, providing administrators with the
capability to effectively manage and maintain attendance records for students and staff. This
module allows attendance records to be stored, default lists to be generated, and the status of
individual students and staff members to be monitored. The inclusion of this administrative
functionality significantly contributes to the overall effectiveness of the project.

The primary goal of the project is to assist faculty in easily identifying defaulters, while
the attendance history of all students and staff can be conveniently accessed by users. The project
is developed using PHP and MySQL technologies, ensuring a robust and secure system for the
efficient management of student and staff information.

In summary, the "ID CARD BARCODE READER" project aims to enhance card
security, streamline information storage, and improve attendance management through the
implementation of a barcode scanning system, catering to both administrative and user needs.
The project utilizes PHP and MySQL technologies to ensure a reliable and secure system.

2
1.2 SYSTEM SPECIFICATION

A System Requirements Specification (SRS) (also known as a Software Requirements


Specification) is a document or set of documentation that describes the features and behavior of a
system or software application.

1.2.1 HARDWARE SPECIFICATION

● Processor : AMD PRO A4-4350B R4,5 COMPUTE CORES 2C+3G 2.50GHz

● Hard Disk : 500 GB

● RAM : 4 GB

● Monitor : 14’’ LED

1.2.2 SOFTWARE SPECIFICATION

● Operating System : Windows 10 Pro

● Front End : HTML and CSS,Java Script

● Back End : MYSQL

● Control End : PHP

PHP TOOL :

XAMPP Control Panel v3.30

3
SOFTWARE FEATURES

OVERVIEW OF OPERATING SYSTEM

Windows 10 Pro comes with built-in security features, including firewall and internet
protections to help safeguard against viruses, malware, and ransomware. Watch how Windows
10 Pro security features help her business. Find my device is a feature that can help you locate
your Windows 10 device if it's lost or stolen.

FEATURES OF WINDOWS 10 PRO

❖ Microsoft Edge web browser


❖ BitLocker encryption
❖ Remote Desktop Connection
❖ Domain connectivity
❖ Virtual Desktop
❖ Windows Information Protection (WIP)

4
LANGUAGE SPECIFICATION

HTML

HTML, or Hypertext Markup Language, forms the backbone of web development. It is a


markup language that structures content on the web and is essential for creating the basic
framework of a website.

The HTML (HyperText Markup Language) is the standard markup language for
documents designed to be displayed in a web browser. It can be assisted by technologies such as
Cascading Style Sheets (CSS) and scripting language local storage and render the documents
into multimedias such as JavaScript. Web browsers receive HTML documents from a web server
or from web pages. HTML describes the structure of a web page semantically and originally
included cues for the appearance of the document.

HTML ATTRIBUTES
Most of the attributes of an element are name-value pairs, separated by = and written
within the start tag of an element after the element's name. The value may be enclosed in single
or double quotes, although values consisting of certain characters can be left unquoted in HTML
(but not XHTML).

Leaving attribute values unquoted is considered unsafe.In contrast. with name-value pair
attributes. There are some attributes that affect the element simply by their presence in the start
tag of the element,like the ismap attribute for the img element.

● The language for an element should be specified with a lang attribute rather than
the XHTML xml:lang attribute. XHTML uses XML's built-in language-defining
functionality attribute.
● Remove the XML namespace (xmlns=URI). HTML has no facilities for
namespaces. *Change the document type declaration from XHTML 1.0 to HTML
4.01. (see DTD section for further explanation).

5
● If present, remove the XML declaration. (Typically this is: <?xml version="1.0"
encoding="utf-8"?>).

● Ensure that the document's MIME type is set to text/html. For both HTML and
XHTML, this comes from the HTTP Content-Type header sent by the server. *
Change the XML empty-element syntax to an HTML style empty element (<br />
to <br>).

● The href attribute of <a> specifies the URL of the page the link goes to.
● The src attribute of <img> specifies the path to the image to be displayed.
● The width and height attributes of <img> provide size information for images.

PRESENTATION RELATED ATTRIBUTES

● background (Deprecated. use CSS instead.) and bgcolor (Deprecated. use CSS
instead.) attributes for body (required element according to the W3C.) element. -
align (Deprecated. use CSS instead.) attribute on div, form, paragraph (p) and
heading (h1...h6) elements.

● align (Deprecated. use CSS instead.), noshade (Deprecated. use CSS instead.),
size (Deprecated. use CSS instead.) and width (Deprecated. use CSS instead.)
attributes on hr element.

● align (Deprecated. use CSS instead.), border, vspace and hspace attributes on img
and object (caution: the object element is only supported in Internet Explorer
(from the major browsers)) elements.

● align (Deprecated. use CSS instead.) attribute on legend and caption elements.

6
● alien (Depreent (use CSS instead) and bgcolor (Deprecated, wie CSS went on
table clement.
● nowrap (Obsolete), bgcolor (Deprecated, use CSS intend,), width, height on td
and th elements
● bgcolor (Deprecated, use CSS intend,) attribute on tr element.
● clear(Obsolete)attribute on br element.
● Compact attribute on dl, dir and menu elements
● type (Deprecated, use CSS instead,), compact (Deprecated, use CSS instead).

CSS

Cascading Style Sheets (CSS) is a style sheet language used for describing the
presentation of a document written in a markup language such as HIML,,1 CSS is a
commerstone technology of the World Wide Web, alongside HTML and JavaScript.2

CSS is designed to enable the separation of presentation and content, including layout,
colors, and fonts. This separation can improve content accessibility, provide more flexibility and
control in the specification of presentation characteristics, enable multiple web pages to share
formatting by specifying the relevant CSS in a separate .css file which reduces complexity and
repetition in the structural content as well as enabling the .css file to be cached to improve the
page load speed between the pages that share the file and its formatting.

SOFTWARE DESCRIPTION

PHP is the web development language written by and for web developers. PHP stands for
PHP: Hypertext Preprocessor. The product was originally named Personal Homepage Tools, and
many people still think that’s what the acronym stands for, but as it expanded in scope, a new
and more appropriate name was selected by community vote. PHP is currently in its sixth major
rewrite, called PHP6 or just plain PHP.

7
INTRODUCTION OF PHP

PHP stands for Hypertext Preprocessor and is a server-side programming language.


There are many reasons we use PHP for our web development, firstly it is a free language with
no licensing fees so the cost of using it is minimal Both PHP and MySQL are compatible with
an
Apache server which is also free to license.

PHP is a server-side scripting language, usually used to create web applications in


combination with a web server, such as Apache. PHP can also be used to create command-line
scripts akin to Perl or shell scripts, but such use is much less common than PHP’s uses of a web
language. Strictly speaking, PHP has nothing to do with layout, events, on-the-fly Document
Object Model (DOM) manipulation, or really anything about the look and feet of a web page. In
fact, most of what PHP does is invisible to the end user. Someone looking at a PHP page will not
necessarily be able to tell that it was not written purely in Hypertext Markup Language (HTML),
because the result of PHP is usually HTML.

Compared to many other programming languages, PHP makes it easy to develop


powerful web applications quickly (this is a blessing and a curse). Many of the most useful
specific functions (such as those for opening a connection to an Oracle database or fetching
email from an Internet Message Access Protocol [IMAP] server) are predefined.Most advanced
PHP users
(including most of the development team members) arc diehard hand coders.

PHP & MYSQL are also both stable in the sense of feature stability. Their respective
development teams have thus far enjoyed a clear vision of their project and refused to be
distracted by every new fad and ill-through-out user demand that comes along. Much of the
effort goes into incremental performance improvements, communicating with more major
database, or adding better OOP support.

8
PHP STRENGTHS
PHP has much strength, including the following:
➢ Performance
➢ Scalability
➢ Interfaces to many different database system
➢ Build-in libraries for many common web tasks
➢ Low cost
➢ Ease of learning and use
➢ Strong object oriented support
➢ Portability
➢ Flexibility of development approach
➢ Availability of source code

USES OF PHP

PHP is a general-purpose scripting language that is especially suited to server-side web


development, in which case PHP generally runs on a web server. Any PHP code in a requested
file is executed by the PHP runtime, usually to create dynamic web page content or dynamic
images used on websites or elsewhere.

FEATURES IN PHP

❖ Open Source (Only one file encrypted)


❖ Nice layout from start.
❖ Unlimited level of categories.
❖ Unique Extra Fields that are also sortable.
❖ Large user community.
❖ Regions Module is included (using Ajax).

9
INTRODUCTION TO MYSQL

MYSQL is an open source, SQL relational database management system (RDBMS) that
is free for many uses (more detail on that later). In its history, MYSQL occasionally faced
opposition because of its lack of support for some core SQL constructs such as sub selects and
foreign keys. Ultimately, however, MYSQL found a broad, enthusiastic user base for its liberal
licensing terms, perky performance, and ease of use. Its acceptance was aided in part by the wide
variety of other technologies such as PHP, Perl, Python, and the like that have encouraged its use
through stable, well-documented modules and extensions. Databases are generally useful,
perhaps the most consistently useful family of software products (the “killer product”) in modern
computing. Like many competing products , both free and commercial, MYSQL isn’t a database
until it gives it some structure and form.

MYSQL STRENGTHS
MYSQL bas much strength, including the following
➢ High performance
➢ Low cost
➢ Ease of configuring and learning
➢ Portability
➢ Availability of source code
➢ Availability of support

USES OF PHP AND MYSQL

When setting out to build a website and has different products


❖ Hardware for the web server
❖ An operating system
❖ A database management system
❖ A programming or scripting language

1
Some of these are dependent on the other, for example not aU operating system run on
all hardware not all web servers support all programming languages.

The majority of PHP code can be written to be portable between operating systems and
web servers; there are some PHP functions that specifically relate to the file system that are
operating system dependent.

1
2. SYSTEM STUDY

It involves studying a procedure or business in order to identify its goals and purposes
and create systems and procedures that will achieve them in an efficient way. Use cases are a
widely used systems analysis modeling tool for identifying and expressing the functional
requirements of a system.

2.1 EXISTING SYSTEM

The existing system for the ID CARD BARCODE READER may include traditional
methods of ID card verification and information retrieval that are not encompassed by the
sophisticated barcode scanning system proposed in the project. Manual checking of ID cards,
basic visual verification, or other non-automated processes might be student or staff in the
current system, which the new system aims to enhance or replace for more efficient and secure
ID card management.

2.1.1 DRAWBACKS

➢ Limited Adaptability to Diverse ID Card Formats:

■ The project might be affected by constraints arising from its limited


adaptability to diverse ID card formats, potentially introducing the risk of
compatibility issues across various card types.

➢ Resistance to the Introduction of the New Barcode Scanning System:

■ The introduction of the new barcode scanning system may be met with
resistance, potentially resulting in the hindrance of the smooth transition
from conventional methods to the automated processes proposed by the
project.

1
2.2 PROPOSED SYSTEM

The proposed system for the project is aimed at revolutionizing card security and
information storage through the implementation of an advanced barcode scanning system for id
cards. It is designed for both administrative and user access, ensuring ease of use for faculty and
staff in retrieving attendance history and related information.

2.2.1 FEATURES

➢ Barcode Scanning Capability:

■ Advanced barcode scanning technology is incorporated by the system for


efficient and secure identification.

➢ Real-time Monitoring:

■ Real-time monitoring is enabled, allowing administrators to track


attendance and identify defaulters promptly.

1
3. SYSTEM DESIGN AND DEVELOPMENT

The design of the system is essentially a blueprint or plan for a solution of the system to
be developed. A part of the system or subsystem of a whole of the system can itself be
considered a system with its own complements.

3.1 FILE DESIGN

The file design phase represents the concluding stage that signifies the final system and
process of the "ID CARD BARCODE READER." During this design phase, the database tables,
input screen design, and output design are meticulously formulated. The database tables are
crafted with all requisite fields in a compact manner, ensuring an efficient structure for data
storage and retrieval.

All input screens within the system are deliberately designed to be user-friendly and
easily comprehensible, with standardized sizes implemented for consistency. Icons fashioned for
this system are characterized by their brevity, compactness, and self-explanatory nature. These
icons are sharp, enabling the system to be invoked seamlessly by novice users.

The reports generated within this system offer minute details, aiding managers in making
crucial decisions. The importance of software design is encapsulated in a single word:
"QUALITY." Design serves as the pivotal space where quality is nurtured in software
development, representing the exclusive conduit through which requirements are accurately
transformed into finalized software products or systems.

3.2 INPUT DESIGN


Input design involves the conversion of user-oriented inputs into a computer-based
format within the "ID CARD BARCODE READER" system. In this process, the system takes
inputs from users, processes them, and generates relevant outputs. Input design serves as a
crucial link that connects the information system to the users' world. The system needs to be
user-friendly to effectively obtain pertinent information from users.

1
Forms for input design in this project are:
● Add details
● Viewing Users details
● Scan details

3.3 OUTPUT DESIGN


Output design in the "ID CARD BARCODE READER" system involves crafting results
and information for a multitude of end users. The primary purpose behind system development is
to generate outputs, forming the basis for evaluating the application's utility.

The objectives of the system take tangible form through its outputs, which can manifest
in diverse forms, encompassing reports, screen displays, printed forms, graphical elements, and
drawings. Fundamental requirements for outputs include accuracy, timeliness, and alignment
with the intended purpose, considering content, medium, and layout.

The reports given in this project are:


● Add report
● Viewing Users report
● Scan report

3.3 DATABASE DESIGN

A database management system comprises an interconnected data collection and a set of


programs for data access, commonly referred to as a database. The system's primary objective is
to establish an environment that facilitates both convenient and efficient retrieval and storage of
data information.

The term "database design" encompasses various facets, primarily and accurately
describing the logical design of the foundational data structures utilized for data storage. In the
relational model, these structures manifest as tables and views, while in an object database,
entities and relationships directly map to object classes and named relationships. However, the
scope of "database design" extends beyond base data structures to encompass the comprehensive
15

process of designing forms and queries integral to the overall database application within the
database management system.

The database design process involves a series of steps typically undertaken by the
database designer. These steps actively contribute to shaping the logical structure of the data,
ensuring efficiency, accuracy, and coherence in the overall functioning of the database system.

3.5 SYSTEM DEVELOPMENT

A software development project encompasses all activities from identifying potential


requirements to fully implementing and having the resulting system accepted by end users. This
process involves multiple stages over an extended period. The following section addresses
fundamental considerations, outlines key stages in developing and procuring new systems, and
specifies instances when and how auditors should be involved.

Today, an information system must not only meet current business needs but also be
flexible and capable of adapting to changing circumstances well into the future. Hence, a
prerequisite for introducing a new system is for management to identify and comprehend their
organization's mission and its associated information needs. Documenting this information helps
ensure a shared understanding and direction, providing a benchmark against which achievements
can be measured.

The initial step for the analyst is to comprehend the existing system by gathering
comprehensive information. This involves employing various methods such as studying current
procedures, observing the system's functioning, and conducting sampling and research to collect
the required data. These methods aid in acquiring a thorough understanding of the current
system's intricacies and nuances.
16

3.5.1 DESCRIPTION OF MODULES

It consists of the following modules and sub modules namely:

OFFICER MODULE

This module is responsible for storing and maintaining the details of both admin and user
information.

ADMIN MODULE

Within this module, the storage and management of student, staff, and scan details occur.

Add Details

This sub-module involves the creation of forms for inputting student and staff
information, allowing the storage of data such as Barcode ID, Name, Department, and Category
for each user.

Viewing Users Details

This sub-module serves the purpose of displaying the details of users.

USER MODULE

The primary function of this module is to showcase the scanning user details.

Scan Details

Within this sub-module, the ID is scanned to retrieve user details, including the scanned
barcode, user name, date and time, department, category, and whether the user is currently in or
out status.
17

REPORT MODULE

The report module generates the perfect format of reports which gives the details of users
and admin details.

Add Report

The report module is the form for the Student and Staff information . To store the
information like Barcode Id, Name, Department, Category for every user.

Viewing Users Report

The report module is used to display all the users details such as barcode
id,name,department and category and to be printed the details.

Scan Report

This report is used to retrieve the user's details such as scanned barcode ,user name ,date
and time,department , category and in or out status .

18
4. TESTING AND IMPLEMENTATION

SYSTEM TESTING

System testing is a critical element of software quality and represents the ultimate
reviews of specification, design, and coding. System testing verifies that an application performs
tasks as designed. During earlier definition and development phases, it was attempted to build
the software from an abstract concept to a tangible implementation. No system is error free
because it is so until the next error crops up during any phase of development or usage of the
product. A sincere effort however needs to be put to bring out a product that is satisfactory.

Testing objectives are:


● Testing is a process of executing a program with the intent of finding an error.

● A good test case is one that has a high probability of finding and as yet
undiscovered error.

● A successful test is one that uncovers a yet undiscovered error.

Testing demonstrates that software functions appear to be working according to


specifications. In addition, data collected as testing provides a good indication of software
reliability and some indication of software quality as a whole.

UNIT TESTING

Unit testing focuses verification efforts on the smallest unit of software design, the
module. This is also known as “Module Testing” The modules are tested separately this testing is
carried out during the programming stage itself. In this step each module is found to be working
satisfaction as regard to the expected output from the module.
19
INTEGRATION TESTING
Integration testing focuses on the design and construction of the software architecture.
Data can be lost across an interface, one module can have adverse effects on another sub
function and show on. Thus integration testing is a systematic technique for constructing tests to
uncover errors associated with the interface. In this project, all the modules are companies and
then the entire program is tested as a whole.

VALIDATION TESTING
Validation testing is the requirement established as a part of software requirement
analysis that is validated against the software that has been constructed. This test provides the
final assurance whether the software needs all functional, behavioral and performance
requirements.

Thus the proposed system under consideration has been tested by using validation testing
and found to be working satisfactory.

USER ACCEPTANCE TESTING

Acceptance testing involves planning and execution of function tests,performance tests,


stress tests and structure tests in order to demonstrate that the implemented system satisfies its
requirements. This system was tested unit wise and the user was satisfied with the modules of the
system.

2
SYSTEM IMPLEMENTATION

In implementing the ID Card Barcode Reader project, developers translate design


specifications into functional code, create logic for barcode scanning, user details storage, and
other necessary functionalities. They write code based on the specifications, integrating different
modules such as user management, scanning, and reporting to form a cohesive system. Training
sessions familiarize users with the system, and data migration ensures accurate transfer of
historical information. Testing activities, including unit testing and integration testing, allow
identification and rectification of any bugs. Developers create comprehensive documentation for
future reference. They collect end-user feedback for iterative improvements. Finally, they deploy
the fully implemented system in the live environment, ensuring its effectiveness and user
acceptance in real-world scenarios.
21

5. CONCLUSION

In conclusion, the pivotal phase of bringing the designed system to life in the ID Card
Barcode Reader project is the implementation phase. Essential functionalities see active
contributions from skilled programmers who engage in coding and logic creation, ensuring the
seamless integration of various modules. The success of the system is influenced by efficient
storage and retrieval of user information, user training, and meticulous testing. The system's
usability and maintenance are improved through comprehensive documentation and user
feedback. The culmination of this phase is marked by the deployment of the fully implemented
ID Card Barcode Reader system, highlighting its effectiveness, user acceptance, and seamless
functionality in real-world scenarios. A successful transition from design to a fully operational
and reliable system is underscored by the importance of continuous communication, testing, and
user engagement.

2
5.1 BIBLIOGRAPHY

Text Books

1. Elias M.Awad,”System analysis and design”.


2. Steve Suehring, Tim Converse and Joyce Park,”PHP6 and MYSQL bible”.
3. Somerville,”Software Engineering “,5th Editions.
4. Luke Welling and Laura Thomson,”PHP and MYSQL web Development -developer
Library”.
5. Robin Nixon,”Learning PHP,MYSQL & JavaScript: with jQuery,CSS & Html5”.

Website Refer

1.www.javapoint.com
2.www.W3Schools.com
2
APPENDICES

A.DATA FLOW DIAGRAM


2
B.TABLE STRUCTURE

Table Name : Login


Description : Used to login into the application
Primary Key : Username

Field Name Data Type Description


Username Varchar(100) Officer username
Password Varchar(100) Officer password

Table Name : Admin


Description : Used to admin login into the application
Primary Key : Username

Field Name Data Type Description


Username Varchar(100) Admin username
Password Varchar(100) Admin password
2
Table Name : User
Description : Used to store details of users
Primary Key : Barcode_id

Field Name Data Type Description


Barcode_id Varchar(100) User Barcode_id
Name Varchar(100) User Name
Department Varchar(100) User Department
Category Varchar(100) User Category
Date and Time Datetime Now()
Type Varchar(100) User In / Out
2
C.SAMPLE CODING

<?php
$host = "localhost";
$user = "root";
$password = '';
$db_name = "bar";

$con = mysqli_connect($host, $user, $password, $db_name);


if(mysqli_connect_errno()) {
die("Failed to connect with MySQL: ". mysqli_connect_error());
}
?>

<?php
include('connection.php');
$username = $_POST['user'];
$password = $_POST['pass'];

$username = stripcslashes($username);
$password = stripcslashes($password);
$username = mysqli_real_escape_string($con, $username);
$password = mysqli_real_escape_string($con, $password);

$sql = "select *from login where username = '$username' and password ='$password'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$count = mysqli_num_rows($result);
2
if($count == 1){
echo "<h1><center> Login successful </center></h1>";
header('location:home.html');
exit;
}
else{
echo "<h1> Login failed. Invalid username or password.</h1>";
}
?>

<html>
<head>
<title>Login system</title>
<link rel = "stylesheet" type = "text/css" href = "style.css">
<style>
body {
font-family: 'Arial', sans-serif;
background: #f2f2f2;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
#frm {
border: 1px solid #ccc;
border-radius: 5px;
background: #fff;
2
padding: 30px;
width: 300px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #333;
}

label {
display: block;
margin: 10px 0 5px;
color: #555;
}

input[type="text"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box;
}
input[type="submit"] {
width: 100%;
padding: 10px;
border: none;
background-color: #337ab7;
color: #fff;
2
cursor: pointer;
border-radius: 3px;
}

input[type="submit"]:hover {
background-color: #286090;
}
</style>
</head>
<body>
<div id = "frm">
<h1>Officer Login</h1>
<form name="f1" action = "authentication.php" onsubmit = "return validation()" method =
"POST">
<p>
<label> Officer Name: </label>
<input type = "text" id ="user" name = "user" />
</p>
<p>
<label> Password: </label>
<input type = "password" id ="pass" name = "pass" />
</p>
<p>
<input type = "submit" id = "btn" value = "Login" />
</p>
</form>
</div>
<script>
function validation()
{
3
var id=document.f1.user.value;
var ps=document.f1.pass.value;
if(id.length=="" && ps.length=="") {
alert("Officer Name and Password fields are
empty"); return false;
}
else
{
if(id.length=="") {
alert("Officer Name is empty");
return false;
}
if (ps.length=="") {
alert("Password field is empty");
return false;
}
}
}
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Id Card Barcode Scanner</title>
<scripttype="text/javascript"src="https://cdnjs.cloudflare.com/ajax/libs/quagga/0.12.1/quagga.mi
n.js"></script>
3
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<style>
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>

<div class="container">
<div class="row">
<div class="col-md-6">
<div id="scanner" class="col-6"></div>
</div>
<div class="col-md-6" style="background-color: blue;">
<label>Scanned Barcode</label>
<input type="text" id="scanned-barcode" class="form-control">
<label>Date and Time</label>
<input type="text" id="date-time" class="form-control">
<label>Name</label>
3
<input type="text" id="name" class="form-control">
<label>Department</label>
<input type="text" id="department" class="form-control">
<label>Category</label>
<input type="text" id="category" class="form-control">
</div>
</div>
</div>

<script>
Quagga.init({
inputStream: {
name: "Live",
type: "LiveStream",
target: document.querySelector('#scanner'),
constraints: {
width: 480,
height: 320,
facingMode: "environment"
}
},
decoder: { readers: ["code_128_reader", "ean_reader", "upc_reader", "code_39_reader",
"code_39_vin_reader", "codabar_reader", "i2of5_reader", "2of5_reader", "code_93_reader"]
}
}, function(err) {
if (err) {
console.error('Error initializing:', err);
return;
}
console.log('Barcode initialized successfully.');
3
Quagga.start();
});

Quagga.onDetected(function(result) {
var code = result.codeResult.code;
console.log('Barcode detected:', code);
var allowedPrefixes = ['211CS',
'221CS'];

if (allowedPrefixes.some(prefix => code.startsWith(prefix))) {


document.getElementById('scanned-barcode').value = code;
//Quagga.stop();
const now = new Date();
const currentDateTime =
now.toLocaleString();
console.log(currentDateTime);
document.getElementById('date-time').value = currentDateTime;

$.ajax({
url: 'retrievedata.php',
type: 'GET',
data: { barcode_id: code },
dataType: 'json',
success: function(data) {
console.log('Data from database:', data);
document.getElementById('name').value = data.name;
document.getElementById('department').value = data.department;
document.getElementById('category').value = data.category;
},
error: function(error) {
console.error('Error retrieving data:', error.responseText);
}
3
});
}
});
</script>
</body>
</html>

<?php
include('connection.php');
$barcode_id = $_GET['barcode_id'];
$conn = new mysqli($host, $user, $password, $db_name);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM user WHERE Barcode_id='$barcode_id'";

$result = $conn->query($sql);
if ($result) {
$data = $result->fetch_assoc();
header('Content-Type: application/json');
echo json_encode($data);
}
else {

echo json_encode(["error" => "Error executing the query"]);


}

$conn->close();
?>
3
D.SAMPLE INPUT

Officer Login Page


3
Officer Home Page
3
Admin Login Page
3
Admin Home Page
3
Add Users Details
4
Viewing Users Details
4
Barcode Scanner
4
E.SAMPLE OUTPUT

Officer Login Page


4
Officer Login Successful

4
Admin Login Page

4
Admin Login Page Successful

4
Add Users Details

4
Add Users Details

4
Barcode Scanning

You might also like