Attendance Report Generator
Attendance Report Generator
By
Name MOHAMED ABDULLA.J
Register Number P 22270819
Guided by
Mrs. S.DEVI, M.Sc., M.Phil.,
TIRUVARUR.
the original work done under my guidance during the academic year
2023-2024.
By
Computer Science, Thiru. Vi. Ka. Govt. Arts College, Tiruvarur for her
successfully.
Tiruvarur for her valuable suggestions for carrying out of this project
B.Ed., SLET., Ph.D., Principal, Thiru. Vi. Ka. Govt. Arts College,
project.
Attendance report generator using PHP, MySQL project is a web based application
that deals with the maintenance of attendance details and generates reports for staff and
students. It is for maintaining daily basis of attendance details for students and generates the
monthly report based on the student presence of daily attendances and also maintaining
hourly basis of attendance details for staff and generates the weekly report based on the staff
Staff is required to create account and then gets approved and assigned class by
admin. Staff can be added their students and make the attendance of students properly. Staff
can be view the monthly report details for students based on their presence of class.
Admin can view the weekly reports details for staff based on their presence of the
classes. Admin can view each of the student monthly report and their class performance.
This system provides reduce man power and paper works. Also this provides a transparency
in the system, so that each student can view absented count and their monthly attendance
report.
CONTENTS
1 INTRODUCTION 1
2 PROJECT DESCRIPTION 2
3 SYSTEM CONFIGURATION 4
4 SOFTWARE DESCRIPTION 5
5 SYSTEM DESIGN 45
6 SYSTEM TESTING 56
7 OUTPUT SCREENS 60
8 SOURCE CODE 67
9
CONCLUSION 77
10 BIBLIOGRAPHY 78
1. INTRODUCTION
Attendance report generator is developed for the exclusively for the purpose of
applications. It consumes lots of time and paper. But this system totally web based, it
means that staff can enter students details into the system very easily. They can view the
details of the class this system is totally user friendly and time saving and cost effective
system. Enhances security report generation is made easy and efficient. Reduce the paper
work.
manage the attendance of students and staff/faculty generates report separately. These
tools can be software to monitor attendance details. Admin panel, student panel, and
The user has to log in as staff/faculty or admin. From Lecturer‘s login, the user
can view and add Students, units, courses, and maintain daily Attendance records easily.
From Admin‘s login, the user has access to each and everything in the system. Admin
can also View & Add Students, maintain Attendance record and can have an overview
of the records to view total attendance to date, total students, classes, teachers, etc. Also
this provides a transparency in the system so that each student can view absented count
1
2. PROJECT DESCRIPTION
EXISTING SYSTEM
institutions, if the staff need to give attendance to the students, they are supposed to need
lot of man power and time consuming. After attendance for students, they needs to create
the attendance report. Over all process of existing system contain time consuming and
Time consuming
PROPOSED SYSTEM
In the proposed system of attendance report generator, the registered staff can
simply create students details anywhere and anytime providing the required details in the
college. The students report thus generated is sent to the admin. This saves a lot of time
and effort. The admin can access the student reports and staff reports delivered to them
anywhere and anytime. Also the members of students can view their attendance without
2
Security of data
Enhances security
FEASIBILITY STUDY
precede the development of the project or stop by conducting study on four primary
areas such as
Economic feasibility
Technical feasibility
Legal feasibility
Alternatives
Be easy to operate
Be expandable
3
3. SYSTEM CONFIGURATION
Before starting to design software I have to decide about the system environment
Hardware specification
Software specification
HARDWARE SPECIFICATION
RAM : 4 GB
Hard Disk : 50 GB
SOFTWARE SPECIFICATION
Software : XAMPP
4
4. SOFTWARE DESCRIPTION
PHP is a server-side scripting language designed specifically for the web. Within
an HTML page, I can embed PHP code that will be executed each time the page is
visited. my PHP code is interpreted at the web server and generates HTML or other
output that the visitor will see. PHP is an open-source project, which means I have access
to the source code and have the freedom to use, alter, and redistribute it.
server, the result of the interpreted and execute PHP code which may be any type of data,
such as generated HTML or binary image data -would form the whole or part of an
HTTP response. Various web template systems, web content management systems, and
web frameworks exist which can be employed to orchestrate or facilitate the generation
of that response. Additionally, PHP can be used for many programming tasks outside of
the web context, such as standalone graphical applications and robotic drone control.
Arbitrary PHP code can also be interpreted and executed via command-line
interface(CLI).
The standard PHP interpreter, powered by the Zend Engine, is free software
released under the PHP License. PHP has been widely ported and can be deployed on
most web servers on almost every operating system and platform, free of charge.
until 2014, with the original implementation acting as the de facto standard which other
implementations aimed to follow. Since 2014, work has gone on to create a formal PHP
specification.
5
Addition of the match expression
Main article: PHP syntax and semantics Match. PHP 8 introduced the statement
and is more compact for some cases. Because match is an expression, its result can be
PHP 8 introduced union types, a new static return type, and a new mixed type.
added in PHP 8, which allow metadata to be added to classes. throw was changed from
Weak maps were added in PHP 8. A Weak Map holds references to objects, but
these references do not prevent such objects from being garbage collected. This
Various adjustments to interfaces, such as adding support for creating Data Time
objects from interfaces, and the addition of a String able interface that can be
6
Additional changes
Type‘s annotations were also added into PHP's C source code itself to allow
Some of PHP's main competitors are Python, Ruby (on Rails or otherwise),
Node.js, Perl, Microsoft .NET, and Java. In comparison to these products, PHP has
Performance
Scalability
Low cost
Portability
Performance
PHP is very fast. Using a single inexpensive server, I can server millions of hits per
day. It scales down to the smallest email form and up to sites such as Facebook and Easy.
7
Scalability
architecture. This means that I can effectively and cheaply implement horizontal scaling
Database Integration
MySQL, I can directly connect to PostgreSQL, Oracle, MongoDB, and MSSQL, among
others. PHP 5 and PHP 8 also have a built-in SQL interface to flat files, called SQLite.
Using the Open Database Connectivity (ODBC) standard, I can connect to any database
that provides an ODBC driver. This includes Microsoft products and many others. In
layer called PHP Database Objects (PDOs), which allows consistent access and
Built-in Libraries
Because PHP was designed for use on the Web, it has many built-in functions for
performing many useful web-related tasks. I can generate images on the fly, connect to
web services and other network services, parse XML, send email, work with cookies,
and generate PDF documents, all with just a few lines a code.
Cost
PHP is free. I can download the latest version at any time from
8
Ease of learning PHP
Perl. If I already know C or Perl, or a C-like language such as C++ or Java, I will be
Object-Oriented Support
refined and improve in PHP version 8. If I learned to program in Java or C++, I will find
the features (and generally the syntax) that I expect, such as inheritance, private and
protected attributes.
Portability
PHP is available for many different operating systems. I can write PHP code of
free UNIX-like operating systems such as Linux and FreeBSD, commercial UNIX
PHP allows I am implement simple tasks simply, and equally easily adapts to
Model-View-Controller (MVC).
Source code
I have access to PHP's source code. With PHP, unlike commercial, closed-
source products, if I want to modify something or add to the language, I am free to do so.
9
I do not need to wait for the manufacturer to release patches. I also don't need to worry
about the manufacturer going out of business or deciding to stop supporting a product.
"http://www.zend.com/"com), the company behind the engine that powers PHP, funds its
PHP development by offering support and related software on a commercial basis. The
PHP documentation and community are mature and rich resources with a wealth of
information to share.
borrowed from java and Perl with a couple of unique PHP-specific features thrown in.th
goal of the language is to allow web developers to write dynamically generated pages
quickly". When someone visits my PHP web pages, my web server processes the PHP
code. It then sees which parts it needs to show to visitors (content and pictures) and hides
the other stuff (file operations, math calculation, etc.) This translates my PHP into
HTML. After the translation into HTML, it senses the web page to my visitor's web
browser.
It is also helpful to think of PHP in terms of what it can do for you. PHP will
Create a customized user experience for visitors based on information that I have
Open up thousands of possibilities for online tools. Check out PHP HOT
SCRIPTS for examples of the great things that are possible with PHP.
10
Allow creation of shopping carts for e-commerce websites. Before starting this
following:
Basic programming experience it will make learning PHP a great deal easier.
PHP-Syntax
Before I talk about PHP's syntax, let as first define Syntax is referring to.
SYNTAX-the rules that must be followed to write properly structured code. PHP's
syntax and semantics or similar to most other programming languages (C, java and Perl)
with the addition that all PHP code is contained with tag, of sorts. All PHP code must be
PHP Code
<?php
?>
The shorthand PHP that requires shorthand support to be enabled
On I server...
<?
?>
If I am writing PHP script and plan on distributing them, I suggest that I use the
standard form (which includes the PHP) rather than the shorthand form. This will
ensure that my script will work, even when running on other servers with different
settings.
correctly, then I must save the file with.PHP extension, instead of the standard.Html
11
extension. So be sure to check that I am saving my files correctly. Instead of index,
Before is an example of one of the easiest PHP and HTML page that I can create
<Html>
<Head>
<Title>my first PHP pages</title>
</head>
<Body>
<? Php
</Html>
If I save this file and place in on PHP enable server and load it up in my web
browser then I should see" Hello world!" and I will be talking in greater depth about this
The Semicolon
As I may or may not have noticed in the above example there was a semicolon
after the line of PHP code. The semicolon signifies the end of a PHP statement and
should never be forgotten. For example, if I repeated our "Hello World!" code several
12
White space
OK to have one line of PHP code, then 20 lines of blank space before the line of PHP. I
can also press tab to indent my code and the PHP interpreter will ignore this space as
well.
PHP-variable
If I never had any programming Algebra or scripting experience, then the concept
beyond the scope of this tutorial, but I have included a refresher crash course to guide
you.
A variable is a means of storing a value such as text string "Hello world!" or the
integer value 4. A variable can then be reused throughout my code, instead of having to
type out the actual value over and over again. In PHP I define a variable with the
following form:
If I forget the dollar sign at the beginning, it will not work. This is a common
mistake for new PHP programmers. Variables are prefixed with a dollar symbol, and a
type does not need to be specified in advance, PHP introduced type hinting that allows
callback functions. However, before PHP, type hints could not be used with scalar types
13
A Quick Variable Example
We wanted to store the values that I talked about in the above paragraph. How
would I go about doing this? I would first want to make a variable name and then set that
equal to the value I want. See our example below for the correct way to this.
PHP Code
<?php
$hello="Hello world"
$a number 4;
$another number-8;
?>
Note for programmers: PHP does not require variable to be declared before being
initialized.
PHP-echo
As I saw in the previous lesson, the PHP function echo is a means of outputting
test to the web browser. Throughout my PHP career I will be using the echo function
Outputting a String
To output a string, like I have done in previous lesson, use the PHP echo
function. I can place either a string variable or I can use quotes, like I do below. To
14
PHP Code
<?php
$my String="Hello!"
echo $my String; ?>
In the above example I output "Hello" without a hitch. The text I am outputting is
being sent to the user in the form of web page, so it is important that I use proper HTML
syntax.
In our second echo statement I use echo to write a valid header 5 HTML
statement. To do this the simply put the <h5> at the beginning of the string and closed it
at the end of the string. Just because I am using PHP to make web pages does not
PHP Code
<?php
escape the quotations by placing a slash in front of it(\‖). The slash will tell PHP that I
want the quotations to be used within the string and NOT to be used to end echo‘s string.
15
Echoing variables
Echoing variable is very easy. The PHP developers put in some extra work to
make the common task of echoing all variables nearly fool proof! No quotations are
required, even if the variable does not hold string. Below is the correct form for echoing
variables.
PHP-String
In the last lesson, PHP echo, I used string a bit, but did not talk about them in the
depth. Though out my PHP career I will be using strings a great deal, so it is important to
Before I can used a string I have to create it! A string can be used directly in
function or it can be stored in a variable. Below I create the exact same string twice: first
storing it into a variable and in the second case I place the string directly into a function.
PHP Code
While the second string will be used in the echo function and not is stored. Remember to
save my strings into variables if I plan on using them more than once! Below is the
output from our example code. They look identical just as I thought.
Thus far I have created strings using double-quotes, but it is just as correct to
16
PHP-String Creation Double-Quotes
We have used double-quotes and will continue them as the primary method for
forming strings. Double quotes allow for many special escaped characters to be used
that I cannot do with a single-quotes string. Once again, a backslash is used to escape
character.
PHP Code
These escaped characters are not very useful for outputting a web page because
HTML ignores extra white space. A tab, newline, and carriage return are all examples of
The two methods above are the traditional way to create strings in most
programming languages. PHP introduced more robust string creation tool called heredoc
that lets the programmer create multi- line strings without using quotations. However,
creating a string using heredoc is more difficult can lead to problem if I do not properly
17
There are a few very important things to remember when using heredoc.
Use <<< and some identifier that I choose to begin the heredoc. In this example I
Repeat the identifier followed by semicolon to end the heredoc string creation. In
The closing sequence TEST; must occur on a line by itself and cannot be
indicated!
Another thing to note is that when I output this multi-line string to web page, it
will not span multiple lines because I did not have any <br> tags contained inside
out string! Here is the output made from the code above.
DATA TYPES
signed integer equivalent to the C-language long type. Unsigned integers are converted
programming languages. Integer variables can be assigned using decimal (positive and
Floating point numbers are also stored in a platform-specific range. They can be
specified using floating point notation, or two forms of scientific notation. PHP has a
native Boolean type that is similar to the native Boolean types in Java and C++. Using
the Boolean type conversion rules, non-zero values are interpreted as true and zero as
sources. These are typically created by functions from a particular extension, and can
18
only be processed by functions from the same extension; example include file, image,
Arrays can contain elements of any type that PHP can handle, including
resources, objects, and even other arrays. Order is preserved in lists of values and in
hashes with both keys and values, and the two can be intermingled. PHP also supports
strings, which can be used with single quotes, double quotes, nowdoc or heredoc syntax.
Here are the most important things to know about variables in PHP
All variables in PHP are denoted with a leading dollar sign ($).
Variables are assigned with the = operator, with the variable on the left-hand side
PHP does a good job of automatically converting types from one to another when
necessary.
PHP variables are Perl-like. PHP has a total of eight data types which I use to
NULL: is a special type that only has one value: NULL • Strings: are sequences
both other kinds of values and function that are specific to the class.
Resources: are special variables that hold references to resources external to PHP
convention, constant identifiers are always uppercase. A constant name starts with a
constant I have to use define() function and to retrieve the value of a constant, I have to
simply specifying its name. Unlike with variables, I do not need to have a
constant with a $. I can also use the function constant() to read a constant‘s value if I
FUNCTIONS
PHP defines a large array of functions in the core language and many are also
available in various extensions; these functions are well documented in the online PHP
documentation. However, the built-in library has a wide variety of naming conventions
20
Custom functions may be defined by the developer:
// calculate the age by subtracting the birth year from the current year.
$yearsOld date(‗Y‘) - $birthYear;
// return the age in a descriptive string.
return$yearsOld. ‗year‘. ($yearsOld != 1 ? ‗s‘:");
}
In function pointers, functions in PHP can be referenced by a string containing
their name. In this manner, normal PHP functions can be used, for example, as callbacks
or within function tables. User-defined functions may be created at any time without
being prototyped. Function may be defined inside code blocks, permitting a run-time
decision as to whether or not a function should be defined. Function calls must use
parentheses, with the exception of zero-argument class constructor functions called with
21
By default, scalar type declarations follow weak typing principles. So, for
example, if a parameter's type is int, PHP would allow not only integers, but also
convertible numeric, strings, floats or booleans to be passed to that function, and would
convert them. However, PHP has a "strict typing" mode which, when used, disallows
Calling Functions
Look at the call to date(). This is the general form that function calls take. PHP
has an extensive library of functions I can use when developing web applications. Most
of these functions need to have some data passed to them and return some data. Now
date(‗H:I, j$ F‘)
Notice that it passes a string (text data) to the function inside a pair of
parentheses. The element within the parentheses is called the function‘s argument or
parameter. Such arguments are the input the function uses of output some specific
results.
like a variable. Arguments are specified after the function name, inside the parentheses. I
can add as many arguments as I want, just separate them with a comma. The following
example has a function with one argument ($fname). When the familyName() function is
called, I also pass along a name (e.g. Jani), and the name is used inside the function,
which outputs several different first names, but an equal last name:
22
PHP is a Loosely Typed Language
In the example above, notice that I did not have to tell PHP which data type the
variable is. PHP automatically associates a data type to the variable, depending on its
value. Since the data types are not set in a strict sense, I can do things like adding a string
to an integer without causing an error. In PHP 8, type declarations were added. This
gives us an option to specify the expected data type when declaring a function, and by
adding the strict declaration, it will throw a ―Fatal Error‖ if the data type mismatches.
PHP 8 also supports Type Declarations for the return statement. Like with the
type declaration for function arguments, by enabling the strict requirement, it will throw
a ―Fatal Error‖ on a type mismatch. To declare a type for the function return, add a
colon (:) and the type right before the opening curly ({) bracket when declaring the
function.
In PHP, arguments are usually passed by value, which means that a copy of the
value is used in the function and the variable that was passed into the function cannot be
also change the variable that was passed in. To turn a function argument into a
representing the style of output I would like. Each letter in the string represents one part
23
of the date and time. H is the hour in a 24-hour format with leading zeros where required,
i is the minutes with a leading zero where required, j is the day of the month without a
leading zero, S represents the ordinal suffix (in this case the), and F is the full name of
the month.
PHP OBJECTS
improved in PHP. This allowed for PHP to gain further abstraction, making creative
tasks easier for programmers using the language. Object handling was completely
rewritten for PHP, expanding the feature set and enhancing performance.
In previous versions of PHP, objects were handled like value types. The
drawback of this method was that code had to make heavy use of PHP‘s ―reference‖
variables if it wanted to modify an object it was passed rather than creating a copy of it.
In the new approach, objects are referenced by handle, and not by value.
PHP introduced private and protected member variables and methods, along with
abstract classes, final classes, abstract methods, and final methods. It also introduced a
standard way of declaring constructors and destructors, similar to that of other object-
oriented languages such as C++, and a standard exception handling model. Furthermore,
PHP 5 added interfaces and allowed for multiple interfaces to be implemented. There
are special interfaces that allow objects to interact with the runtime system. There is no
virtual table feature in the engine, so static variables are bound with a name instead of a
For convenience, the engine will supply a function that imports the properties of
the source object, so the programmer can start with a by-value replica of the source
24
The PHP source code on-the-fly into an internal format that it can execute, thus it
formal specification, and so the semantics of PHP define the semantics of PHP. Due to
the complex and nuanced semantics of PHP, defined by how works, it is difficult for
In order to speed up execution time and not have to compile the PHP source code
every time the web page is accessed, PHP scripts can also be deployed in the PHP
engine‘s internal format by using an opcode cache, which works by caching the
compiled form of a PHP script (opcodes) in shared memory to avoid the overhead of
parsing and compiling the code every time the script runs.
implementations have been developed. Some of these are compilers or support JIT
compilation, and hence offer performance benefits over PHP at the expense of lacking
PHP includes various free and open-source libraries in its source distribution, or
system with built-in modules for accessing File Transfer Protocol (FTP) servers and
many database servers, including PostgreSQL, MySQL, Microsoft SQL Server and
functions familiar to C programmers, such as those in the studio family, are available in
25
PHP FILE HANDLING
PHP has several functions for creating, reading, uploading, and editing files.
Assume I have a text file called "webdictionary.txt", stored on the server, that looks
like this:
Modes Description
r Open a file for read only. File pointer starts at the beginning of the file
w Open a file for write only. Erases the contents of the file or creates a new file
a Open a file for write only. The existing data in file is preserved. File pointer
starts at the end of the file. Creates a new file if the file doesn‘t exist
x Creates a new file for write only. Returns FALSE and an error if file already
exists
r+ Open a file for read/write. File pointer starts at the beginning of the file
w+ Open a file for read/write. Erases the contents of the file or creates a new file if
it doesn‘t exist. File pointer starts at the beginning of the file
a+ Open a file for read/write. The existing data in file is preserved. File pointer
starts at the end of the file. Create a new file if the file doesn‘t exist
x+ Create a new file for read/write. Returns FLASE and an error if file already
exists
26
EXCEPTION HANDLING
exception can be thrown, and caught ("catched") within PHP Code may be surrounded in
a try block, to facilitate the catching of potential exceptions. Each try must have at least
If an exception is thrown and its current function scope has no catch block, the
exception will "bubble up" the call stack to the calling function until it finds a matching
catch block. All finally blocks it encounters along the way will be executed. If the call
stack is unwound all the way to the global scope without encountering a matching catch
block, the program will terminate with a fatal error unless a global exception handler has
been set.
Exception. Trying to throw an object that is not will result in a PHP Fatal Error. As of
PHP 8.0.0, the throw keyword is an expression and may be used in any expression
context. In prior versions it was a statement and was required to be on its own line.
Catch
defines one or more types of exception or error it can handle, and optionally a variable to
which to assign the exception. (The variable was required prior to PHP 8.0.0) The first
catch block a thrown exception or error encounters that matches the type of the thrown
Normal execution (when no exception is thrown within the try block) will continue after
that last catch block defined in sequence. Exceptions can be thrown (or re-thrown)
27
within a catch block. If not, execution will continue after the catch block that was
triggered.
When an exception is thrown, code following the statement will not be executed,
and PHP will attempt to find the first matching catch block. If an exception is not caught,
a PHP Fatal Error will be issued with an "Uncaught Exception..." message, unless a
As of PHP 8.1.0, a catch block may specify multiple exceptions using the pipe ()
character. This is useful for when different exceptions from different class hierarchies are
handled the same. As of PHP 8.0.0, the variable name for a caught exception is optional.
If not specified, the catch block will still execute but will not have access to the thrown
object.
Finally
A finally block may also be specified after or instead of catch blocks. Code
within the finally block will always be executed after the try and catch blocks, regardless
of whether an exception has been thrown, and before normal execution resumes.
One notable interaction is between the finally block and a return statement. If a
return statement is encountered inside either the try or the catch blocks, the finally block
will still be executed. Moreover, the return statement is evaluated when encountered, but
the result will be returned after the finally block is executed. Additionally, if the finally
block also contains a return statement, the value from the finally block is returned.
28
PHP BUGS DEBUGGING
Programs rarely work correctly the first time. Many things can go wrong in my
program that cause the PHP interpreter to generate an error message. I have a choice
about where those error messages go. The messages can be sent along with other
program output to the web browser. They can also be included in the web server error
log.
configuration directive to On. To send errors to the web server error log, set log_errors
to On. I can set them both to On if I want error messages in both places.
PHP defines some constants I can use to set the value of error_reporting such
that only errors of certain types get reported: E_ALL (for all errors except strict notices),
While writing my PHP program, it is a good idea to use PHP-aware editors like
BBEdit or Emacs. One of the special special features of these editors is syntax
highlighting. It changes the color of different parts of my program based on what those
parts are. For example, strings are pink, keywords such as if and while are blue,
Another feature is quote and bracket matching, which helps to make sure that my
quotes and brackets are balanced. When I type a closing delimiter such as }, the editor
There are following points which need to be verified while debugging my program.
Missing Semicolons – Every PHP statement ends with a semicolon (;). PHP
doesn‘t stop reading a statement until it reaches a semicolon. If I leave out the
29
semicolon at the end of a line, PHP continues reading the statement on the
following line.
Not Enough Equal Signs – When I ask whether two values are equal in a
comparison statement, I need two equal signs (==). Using one equal sign is a
common mistake.
as a new variable. Remember: To PHP, $test is not the same variable as $Test.
Missing Dollar Signs – A missing dollar sign in a variable name is really hard to
see, but at least it usually results in an error messages so that I know where to
Troubling Quotes – I can have too many, too few, or the wrong kind of quotes.
Array Index – All the arrays should start from zero instead of 1.
PHP COOKIES
Cookies are text files stored on the client computer and they are kept of use
Serve script sends a set of cookies to the browser. For example name, age, or
When next time browser sends any request to web server then it sends those
cookies information to the server and server uses that information to identify the
user.
30
The Anatomy of a Cookie
Cookies are usually set in an HTTP header (although JavaScript can also set a
cookie directly on a browser). A PHP script that sets a cookie might send headers that look
HTTP/1.1 200 OK
path=/; domain=tutorialspoint.com
Connection: close
Content-Type: text/html
As I can see, the Set-Cookie header contains a name value pair, a GMT date, a
path and a domain. The name and value will be URL encoded. The expires field is an
instruction to the browser to ―forget‖ the cookie after the given time and date.
If the browser is configured to store cookies, it will then keep this information
until the expiry date. If the user points the browser at any page that matches the path and
domain of the cookie, it will resend the cookie to the server. The browser‘s headers
GET/HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/4.6 (X11; I; Linux 2.2.6-15apmac ppc)
Host: zink.demon.co.uk:1126
31
Cookie: name=xyz
A PHP script will then have access to the cookie in the environmental variables
PHP provided setcookie() function to set a cookie. This function requires upto
six arguments and should be called before <html> tag. For each cookie this function has
to be called separately.
Name – This sets the name of the cookie and is stored in an environment variable
Value – This sets the value of the named variable and is the content that I
Expiry – This specify a future time in seconds since 00:00:00 GMT on 1st Jan
1970. After this time cookie will become inaccessible. If this parameter is not
set then cookie will automatically expire when the Web Browser is closed.
Path – This specifies the directories for which the cookie is valid. A single
forward slash character permits the cookie to be valid for all directories.
Domain – This can be used to specify the domain name in very large domains
and must contain at least two periods to be valid. All cookies are only valid for
Security – This can be set to 1 to specify that the cookie should only be sent by
secure transmission using HTTPS otherwise set to 0 which mean cookie can be
32
PHP SESSION
session variables and their values are stored. This data will be a available to all pages on
The location of the temporary file is determined by a setting in the php.ini file
called session.save_path. Before using any session variable make sure I have setup this
path.
PHP first creates a unique identifier for that particular session which is a random
sess_3c7foj34c3jj973hjkop2937e3443.
When a PHP script wants to retrieve the value from a session variable, PHP
automatically gets the unique session identifier string from the PHPSESSID cookie and
then looks in its temporary directory for the file bearing that name and a validation can
be done by comparing both values. A session ends when the user loses the browser or
after leaving the site, the server. Will terminate the session after a predetermined period
33
Starting a PHP Session
This function first checks if a session is already started and if none is started then it starts
one. It is recommended to put the call to session_start() at the beginning of the page.
does not need any argument and a single call can destroy all the session variables. If you
want to destroy a single session variable then I can use unset() function to unset a
session variable.
I don‘t need to call start_session() function to start a session when a user visitsmy
These may be a case when a user does not allow to store cookies on their
Alternatively, I can use the constant SID which is defined if the sessionstarted.
If the client did not send an appropriate session cookie, it has the form session
34
DESIGNING DATABASE
The first step is always to create the database, unless I want to use one from a
third party. When a database is created, it is assigned to an owner, who executed the
creation statement. Usually, only the owner (or a super user) can do anything with the
objects in that database, and in order to allow other users to use it, privileges must be
granted.
Applications should never connect to the database as its owner or a super user,
because these users can execute any query at will, for example, modifying the schema
I may create different database users for every aspect of my application with very
limited rights to database objects. The most required privileges should be granted only,
and avoid that the same user can interact with the database in different use cases. This
Connecting to Database
communications for increased security, or I can use ssh to encrypt the network
connection between clients and the database server. If either of these is used, then
monitoring my traffic and gaining information about my database will be difficult for a
would-be attacker.
from the NetBeans IDE. Once connected, I can begin working with MySQL in the IDE‘s
Database Explorer by creating new databases and tables, populating tables with data, and
35
running SQL queries on database structures and content. This tutorial is designed for
beginners with a basic understanding of database management, who want to apply their
(RDBMS) commonly used in web applications due to its speed, flexibility and reliability.
MySQL employs SQL, or Structured Query Language, for accessing and processing data
contained in databases.
MySQL
MySQL, the most popular Open Source SQL database management system, is
network. To add, access, and process data stored in a computer database, I need a
database management system such as MySQL Server. Since computers are very good at
handling large amounts of data, database management systems play a central role in
A relational database stores data in separate tables rather than putting all the data
in one big storeroom. The database structures are organized into physical files optimized
for speed. The logical model, with objects such as databases, tables, views, rows, and
required or optional, and ―pointers‖ between different tables. The database enforces
36
these rules, so that with a well-designed database, my application never sees inconsistent,
The SQL part of ―MySQL‖ stands for ―Structured Query Language‖. SQL is the
reports), embed SQL statements into code written in another language, or use a
SQL is defined by the ANSI/ISO SQL Standard. The SQL standard has been
evolving since 1986 and several versions exist. In this manual, ―SQL-92‖ refers to the
standard released in 1992, ―SQL:1999‖ refers to the standard released in 1999, and
―SQL:2003‖ refers to the current version of the standard. I use the phrase ―the SQL
standard‖ to mean the current version of the SQL Standard at any time.
Open Source means that it is possible for anyone to use and modify the software.
Anybody can download the MySQL software from the Internet and use it without paying
anything. If I wish, I may study the source code and change it to suit my needs. The
http://www.fsf.org/licenses/, to define what I may and may not do with the software in
different situations. If I feel uncomfortable with the GPL or need to embed MySQL code
into a commercial application, I can buy a commercially licensed version from us.
(http://www.mysql.com/company/legal/licensing/).
37
The MySQL Database Server is very fast, reliable, scalable, and easy to use
If that is what I am looking for, I should give it a try. MySQL Server can run
on, requiring little or no attention. If I dedicate an entire machine to MySQL, I can adjust
the settings to take advantage of all the memory, CPU power, and I/O
together.
MySQL Server was originally developed to handle large databases much faster
than existing solutions and has been successfully used in highly demanding production
environments for several years. Although under constant development, MySQL Server
today offers a rich and useful set of functions. Its connectivity, speed, and security make
multithreaded SQL server that supports different back ends, several different client
multithreaded library that I can link into my application to get a smaller, faster, easier-to-
MySQL Server has a practical set of features developed in close cooperation with
out users. It is very likely that m y favorite application or language supports the
38
The Main Features of MySQL
Uses very fast B-tree disk tables (MyISAM) with index compression.
Designed to make it relatively easy to add other storage engines. This is useful ifI
Implements SQL functions using a highly optimized class library that should be
as initialization.
Data Types
TIME, DATATIME, TIMESTAMP, YEAR, SET, ENUM, and OpenGIS spatial types.
39
Statements and Functions
Full operator and function support in the SELECT list and WHERE clause of
FROM citizen
Full support for SQL GROUP BY and ORDER BY clauses, Support for group
GROUP_CONCAT()).
Support for LEFT OUTER JOIN and RIGHT OUTER JOIN with both standard
Support for DELETE, INSERT, REPLACE, and UPDATA to return the number
of rows that were changed (affected), or to return the number of rows matched
Independence of function names from table or column names, For example, ABS
is a valid column name. The only restriction is that for a function call, no spaces
are permitted between the function name and the ―(―that follows it. See Section
40
Security
A privilege and password system that is very flexible and secure, and that enables
host-based verification.
server.
Support for large databases use MySQL Server with database that contain 50
million records. I also know of users who use MySQL Server with 200,000 tables
columns or parts of columns. The maximum index width for InnoDB tables is
either 767 bytes or 3072 bytes. See Section 15.22, ―InnoDB Limits‖. The
maximum index width for MyISAM tables is 1000 bytes. See Section 16.2, ―The
MyISAM Storage Engine‖. An index may use a prefix of a column for CHAR,
Connectivity
On windows systems, clients can connect using named pipes if the server is
started with the named_pipe system variable enabled. Windows servers also
variable enabled. Clients can connect through shared memory by using the—
protocol=memory option.
On Unix systems, clients can connect using Unix domain socket files.
41
MySQL client programs can be written in many languages. A client library
written in C is available for clients written in C or C++, or for any language that
provides C bindings.
APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl are available,
2.5 functions are supported, as are many others, See MySQL Connector/ODBC
Developer Guide.
The Connector/J interface provides MySQL support for Java client programs that
aware tools. Developers can build applications using their choice of .NET
Localization
The server can provide error messages to clients in many languages. See Section
Full support for several different character sets, including latinl (cp1252),
42
german, big5, ujis, several Unicode character sets, and more. For example, the
Scandinavian characters ―a‖, ―a‖ and ―o‖ are permitted in table and column
names.
Sorting and comparisons are done according to the default character set and
collation. Is possible to change this when the MySQL server is started (see
Section 10.3.2, ―Server Character Set and Collation‖). To see an example of very
advanced sorting, look at the Czech sorting code. MySQL Server supports many
different character sets that can be specified at compile time and runtime.
The server time zone can be changed dynamically, and individual clients can
specify their own time zone. See Section 5.1.15, ―MySQL Server Time Zone
Support‖.
MySQL includes several client and utility programs. These include both
MySQL Server has built-in support for SQL statements to check, optimize, and
repair tables. These statements are available from the command line through the
MySQL Programs.
MySQL programs can be invoked with the –help or -? option to obtain online
assistance.
43
Features Added in MySQL 5.0
stores information about database objects. In previous MySQL releases, dictionary data
was stored in metadata files and non-transactional tables. For more information.
combines the data dictionary updates, storage engine operations, and binary log write
sassociated with a DDL operation into a single, atomic transaction. For more information.
the MySQL server automatically upgrades the data dictionary tables at the next startup,
after which the DBA is expected to invoke mysql_upgrade manually to upgrade the
system tables in the mysql schema, as well as objects in other schemas such as the sys
44
5. SYSTEM DESIGN
Testing Phase
detailed one. During the preliminary analysis the Analyst takes a quick look at what is
needed and whether the cost benefits. Detailed analysis studies in depth all the cornered
SRS
overview of the entire SRS with purpose, scope, definitions, acronyms, abbreviations,
references and overview of the SRS. The aim of this document is to gather and analyze
and give an in-depth insight of the complete requirements of our project by defining the
System design is the second step in the system life cycle, in which overall design
of the system is achieved. The functionalities of the system is designed and studied in
this phase. The first step is designing of program specification. This determines the
45
various data inputs to the system, data flow and the format in which output is to be
obtained.
document to computer data. The activity in the design phase is the allocation of functions
to manual operations, equipment and computer programs. Flow charts are prepared in the
study time and are decomposed until all functions in the system perform evidently.
architecture; procedural details (algorithms etc.) and links between the modules. The
design process goes through logical and physical stages. In logical design review are
made linking existing system and specification gathered. The physical plan specifies any
system depends on the planning of each and every fundamental module. Usually a
Various techniques for software design do exit with the availability of criteria for
design quality. Software design leads three technical activities-design, code and test.
Each activity transforms information, which validates the software. The design system
converts theoretical solution introduction by the feasibility study into a logical reality.
46
TABLE DESIGN
47
Table Name: Classes
48
Table Name: Staff Attendance
DAY_ORDER VARCHAR 30
HOUR VARCHAR 30
49
USE CASE DIAGRAM
STUDENTS:
Login
Search
View
Report
Update
Profile
Logout
50
STAFFS:
Register
Login
Add
Students
Attendance
Report
Logout
51
ADMIN:
Login
Manage Classes
Manage Staff
Manage
Students
Manage
Attendance
View Report
Logout
52
ACTIVITY DIAGRAM
ADMIN PROCESS:
Login
NO
Is
Valid?
YES
Create
Report
Update
View
Delete
View
Logout
53
STAFF PROCESS:
Login
Register
NO
Is
Valid?
YES
Students Attendance
Register
Create
Update No
Delete Open
?
Yes
Class
Report
View
Logout
54
Students Process:
Search
Report
View
End
55
6. SYSTEM TESTING
systematically. Testing is vital to the success of the system. System testing makes a
logical assumption that if all the parts of the system are correct, the global will be
successfully achieved. In adequate testing if not testing leads to errors that may not
The time lag between the cause and the appearance of the problem.
The effect of the system errors on the files and records within the system.
A small system error can conceivably explode into a much larger problem
Effective testing early in the purpose translates directly into long term cost savings from
a reduced number of errors. Another reason for system testing is its utility, as a user-
oriented vehicle before implementation. The best programs are worthless if it produces
the correct outputs. No other test can be more crucial. Following this step, a variety of
Unit testing
Integration testing
Validation testing
56
UNIT TESTING
satisfactorily, it must compile and test data correctly and tie in properly with other
Program testing checks for two types of errors: syntax and logical. Syntax error is a
program statement that violates one or more rules of the language in which it is written.
An improperly defined field dimension or omitted keywords are common syntax errors.
These errors are shown through error message generated by the computer. For Logic
When a program is tested, the actual output is compared with the expected
determine the problem. The process is facilitated by breaking the program into self-
contained portions, each of which can be checked at certain key points. The idea is to
FUNCTIONAL TESTING
correct results, using enough inputs to give an adequate level of confidence that will
work correctly for all sets of inputs. The functional testing will need to prove that the
application works for each client type and that personalization function work correctly.
57
NON-FUNCTIONAL TESTING
This testing used to check that an application will work in the operational
environment.
Load testing
Performance testing
Usability testing
Reliability testing
Security testing
White box testing, sometimes called glass-box testing is a test case design
method that uses the control structure of the procedural design to derive test cases.
Using white box testing method, the software engineer can derive test cases.
Black box testing, also called behavioral testing, focuses on the functional
requirements of the software. That is, black testing enables the software engineer to
derive sets of input conditions that will fully exercise all functional requirements for a
program. Black box testing is not alternative to white box techniques. Rather it is a
complementary approach that is likely to uncover a different class of errors than white
box methods. Black box testing attempts to find errors in the following categories.
58
IMPLEMENTATION
System implementation is the process of making the newly designed system fully
operational and consistent in performance. The following steps have been followed in
Implementation in planning
User Training
As the part of implementation, the system is taken the site and Loaded on to
client's computer. Some of the user's level, exposure to computer etc. these users are
trained first and they run the system for a month. A detailed documentation is prepared
for the employees and they trained to access the software. These users are trained first
hardware specifications are satisfactory, then the software is loaded for pilot run. User
training starts at this time itself. Users will be given a user manual, which documents
how to use the system and all the exception handling procedures.
59
7. OUTPUT SCREENS
60
Fig:7.3-Screenshot for manage staff by admin module:
61
Fig:7.5-Screenshot for add class details form by admin
62
Fig:7.7-Screenshot for view students report lists by admin
63
Fig:7.9-Screen shot for open and close class attendance by staff
64
Fig:7.11-Screenshot for students attendance list by staff
65
Fig:7.13-Screen shot for students search form on home page
66
8. SOURCE CODE
<?php
$con = mysqli_connect("localhost","root","","gymnsb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
?>
--
-- Database: `attendance`
--
-- Table structure for table `admin`
--
--
-- Dumping data for table `admin`
--
-- Table structure for table `attendance`
--
--
-- Dumping data for table `attendance`
--
-- Dumping data for table `attendance_register`
--
-- Table structure for table `classes`
--
--
-- Dumping data for table `classes`
--
-- Table structure for table `staffs`
--
68
`alias` varchar(30) DEFAULT NULL,
`email` varchar(30) NOT NULL,
`password` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `staffs`
--
-- Table structure for table `staff_attendance`
--
--
-- Dumping data for table `staff_attendance`
--
-- Table structure for table `students`
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `attendance`
--
ALTER TABLE `attendance`
ADD PRIMARY KEY (`id`);
69
--
-- Indexes for table `attendance_register`
--
ALTER TABLE `attendance_register`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `classes`
--
ALTER TABLE `classes`
ADD PRIMARY KEY (`id`),
ADD KEY `incharge_staff_id` (`incharge_staff_id`);
--
-- Indexes for table `staffs`
--
ALTER TABLE `staffs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `staff_email` (`email`),
ADD UNIQUE KEY `staff_alias` (`alias`);
--
-- Indexes for table `staff_attendance`
--
ALTER TABLE `staff_attendance`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `students`
--
ALTER TABLE `students`
ADD PRIMARY KEY (`id`),
ADD KEY `class_id` (`class_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admin`
--
ALTER TABLE `admin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `attendance`
--
ALTER TABLE `attendance`
MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
70
--
-- AUTO_INCREMENT for table `attendance_register`
--
ALTER TABLE `attendance_register`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `classes`
--
ALTER TABLE `classes`
MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `staffs`
--
ALTER TABLE `staffs`
MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT for table `staff_attendance`
--
ALTER TABLE `staff_attendance`
MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
MODIFY `id` int(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=68;
COMMIT;
<?php
extract($_POST);
session_start();
include('db.php');
if (isset($submit))
{
if ($num_row > 0)
{
$_SESSION['id']=$row['id'];
71
header('location:admin');
}
else
{
echo "<div class='alert alert-danger alert-dismissible' role='alert'>
Invalid Username and Password
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
}
?>
<?php
include('db.php');
extract($_POST);
if(isset($submit))
{
echo "<div>
'$staff_password',,'$staff_confirm_password'
</div>";
if($staff_password === $staff_confirm_password)
{
$email_query = "select email from staffs";
$email_query = mysqli_query($con,$email_query);
while($row=mysqli_fetch_array($email_query)){
if($row['email']==$staff_email) {
echo "<div class='alert alert-danger alert-dismissible' role='alert'>
this Email'$staff_email' already used
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
}
}
else
{
echo "<div class='alert alert-danger alert-dismissible' role='alert'>
PASSWORD AND CONFIRM PASSWORD COUND'T MATCH
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
$insert_staff="insert into staffs
values('','$staff_name','$staff_alias','$staff_email','$staff_password')";
72
$result = mysqli_query($con,$insert_staff);
if($result){
echo "successfully run the results";
header("location:index.php?info=staff_login");
}
}
?>
session_start();
extract($_POST);
if(isset($submit)){
$_SESSION['reg.no'] = $text;
header("location:students");
}
$reg_no = $_SESSION['reg.no'];
$retrieve_students = mysqli_query($con,"select * from students where register_no =
'$reg_no'");
$student_row = mysqli_fetch_array($retrieve_students);
</table>
<?php
@$class_id = $_GET['class_id'];
@$class_name = $_GET['class_name'];
if(isset($class_id)){
$staff_query = mysqli_query($con,"select incharge_staff_id from classes where id =
'$class_id'");
$staff_id = mysqli_fetch_array($staff_query);
$staff_name_query = mysqli_query($con,"select name from staffs where
id='$staff_id[incharge_staff_id]'");
$staff_name = mysqli_fetch_array($staff_name_query);
}
?>
<section id="admin_class" class="admin_class sections-bg">
<div class="container" data-aos="fade-up">
<div class="section-header">
<div class="row">
<div class="col-md-6">
<h2><?php echo $class_name;?></h2>
</div>
<div class="col-md-6">
Incharge Name:<?php echo $staff_name['name'];?>
</div>
</div>
</div>
?>
<tr>
<td><?php echo "$i";?></td>
<td><?php echo "$student_row[name]";?></td>
<td><?php echo "$student_row[register_no]";?></td>
<td> <div class="btn btn-success btn-md" onclick="report()">Report</div> </td>
</tr>
<?php
$i++;
}
}
?>
</table>
</div>
</section>
<?php
@$staff_delete_id = $_GET['delete_id'];
if(isset($staff_delete_id)){
$delete_query = mysqli_query($con,"delete from staffs where id='$staff_delete_id'");
if(isset($delete_query)){
echo "<div class='alert alert-success alert-dismissible' role='alert'>
DELETE SUCCESSFULLY!
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
}
?>
<section id="admin_staff" class="admin_staff sections-bg">
<div class="container" data-aos="fade-up">
<div class="section-header">
<h2>staff</h2>
</div>
75
<table class='table table-bordered table-striped table-hover table-responsive'
style=margin:15px;>
<tr>
<th>S.No</th>
<th>Staff name</th>
<th>Alias</th>
<th>Email</th>
<th>Report</th>
<th>Action</th>
</tr>
<?php
$i=1;
$staff_query = "select * from staffs" ;
$staff_rows = mysqli_query($con,$staff_query);
while($staff_row=mysqli_fetch_array($staff_rows)){
?>
<tr>
<td><?php echo "$i";?></td>
<td><?php echo "$staff_row[name]";?></td>
<td><?php echo "$staff_row[alias]";?></td>
<td><?php echo "$staff_row[email]";?></td>
<td>
<a class="btn btn-success btn-md" href="index.php?info=staff_report&staff_id=<?php
echo $staff_row['id']?>">Report</a>
</td>
<td>
<div class="btn btn-danger btn-md"><a style="color:black;"
href="index.php?info=staffs&delete_id=<?php echo $staff_row['id']?>">Delete</a></div>
</td>
</tr>
<?php
$i++;
}
?>
</table>
</div>
</section>
76
9. CONCLUSION
consumes lots of time and paper. But this system totally web based, it means that staff
can enter students details into the system very easily. They can view the details of the
class this system is totally user friendly and time saving and cost effective system.
Enhances security report generation is made easy and efficient. Reduce the paper work.
attendance details and generates reports for staff and students. Also override the
problems in manual way to the maintaining attendance and practicing attendance report
77
10. BIBLIOGRAPHY
BOOKS REFERENCES
PHP & MYSQL Bible : Steve Suching, Tim Converse Joy Park
Wiely Publication
WEBSITE REFERENCES
www.w3Schools.com
www.tutorialspoint.com
www.Udemy.com
www.StackOverflow.com
www.Codeacademy.com
78