Library Management System
Library Management System
Ex.no:01
Date:06.02.2024 IDENTIFY A SOFTWARE SYSTEM THAT NEEDS TO BE DEVELOPED
AIM
To identify a software system that needs to be developed.
employee is very difficult. There are various problems also faced by the student in library such as
finding any particular book. Where Library Management System is library management software
for the purpose of monitoring and controlling the transactions in a library. This library management
system gives us the complete information about the library and the daily transactions done in a
Library. We need to maintain the record of new books and retrieve the details of books available in
the library which mainly focuses on basic operations in a library like adding new member, new
books, and searching up new information, searching books and members and facility to borrow and
return books. It features a familiar and well thought-out, an attractive user interface, combined with
strong searching, insertion and reporting capabilities. The report generation facility of library system
helps to get a good idea of which are the borrowed by the members, makes users possible to
generate hard copy. The following are the brief description on the functions achieved through this
project:
End-Users:
Librarian: To maintain and update the records and also to cater the needs of the users.
Reader: Need books to read and also places various requests to the librarian.
RESULT
Thus, the software system that need to be developed was identified successfully.
3
Ex.no:02
Date:08.02.2024 CREATION OF SOFTWARE REQUIREMENT SPECIFICATION
AIM
To Document the Software Requirements Specification (SRS) for Library Management System.
LIBRARY MANAGEMENT SYSTEM
PROBLEM STATEMENT
Manual process of keeping student records, book records, account details, managing
employee is very difficult. There are various problems also faced by the student in library such as
finding any particular book. Where Library Management System is library management software
for the purpose of monitoring and controlling the transactions in a library. This library management
system gives us the complete information about the library and the daily transactions done in a
Library. We need to maintain the record of new books and retrieve the details of books available in
the library which mainly focuses on basic operations in a library like adding new member, new
books, and searching up new information, searching books and members and facility to borrow and
return books. It features a familiar and well thought-out, an attractive user interface, combined with
strong searching, insertion and reporting capabilities. The report generation facility of library system
helps to get a good idea of which are the borrowed by the members, makes users possible to
generate hard copy. The following are the brief description on the functions achieved through this
project:
Functional Requirements:
Data Entry: The data entry requirements are concerned with how data is entered and
validated. The system shall allow a user to enter his/her data via a keyboard or choose an
item via a mouse. Whenever the "date" data is needed, it shall be entered only by choose date
from a online calendar. The system shall allow the user to enter the library card number and
ISBN both by typing or scanning. The system shall allow the user to enter book borrowing,
recalling data as frequently as required.
User Interface: The user interface requirements are concerned with the user interface and
how information is presented to the user.
Report Generation: The report generation requirements are concerned with the report
generation capabilities of the Library system. The system shall have a report feature that will
allow the user to generate a report showing the information of all the sign out book in a time
period which is the search criteria input by user. The information includes the number of
books, the time period and the information is grouped by book categories. The system shall
have a report feature that will allow the user to generate a report showing the information
4
about all the users who have overdue books and penalty. The system shall have a report
feature that will allow the user to generate a report showing the information of a particular
patron. The system shall have a report feature that will allow the user to generate a report
showing the information of book purchase information in a period including the book titles,
category, the author, the publisher, the price. It also shall give statistic data about the total
number of books purchased, the money paid by category. The system shall be generate those
reports to the display, a file or a printer which is linked to the system.
Alerts and Notifications: It keeps track of the borrowed books and sends notifications to the
user and librarian about the overdue books.
User Operations: The user can log in, view the catalog, search for books, checkout, reserve,
renew and return a book.
Librarian Operations:The librarian registers new users, adds and maintains the books,
collects fines for overdue books, and issues books to users who need them.
Non-Functional Requirements:
Usability Requirement: The system shall allow the users to access the system from the
Internet using HTML or it's derivative technologies like XML/CSS. The system uses a web
browser as an interface. Since all users are familiar with the general usage of browsers, no
special training is required. The system is user friendly and online help makes using the
system easy and also the product will support multiple languages such as Sinhala, Tamil and
English.
Availability Requirement:The system is available 100% for the user and is used 24 hrs a
day and 365 days a year. The system shall be operational 24 hours a day and 7 days a week.
Efficiency Requirement: Mean Time to Repair (MTTR) - Even if the system fails, the
system will be recovered back up within an hour or less.
Accuracy:The system should accurately provide real time information taking into
consideration. various concurrency issues. The system shall provide 100% access reliability.
Performance Requirement: The information is refreshed at regular intervals
depending upon whether some updates have occurred or not. The system shall respond to the
member in not less than two seconds from the time of the request submittal. The system shall
be allowed to take more time when doing large processing jobs.Responses to view
information shall take no longer than 5 seconds to appear on the screen.
5
Reliability Requirement:The system has to be 100% reliable due to the importance of data
and the damages that can because by incorrect or incomplete data. The system will run 7
days a week, 24 hours a day.
Maintainability and Portability Requirements:Changes (new patrons addition, password
changes, database changes) must be verified once per day at least. The system should
provide automatically notification to patrons by e-mail about item’s overdue, reservation
results, availability of reserved item and etc.
Software Requirements:
Hardware Requirements:
Processor: Intel core i3 or above for a stable experience and fast retrieval of data.
Hard Disk: 40GB and above
RAM: 256 MB or more, recommended 2 GB for fast reading and writing capabilities which
will result in better performance time
6
RESULT
The software requirement specification for Library Management was documented successfully
7
Ex.no:03
Date:13.02.2024 UML- USE CASE DIAGRAM
AIM
To identify Use Cases and develop the Use Case model for the identified requirements.
A given use case, (the extension) may extend another. This relationship indicates that
the behaviour of the extension use case may be inserted in the extended use case under some
conditions. This can be useful for dealing with special cases, or in accommodating new
requirements during system maintenance and extension.
3. Generalization
A generalization/ specialization relationship exists among use cases. A given use case may
be specialized form of an existing use case. The notation is a solid line ending in a hollow triangle
drawn from the specialized to the more general use case. This resembles the object-oriented concept
of sub-classing, in practice it can be both useful and effective to factor common behaviours,
constraints and assumptions to the general use case, describe them once, and deal same as except
details in the specialized cases.
PROCEDURE
1. Identify distinct actors and use cases.
2. The external actors are placed to the left of the use case and the internal actors to the right.
3. Select Model | Add Diagram | Use Case Diagram in Menu Bar or select Add Diagram | Use
Case Diagram in Context Menu in Star UML.
4. Name the diagram and draw the diagram using the symbols present in the Star UML toolbox
according to the identified actors and use cases.
5. Draw the relationship between the use cases and actors as extend, include and generalization
types using the symbols.
9
RESULT
Thus the use case diagram was drawn successfully using Star UML for the identified requirements.
13
Ex.no:04
Date:20.02.2024 UML-CLASS DIAGRAM
AIM
To identify conceptual classes and develop a domain model with UML Class diagram
CLASS DIAGRAM
In the Unified Modelling Language (UML), a class diagrams a collection of static modelling elements,
such as classes and their relationships, connected as a graph to each other and to their contents; their internal
structures, and their relationships to other classes.
A class is drawn as a rectangle with three components separated by horizontal lines. The top name
compartment holds the class name, other general properties of the class, such as attributes, are in the middle
compartment, and the bottom compartment holds a list of operations. Either or both the attribute and
operation compartments may be suppressed.
A separator line is not drawn for a missing compartment if a compartment is suppressed; no inference can be
drawn about the presence or absence of elements in it. The class name and other properties should be
displayed in up to three sections. A stylistic convention of UML is to use an italic font forabstract classes
and a normal (roman) font for concrete classes.
PROCEDURE
1. Identify the classes that are taking part in the diagram.
2. Select Model | Add Diagram | Class Diagram in the Menu Bar or select Add Diagram | Class
Diagram in Context Menu.
3. Select class diagram, specify the attributes, operations or methods, parameters, datatype by
selecting following.
1. Select Model | Add | Class in Menu Bar or Add | Classing Context Menu.
2. Select Model | Add | Attribute in Menu Bar or Add | Attribute in Context Menu.
3. Select Model | Add | Operation in Menu Bar or Add | Operation in Context Menu.
4. Select Model | Add | Parameter in Menu Bar or Add | Parameter in Context Menu.
5. Select Model | Add | Datatype in Menu Bar or Add | Datatype in Context Menu.
4. Create the class diagram for the project.
5. Explicitly denote the relation between classes by generalizations, associations, multiplicities and
cardinalities.
6. Save the file.
14
CLASS DIAGRAM
15
RESULT
Thus the class diagram is drawn successfully using starUML for the identified requirements.
16
Ex.no:05 a)
Date:27.02.2024 UML-SEQUENCE DIAGRAMS AND COLLABORATION DIAGRAMS
AIM
To draw sequence and collaboration diagrams for the identified scenarios and the interaction between
objects.
INTERACTION DIAGRAM
Sequence diagram describes the behaviour of the system by viewing the interaction between the
system and its environment. It represents the class at the top and their lifetime, their interactions as
relations.
SEQUENCE DIAGRAM:
PROCEDURE
5. The actors are separated by vertical dashed lines and sequence flow is indicated through arrows.
6. Select Model | Add Diagram | Sequence Diagram in Menu Bar or select Add Diagram | Sequence
Diagram in Context Menu in Star UML.
7. Create the sequence diagrams, showing the interaction between the objects.
SEQUENCE DIAGRAM 1:
18
SEQUENCE DIAGRAM 2:
19
COLLABORATION DIAGRAM 1:
20
RESULT
Thus the sequence and the collaboration diagrams for the identified scenarios and the interaction between
objects are drawn successfully for the requirements.
21
Ex.no:06 a)
Date:01.03.2024 UML-STATE CHART DIAGRAM
AIM
To draw the state chart diagram for the identified requirements
A State chart diagram describes a state machine. State machine can be defined as a machine which
defines different states of an object and these states are controlled by external or internal events. State chart
diagram is used to describe the states of different objects in its life cycle. So the emphasis is given on the
state changes upon some internal or external events. These states of objects are important to analyze and
implement them accurately. States can be identified as the condition of objects when a particular event
occurs.The state chart diagram shows the sequence of states that an object goes through during its life in
response to outside message. Set of values that describe an object at a specific point in time.A State chart
diagram describes a state machine. State machine can be defined as a machine which defines different states
of an object and these states are controlled by external or internal events. State chart diagram is used to
describe the states of different objects in its life cycle. So the emphasis is given on the state changes upon
some internal or external events. These states of objects are important to analyze and implement them
accurately. States can be identified as the condition of objects when a particular event occurs. The state chart
diagram shows the sequence of states that an object goes through during its life in response to outside
message. Set of values that describe an object at a specific point in time.
PROCEDURE
RESULT
Thus the state chart diagram is drawn for the identified requirements successfully for the requirements.
24
Ex.no:06 b)
Date:01.03.2024 UML-ACTIVITY DIAGRAM
AIM
To draw activity the diagram for the identified requirements.
ACTIVITY DIAGRAM
An activity diagram is a variation or special case of a state machine, in which the states are activities
representing the performance of operations and the transitions are triggered by the completion of the
operations. Unlike state diagrams that focus on the events occurring to a single object as it responds to
messages, an activity diagram can be used to model an entire business process. The purpose of an activity
diagram is to provide a view of flows and what is going on inside a use case or among several classes.An
activity is shown as a round box, containing the name of the operation. When an operation symbol appears
within an activity diagram or other state diagram, it indicates the execution of the operation. Executing a
particular step within the diagram represents a state within the execution of the overall method. It may be
applied to any purpose such as visualizing the steps of a computer algorithm, but is considered especially
useful for visualizing business workflows and processes, or use cases. Some of the outstanding notation
includes parallel activities, swim lanes, and action-object flow relationship. An activity diagram allows the
reader to see the system execution and how it changes direction based upon different conditions and stimuli.
PROCEDURE
1. Identify the activities, association, conditions and constraints.
2. Name the correct alternative types.
3. It is essential for the diagram to have a start and end points.
4. Select Model | Add Diagram | Activity Diagram in Menu Bar or select Add Diagram | Activity
Diagram in Context Menu in Star UML.
5. Select activity diagram and create activity diagram for requirements of project using the tools.
6. Save the file.
25
ACTIVITY DIAGRAM
26
RESULT
Thus the activity diagram is drawn successfully for the requirements.
27
Ex.no:07
Date:05.03.2024 & Implement the system as per the detailed design
19.03.2024
AIM
To implement the Library Management System with database connectivity
SOURCE CODE
Addadmin.php
<?php
require('dbconn.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta name="keywords" content="Library Member Login Form Widget Responsive, Login Form Web Template, Flat
Pricing Tables, Flat Drop-Downs, Sign-Up Web Templates, Flat Web Templates, Login Sign-up Responsive Web Template, Smartphone
Compatible Web Template, Free Web Designs for Nokia, Samsung, LG, Sony Ericsson, Motorola Web Design" />
</head>
<body>
<style>
body{
background-color: #808080;
</style>
28
<div class="container">
<div class="login">
<div class="send-button">
<a href="index.php">BACK</a>
</div>
<div class="send-button">
<!--<form>-->
</form>
</div>
<div class="clear"></div>
</div>
<div class="register">
<h2>Sign Up</h2>
<br>
<div class="send-button">
</form>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
<?php
29
if(isset($_POST['signup']))
$name=$_POST['Name'];
$email=$_POST['Email'];
$password=$_POST['Password'];
$mobno=$_POST['PhoneNumber'];
$rollno=$_POST['RollNo'];
$category=$_POST['Category'];
$type='Admin';
} else {
?>
</body>
</html>
Addbooks.php
<?php
require('dbconn.php');
?>
<?php
if ($_SESSION['RollNo']== 'admin') {
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>LMS</title>
rel='stylesheet'>
</head>
<body>
<div class="navbar-inner">
<div class="container">
<b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="divider"></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="wrapper">
<div class="container">
<div class="row">
<div class="span3">
<div class="sidebar">
</a></li>
31
</a></li>
</li>
</li>
</li>
</ul>
</ul>
</div>
<!--/.sidebar-->
</div>
<!--/.span3-->
<!--/.span9-->
<div class="span9">
<div class="content">
<div class="module">
<div class="module-head">
<h3>Add Book</h3>
</div>
<div class="module-body">
<br>
<div class="control-group">
<div class="controls">
<option value=""></option>
32
<option value="Reference">Reference</option>
<option value="Filipiniana">Filipiniana</option>
<option class="Periodical">Periodical</option>
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
<div class="control-group">
<div class="controls">
<option value=""></option>
<option value="GOOD">GOOD</option>
<option value="DAMAGE">DAMAGE</option>
<option value="DILAPIDATED">DILAPIDATED</option>
</select>
</div>
</div>
<div class="control-group">
<div class="controls">
</div>
</div>
</form>
</div>
</div>
</div><!--/.content-->
</div>
34
</div>
</div>
<!--/.container-->
</div>
<div class="footer">
<div class="container">
<b class="copyright">© 2022 LMS Login. King A. Albaracin&Mariabil V. Caga-anan</b>All rights reserved.
</div>
</div>
<!--/.wrapper-->
<?php
if(isset($_POST['submit']))
$Section = $_POST['Section'];
$Subject = $_POST['Subject'];
$book = $_POST['book'];
$Copyright = $_POST['Copyright'];
$Title = $_POST['Title'];
$availability = $_POST['availability'];
$Author = $_POST['Author'];
$ISBN = $_POST['ISBN'];
$status = $_POST['status'];
$sql1 = "INSERT INTO `book`( `Section`, `Subject`, `Textbook`, `Volume`, `Year`, `Availability`, `Author`, `ISBN`, `Status`) VALUES
('$Section','$Subject','$book','$Copyright','$Title','$availability','$Author','$ISBN','$status')";
$result=$conn->query($sql2);
$row=$result->fetch_assoc();
else
{//echo $conn->error;
35
?>
</body>
</html>
<?php }
else {
} ?>
qrcode.php
<?php
if (!class_exists('QRcode', false)) {
if (!function_exists('str_split')) {
do {
$c = strlen($string);
} else {
$parts = array($string);
return $parts;
$barcode_array = array();
return false;
$this->level = QR_ECLEVEL_L;
return false;
return false;
$this->items = array();
$this->encodeString($code);
$qrTab = $this->binarize($this->data);
$size = count($qrTab);
$barcode_array['num_rows'] = $size;
$barcode_array['num_cols'] = $size;
$barcode_array['bcode'] = array();
$arrAdd = array();
$arrAdd[] = ($char=='1')?1:0;
$barcode_array['bcode'][] = $arrAdd;
$this->barcode_array = $barcode_array;
$this->datacode = $this->getByteStream($this->items);
if (is_null($this->datacode)) {
return NULL;
$this->b1 = $this->rsBlockNum1($spec);
$this->dataLength = $this->rsDataLength($spec);
$this->eccLength = $this->rsEccLength($spec);
$this->blocks = $this->rsBlockNum($spec);
$ret = $this->init($spec);
if ($ret < 0) {
return NULL;
$this->count = 0;
$this->width = $this->getWidth($this->version);
37
$this->frame = $this->newFrame($this->version);
$this->x = $this->width - 1;
$this->y = $this->width - 1;
$this->dir = -1;
$this->bit = -1;
$code = $this->getCode();
$bit = 0x80;
$addr = $this->getNextPosition();
// remainder bits
$j = $this->getRemainder($this->version);
$addr = $this->getNextPosition();
$this->setFrameAt($addr, 0x02);
// masking
if ($mask < 0) {
if (QR_FIND_BEST_MASK) {
} else {
} else {
if ($masked == NULL) {
return NULL;
$this->data = $masked;
do {
38
if ($this->bit == -1) {
$this->bit = 0;
$x = $this->x;
$y = $this->y;
$w = $this->width;
if ($this->bit == 0) {
$x--;
$this->bit++;
} else {
$x++;
$y += $this->dir;
$this->bit--;
if ($this->dir< 0) {
if ($y < 0) {
$y = 0;
$x -= 2;
$this->dir = 1;
if ($x == 6) {
$x--;
$y = 9;
} else {
if ($y == $w) {
$y = $w - 1;
$x -= 2;
$this->dir = -1;
if ($x == 6) {
$x--;
$y -= 8;
return NULL;
}
39
$this->x = $x;
$this->y = $y;
// - - - - - - - - - - - - - - - - - - - - - - - - -
// QRrawcode
/**
* Initialize code.
*/
$dl = $this->rsDataCodes1($spec);
$el = $this->rsEccCodes1($spec);
$blockNo = 0;
$dataPos = 0;
$eccPos = 0;
$endfor = $this->rsBlockNum1($spec);
$this->rsblocks[$blockNo] = array();
$this->rsblocks[$blockNo]['dataLength'] = $dl;
$this->rsblocks[$blockNo]['eccLength'] = $el;
$this->rsblocks[$blockNo]['ecc'] = $ecc;
$dataPos += $dl;
$eccPos += $el;
$blockNo++;
if ($this->rsBlockNum2($spec) == 0) {
return 0;
}
40
$dl = $this->rsDataCodes2($spec);
$el = $this->rsEccCodes2($spec);
if ($rs == NULL) {
return -1;
$endfor = $this->rsBlockNum2($spec);
$this->rsblocks[$blockNo] = array();
$this->rsblocks[$blockNo]['dataLength'] = $dl;
$this->rsblocks[$blockNo]['eccLength'] = $el;
$this->rsblocks[$blockNo]['ecc'] = $ecc;
$dataPos += $dl;
$eccPos += $el;
$blockNo++;
return 0;
$row += $this->b1;
$ret = $this->rsblocks[$row]['data'][$col];
$ret = $this->rsblocks[$row]['ecc'][$col];
} else {
return 0;
$this->count++;
return $ret;
41
$blacks = 0;
if ($format & 1) {
$blacks += 2;
$v = 0x85;
} else {
$v = 0x84;
if ($i< 6) {
$frame[$i][8] = chr($v);
} else {
if ($format & 1) {
$blacks += 2;
$v = 0x85;
} else {
$v = 0x84;
if ($i == 0) {
$frame[8][7] = chr($v);
} else {
return $blacks;
}
42
$bitMask[$y][$x] = 0;
} else {
return $bitMask;
$b = 0;
$bitMask = array();
if ($maskGenOnly) {
return;
$d = $s;
if ($bitMask[$y][$x] == 1) {
}
43
return $b;
return $masked;
$demerit = 0;
if ($this->runLength[$i] >= 5) {
if ($i& 1) {
if (($this->runLength[$i-2] == $fact)
$demerit += N3;
$demerit += N3;
return $demerit;
$head = 0;
$demerit = 0;
44
$head = 0;
$this->runLength[0] = 1;
$frameY = $frame[$y];
if ($y > 0) {
$frameYM = $frame[$y-1];
$demerit += N2;
$this->runLength[0] = -1;
$head = 1;
$this->runLength[$head] = 1;
$head++;
$this->runLength[$head] = 1;
} else {
$this->runLength[$head]++;
$demerit += $this->calcN1N3($head+1);
$head = 0;
$this->runLength[0] = 1;
$this->runLength[0] = -1;
$head = 1;
$this->runLength[$head] = 1;
45
$head++;
$this->runLength[$head] = 1;
} else {
$this->runLength[$head]++;
$demerit += $this->calcN1N3($head+1);
return $demerit;
$minDemerit = PHP_INT_MAX;
$bestMaskNum = 0;
$bestMask = array();
unset($checked_masks[$remPos]);
$checked_masks = array_values($checked_masks);
$bestMask = $frame;
$demerit = 0;
$blacks = 0;
$minDemerit = $demerit;
$bestMask = $mask;
46
$bestMaskNum = $i;
return $bestMask;
if ($pos>= strlen($this->dataStr)) {
return QR_MODE_NL;
$c = $this->dataStr[$pos];
if ($this->isdigitat($this->dataStr, $pos)) {
return QR_MODE_NM;
return QR_MODE_AN;
if ($pos+1 <strlen($this->dataStr)) {
$d = $this->dataStr[$pos+1];
if (($word >= 0x8140 && $word <= 0x9ffc) OR ($word >= 0xe040 && $word <= 0xebbf)) {
return QR_MODE_KJ;
return QR_MODE_8B;
$p = 0;
while($this->isdigitat($this->dataStr, $p)) {
$p++;
$run = $p;
$mode = $this->identifyMode($p);
if ($mode == QR_MODE_8B) {
+ $this->estimateBitsMode8(1) // + 4 + l8
- $this->estimateBitsMode8($run + 1); // - 4 - l8
if ($dif> 0) {
return $this->eat8();
47
if ($mode == QR_MODE_AN) {
+ $this->estimateBitsModeAn(1) // + 4 + la
- $this->estimateBitsModeAn($run + 1);// - 4 - la
if ($dif> 0) {
return $this->eatAn();
return $run;
$p = 0;
while($this->isalnumat($this->dataStr, $p)) {
if ($this->isdigitat($this->dataStr, $p)) {
$q = $p;
while($this->isdigitat($this->dataStr, $q)) {
$q++;
$dif = $this->estimateBitsModeAn($p) // + 4 + la
- $this->estimateBitsModeAn($q); // - 4 - la
if ($dif< 0) {
break;
} else {
$p = $q;
} else {
$p++;
$run = $p;
if (!$this->isalnumat($this->dataStr, $p)) {
+ $this->estimateBitsMode8(1) // + 4 + l8
48
- $this->estimateBitsMode8($run + 1); // - 4 - l8
if ($dif> 0) {
return $this->eat8();
return $run;
$p = 0;
while($this->identifyMode($p) == QR_MODE_KJ) {
$p += 2;
return $run;
$p = 1;
$dataStrLen = strlen($this->dataStr);
$mode = $this->identifyMode($p);
if ($mode == QR_MODE_KJ) {
break;
if ($mode == QR_MODE_NM) {
$q = $p;
while($this->isdigitat($this->dataStr, $q)) {
$q++;
$dif = $this->estimateBitsMode8($p) // + 4 + l8
- $this->estimateBitsMode8($q); // - 4 - l8
if ($dif< 0) {
break;
} else {
$p = $q;
}
49
$q = $p;
while($this->isalnumat($this->dataStr, $q)) {
$q++;
$dif = $this->estimateBitsMode8($p) // + 4 + l8
- $this->estimateBitsMode8($q); // - 4 - l8
if ($dif< 0) {
break;
} else {
$p = $q;
} else {
$p++;
$run = $p;
return $run;
if ($this->dataStr == '') {
return 0;
$mode = $this->identifyMode(0);
switch ($mode) {
case QR_MODE_NM: {
$length = $this->eatNum();
break;
case QR_MODE_AN: {
$length = $this->eatAn();
break;
case QR_MODE_KJ: {
if ($hint == QR_MODE_KJ) {
$length = $this->eatKanji();
50
} else {
$length = $this->eat8();
break;
default: {
$length = $this->eat8();
break;
if ($length == 0) {
return 0;
if ($length < 0) {
return -1;
$stringLen = strlen($this->dataStr);
$p = 0;
if ($mode == QR_MODE_KJ) {
$p += 2;
} else {
$p++;
return $this->dataStr;
return NULL;
$inputitem = array();
$inputitem['mode'] = $mode;
$inputitem['size'] = $size;
$inputitem['data'] = $setData;
$inputitem['bstream'] = $bstream;
return $inputitem;
$inputitem['bstream'] = array();
$val = 0x1;
if ($inputitem['size'] - $words * 3 == 1) {
return $inputitem;
/**
* encodeModeAn
*/
$inputitem['bstream'] = array();
$val += (int)$this->lookAnTable(ord($inputitem['data'][$i*2+1]));
if ($inputitem['size'] & 1) {
return $inputitem;
/**
* encodeMode8
*/
$inputitem['bstream'] = array();
return $inputitem;
$inputitem['bstream'] = array();
if ($val<= 0x9ffc) {
$val -= 0x8140;
} else {
$val -= 0xc140;
$h = ($val>> 8) * 0xc0;
return $inputitem;
$inputitem['bstream'] = array();
return $inputitem;
$inputitem['bstream'] = array();
$inputitem['bstream'] = array();
} else {
switch($inputitem['mode']) {
case QR_MODE_NM: {
break;
case QR_MODE_AN: {
54
break;
case QR_MODE_8B: {
break;
case QR_MODE_KJ: {
break;
case QR_MODE_ST: {
$inputitem = $this->encodeModeStructure($inputitem);
break;
default: {
break;
return $inputitem;
return $items;
return -1;
return -1;
array_unshift($items, $entry);
return $items;
$parity = 0;
if ($item['mode'] != QR_MODE_ST) {
$parity ^= $item['data'][$i];
return $parity;
return false;
return true;
$w = (int)$size / 3;
$bits = $w * 10;
switch($size - $w * 3) {
case 1: {
$bits += 4;
break;
case 2: {
$bits += 7;
break;
default: {
break;
return $bits;
}
56
fals
if ($this->lookAnTable(ord($data[$i])) == -1) {
return false;
return true;
$w = (int)($size / 2);
$bits = $w * 11;
if ($size & 1) {
$bits += 6;
return $bits;
return $size * 8;
if ($size & 1) {
return false;
return false;
return true;
if ($size <= 0) {
return false;
}
57
switch($mode) {
case QR_MODE_NM: {
case QR_MODE_AN: {
case QR_MODE_KJ: {
case QR_MODE_8B: {
return true;
case QR_MODE_ST: {
return true;
default: {
break;
return false;
$bits = 0;
if ($version == 0) {
$version = 1;
switch($item['mode']) {
case QR_MODE_NM: {
$bits = $this->estimateBitsModeNum($item['size']);
break;
case QR_MODE_AN: {
$bits = $this->estimateBitsModeAn($item['size']);
break;
case QR_MODE_8B: {
$bits = $this->estimateBitsMode8($item['size']);
58
break;
case QR_MODE_KJ: {
$bits = $this->estimateBitsModeKanji($item['size']);
break;
case QR_MODE_ST: {
return STRUCTURE_HEADER_BITS;
default: {
return 0;
$l = $this->lengthIndicator($item['mode'], $version);
$m = 1 << $l;
return $bits;
$version = 0;
$prev = 0;
do {
$prev = $version;
if ($version < 0) {
return -1;
return $version;
switch($mode) {
case QR_MODE_NM: {
$size = $chunks * 3;
if ($remain >= 7) {
$size += 2;
$size += 1;
break;
case QR_MODE_AN: {
$size = $chunks * 2;
if ($remain >= 6) {
++$size;
break;
case QR_MODE_8B: {
break;
case QR_MODE_KJ: {
break;
case QR_MODE_ST: {
break;
default: {
$size = 0;
break;
if ($size < 0) {
$size = 0;
$size = $maxsize;
return $size;
$total = 0;
$bits = count($items[$key]['bstream']);
$total += $bits;
$ver = $this->estimateVersion($items);
if ($ver> $this->version) {
$this->version = $ver;
for (;;) {
$cbs = $this->createBitStream($items);
$items = $cbs[0];
$bits = $cbs[1];
if ($bits < 0) {
return -1;
if ($ver< 0) {
return -1;
$this->version = $ver;
} else {
break;
return $items;
$bits = count($bstream);
$maxbits = $maxwords * 8;
if ($maxbits == $bits) {
return 0;
$bits += 4;
$padding = array();
if ($padlen> 0) {
$padbuf = array();
$padbuf[$i] = ($i&1)?0x11:0xec;
$items = $this->convertData($items);
$bstream = array();
return $bstream;
$bstream = $this->mergeBitStream($items);
return $this->appendPaddingBit($bstream);
$bstream = $this->getBitStream($items);
return $this->bitstreamToByte($bstream);
$bstream = $this->allocate($bits);
if ($num& $mask) {
$bstream[$i] = 1;
} else {
$bstream[$i] = 0;
return $bstream;
$p=0;
$mask = 0x80;
$bstream[$p] = 1;
} else {
$bstream[$p] = 0;
$p++;
return $bstream;
return $bitstream;
if (count($bitstream) == 0) {
return $append;
if ($bits == 0) {
return 0;
$b = $this->newFromNum($bits, $num);
if ($size == 0) {
return 0;
$b = $this->newFromBytes($size, $data);
$size = count($bstream);
if ($size == 0) {
return array();
$p = 0;
$v = 0;
$v = $v <<1;
$v |= $bstream[$p];
$p++;
$data[$i] = $v;
if ($size & 7) {
$v = 0;
$v = $v <<1;
$v |= $bstream[$p];
$p++;
}
64
$data[$bytes] = $v;
return $data;
return $srctab;
return $this->capacity[$version][QRCAP_EC][$level];
return $this->capacity[$version][QRCAP_WIDTH];
return $this->capacity[$version][QRCAP_REMINDER];
return $i;
return -1;
if ($mode == QR_MODE_ST) {
return 0;
if ($version <= 9) {
$l = 0;
$l = 1;
} else {
$l = 2;
65
return $this->lengthTableBits[$mode][$l];
if ($mode == QR_MODE_ST) {
return 3;
if ($version <= 9) {
$l = 0;
$l = 1;
} else {
$l = 2;
$bits = $this->lengthTableBits[$mode][$l];
if ($mode == QR_MODE_KJ) {
return $words;
if (count($spec) < 5) {
$b1 = $this->eccTable[$version][$level][0];
$b2 = $this->eccTable[$version][$level][1];
if ($b2 == 0) {
$spec[0] = $b1;
$spec[3] = 0;
$spec[4] = 0;
} else {
$spec[0] = $b1;
$spec[3] = $b2;
$spec[4] = $spec[1] + 1;
return $spec;
$finder = array(
"\xa1\xa1\xa1\xa1\xa1",
"\xa1\xa0\xa0\xa0\xa1",
"\xa1\xa0\xa1\xa0\xa1",
"\xa1\xa0\xa0\xa0\xa1",
"\xa1\xa1\xa1\xa1\xa1"
);
$yStart = $oy - 2;
$xStart = $ox - 2;
return $frame;
if ($version < 2) {
return $frame;
$d = $this->alignmentPattern[$version][1] - $this->alignmentPattern[$version][0];
if ($d < 0) {
$w = 2;
} else {
if ($w * $w - 3 == 1) {
$x = $this->alignmentPattern[$version][0];
$y = $this->alignmentPattern[$version][0];
return $frame;
$cx = $this->alignmentPattern[$version][0];
$wo = $w - 1;
$cx += $d;
$cy = $this->alignmentPattern[$version][0];
$cx = $this->alignmentPattern[$version][0];
$cx += $d;
$cy += $d;
return $frame;
return 0;
return 0;
return 0;
return $this->formatInfo[$level][$mask];
$finder = array(
"\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
"\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
"\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
"\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
"\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
"\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
"\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
68
);
return $frame;
$width = $this->capacity[$version][QRCAP_WIDTH];
// Finder pattern
// Separator
$yOffset = $width - 7;
$frame[$y][7] = "\xc0";
$frame[$y][$width - 8] = "\xc0";
$frame[$yOffset][7] = "\xc0";
++$yOffset;
// Format info
$yOffset = $width - 8;
$frame[$y][8] = "\x84";
$frame[$yOffset][8] = "\x84";
// Timing pattern
// Alignment pattern
// Version information
if ($version >= 7) {
$vinf = $this->getVersionPattern($version);
$v = $vinf;
$v = $v >>1;
$v = $vinf;
$v = $v >>1;
return $frame;
return NULL;
if (!isset($this->frames[$version])) {
$this->frames[$version] = $this->createFrame($version);
if (is_null($this->frames[$version])) {
return NULL;
return $this->frames[$version];
return $spec[0];
return $spec[1];
return $spec[2];
return $spec[3];
return $spec[4];
return $spec[2];
continue;
return $rs;
array_unshift($this->rsitems, $rs);
return $rs;
$x -= $rs['nn'];
return $rs;
return $rs;
return $rs;
return $rs;
return $rs;
$rs = array();
$rs['mm'] = $symsize;
$rs['pad'] = $pad;
$rs['alpha_to'][$A0] = 0; // alpha**-inf = 0
$sr = 1;
$rs['index_of'][$sr] = $i;
$rs['alpha_to'][$i] = $sr;
$sr<<= 1;
$sr ^= $gfpoly;
$sr&= $rs['nn'];
72
if ($sr != 1) {
return NULL;
$rs['fcr'] = $fcr;
$rs['prim'] = $prim;
$rs['nroots'] = $nroots;
$rs['gfpoly'] = $gfpoly;
$rs['genpoly'][0] = 1;
$rs['genpoly'][$i+1] = 1;
if ($rs['genpoly'][$j] != 0) {
} else {
$rs['genpoly'][$j] = $rs['genpoly'][$j-1];
$rs['genpoly'][$i] = $rs['index_of'][$rs['genpoly'][$i]];
return $rs;
$ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in
index (log) form to polynomial form
$INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in
polynomial form to index (log) form
$GENPOLY =& $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index
form
$NROOTS =& $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the
number of parity symbols in a block
if ($feedback != $A0) {
// Shift
array_shift($parity);
if ($feedback != $A0) {
} else {
array_push($parity, 0);
return $parity;
} // END OF "class_existsQRcode"
74
?>
OUTPUT
Login Page
Admin Site
75
Librarian Site
Attendance site
77
Generate ID card
QR code generator
AddBooks
78
Viewbook
79
RESULT
Thus the Library Management System with database connectivity was implemented successfully.
80
Ex.no:08 TEST THE SOFTWARE SYSTEM FOR ALL THE SCENARIOS IDENTIFIED
Date:02.04.2024 AS PER THE USE CASE DIAGRAM
AIM
To test the software system for all the scenarios as per the use case diagram
TESTING:
Black box testing is a testing technique in which the internal workings of the software are not
known to the tester. The tester only focuses on the input and output of the software.
Decision Table Testing is a Black Box test design technique (behavioral or behavior-based
technique), used where different combinations of test input conditions result in different
outcomes. When a system has complex business rules, then the decision table testing technique
helps in identifying the correct test cases.
White box testing, also known as clear box testing, glass box testing, or structural testing, is a software
testing technique that evaluates the internal workings of an application, system, or component. Unlike black
box testing, where testers are primarily concerned with the external behavior of the software, white box
testing examines the internal structures, code paths, and implementation details of the software.
81
def is_book_available(book_id):
if book_id in library_books:
if library_books[book_id]['status'] == 'available':
return True
else:
return False
else:return False
id_number = "12345"
id_card = generate_id_card(name, id_number)
print(id_card)
Scenario:
Total Number of Statements =6
Number of Executed Statements=6
Formula:
Statement Coverage = (Total Executable Statements/Number of Executed Statements)*100%
=(6/6)*100%
=100%
The statement coverage for this scenario is 100%.
83
Result:
Thus, as per the use case diagram, the software system for all the scenarios was tested using black box and
white box testing techniques
84
AIM
To Improve the reusability and maintainability of the software system by applying appropriate design
patterns and test it for various scenarios.
DESIGN PATTERN
Design patterns are communicating objects and classes that are customized to solve a general design
problem in a particular context. Software design patterns are general, reusable solutions to common
problems that arise during the design and development of software. They represent best practices for solving
certain types of problems and provide a way for developers to communicate about effective design solutions.
RESULT
Thus, the reusability and maintainability of the software system were improved by applying
appropriate design patterns and tested for various scenarios.
86
Ex.no:11
AIM
A Data Flow Diagram (DFD) is a graphical representation of the flow of data within a system.
It's a modeling technique used in software engineering to visualize how data moves through
various processes or modules in a system. DFDs are particularly useful for understanding the
data flow and transformations that occur within a system without getting into the finer details of
implementation.
within the system. Each process takes input data, performs some operation, and produces output
data.
Data Flows: Represented by arrows, data flows indicate the movement of data between
processes, data stores, and external entities. They show the direction in which data is flowing.
Data Stores: Represented by open-ended rectangles, data stores depict where data is stored
within the system. They can represent databases, files, or any other storage mechanism.
data that exist outside the system being modeled. These could be users, other systems, or
PROCEDURE:
Identify Classes: Review the DFD to identify processes, data stores, and external entities that
Create Classes: Use modeling software to add classes to the Class Diagram.
Specify Details: Add attributes, operations, parameters, and data types to each class.
Save: Save the Class Diagram file for future reference and collaboration.
1.Level 0 DFD
88
2. Level 1 DFD
RESULT
Thus the data flow diagram for identified requirements was drawn successfully.