0% found this document useful (0 votes)
170 views35 pages

MYSQL Server As The Database

The document describes a supermarket management system that is a web-based application built using PHP and MySQL. It allows storekeepers to manage product inventory, sales, purchases and billing. The system automates tasks like tracking sold and restocked products, barcode scanning and generating receipts. It aims to make the existing manual system more efficient, reliable and user-friendly by reducing paperwork and providing secure access and accurate real-time data. Key modules include administration, employees, purchases, sales and billing. The system offers advantages like increased productivity, transparency, and reduced manual work and errors compared to traditional paper-based methods.

Uploaded by

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

MYSQL Server As The Database

The document describes a supermarket management system that is a web-based application built using PHP and MySQL. It allows storekeepers to manage product inventory, sales, purchases and billing. The system automates tasks like tracking sold and restocked products, barcode scanning and generating receipts. It aims to make the existing manual system more efficient, reliable and user-friendly by reducing paperwork and providing secure access and accurate real-time data. Key modules include administration, employees, purchases, sales and billing. The system offers advantages like increased productivity, transparency, and reduced manual work and errors compared to traditional paper-based methods.

Uploaded by

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

Supermarket Management System

Supermarket Management System is a web-based application implemented PHP using


MYSQL Server as the database. Our supermarket management system, a form of grocery store,
is a self-service store offering a wide variety of food and household merchandise, organized into
departments. We have updated Super Market management System Detailed products, it helps the
store keeper to keep records of sold out and intake products details, advanced feature of bar-
coding verifications and billing system to the customers.he Supermarket Management System is
a project that deals with supermarket automation and it includes both purchasing a selling of
items. This project is designed with a goal to making the existing system more informative,
reliable, fast and easier. There are many reasons for the starting of the project because in the
selling of items through the manual system of salesperson faces a lot of inefficiencies. It requires
handling of large record books that consist of both irrelevant and important information’s thus
making it difficult to find out the required information as per necessity.

This is also a clumsy and untidy process that disturbs the smooth flow of work. But this system
introduced by us will reduce the huge number of paper works while on the other side there are
many more problems that persist in the manual system. They reduce efficiency as well as the
productivity level of human. Administrative module, purchase module, employee module, sales
module and billing module are some of the various modules that make up our project.

The administrators consist of a unique password and names of the employees. It helps the
employees to make secure login. The ids and passwords are kept secret from others. The
modules of sales and purchase include all the details of selling and purchasing. In the billing
module the details of payments are clearly shown.

This is one of the best system that can be introduced in the supermarket for efficient
management. It will also reduce the cumbersome job of finding the most accurate data from the
huge log books. It also helps the management to keep efficient records of all the purchases and
sales. The introduction of ID and password will further reduce the manipulation and thus
providing the accurate and transparent data. This system will increase the productivity and
reduce the need of manual system to a large extent.
Modules:

The main modules in supermarket management system are:

 Administrative module: This module is handled by an admin who has full control
over the system. Admin is required to log in to the system with a unique user id and
password. They have control over all the modules and features of the system. Admin
can allocate unique user id (username and password) to the employees and staffs.
o Login: Admin need to login using valid login credentials in order to access the
system.
o Add / View Products: Admin can add new product with its details into the system.
o View Transactions: System allows admin to view all the transactions done by the
registered users.

User

o Registration: Here, user first need to registration themselves with details to access
the system.
o Login: After a successful registration, user then need to login into the system by
inputting their credentials into the system.

 Employee module: Employee can use this module with their user id. They can keep
track of items in the supermarket, and are responsible for recording details of
purchases and sales.
 Purchase module: This module stores all the purchase details of the supermarket.
 Sales module: This module stores all the sales details of the supermarket.
 Billing module: With the help of this module, all the payment details based on
purchases and sales can be shown.
II-SYSTEM STUDY
2.1 Existing System:

The existing system is very paper based in small as well as medium supermarkets. Even though
the paper work and manpower requirement is less, the existing system is not very economical for
these markets. Relevant and irrelevant information are entered and stored in the same place,
which is very clumsy and untidy process.In case of big supermarkets, the existing system is
computerized to some extent, but it is not fully automated to cover all the aspects of the
supermarket. The data entry, storing, and retrieval procedure is very inefficient. Further, there are
chances of data misplacement and wrong data entry. The system is still very insecure and
inflexible to adapt to user requirements.

Lack of security of data.


 More man power.
 Time consuming.
 Consumes large volume of pare work.
 Needs manual calculations.
 No direct role for the higher officials.
 To avoid all these limitations and make the working more accurately the system needs to
be computerized.

Proposed System:

The proposed supermarket management system aims at full automation of big, medium, and mini
supermarkets by making the system reliable, fast, user-friendly, and informative. It reduces
paperwork, manpower requirement, and increases the productivity of the supermarket. Using this
application, one can add, modify, update, save, delete, and print details. There’s also a search
feature to find products available in the supermarket. The drawback of the existing system is
that it is very difficult to retrieve data from case files. The manual system is so time-consuming.
The proposed system is very easy to operate. Speed and accuracy are the main advantages of
proposed system. There is no redundancy of data. The data are stored in the computer’s
secondary memories like hard disk, etc. The proposed system will easily handle all the data and
the work done by the existing systems. The proposed systems eliminate the drawbacks of the
existing system to a great extent and it provides tight security to data.

ADVANTAGES OF THE PROPOSED SYSTEM


The system is very simple in design and to implement. The system requires very low
system resources and the system will work in almost all configurations. It has got following
features
 Security of data.
 Ensure data accuracy’s.
 Proper control of the higher officials.
 Reduce the damages of the machines.
 Minimize manual data entry.
 Minimum time needed for the various processing.
 Greater efficiency.
 Better service.
 User friendliness and interactive.

Features:

 It reduces the time and manpower required for management and maintenance of
different tasks.
 It reduces the paper work in existing system, hence it is economical and efficient.
 With this system, customers get quality of service; customers can even give feedback
which can be stored in the database.
 As the entire system is fully computerized, records of daily and monthly purchases
and sales can be recorded and analyzed.
 This system is very secure, user-friendly, and reliable.
2.3 SOFTWARE REQUIREMENTS

OS : MS WINDOWS 7

Front End : PHP,HTML,CSS and JavaScript

Back End : MYSQL Server

Framework :Xampp Server.

2.4 Hardware Requirements


Processor : i3 Processor or above

Clock speed : 500 MHZ

System bus : 32 bits

RAM : 4GB of RAM

HDD : 500 GB or higher

Monitor : LCD Monitor

Keyboard : 108 keys

Mouse : 2 button mouse

2.5 SOFTWARE DESCRIPTION:

PHP started out as a small open source project that evolved as more and more people found out
how useful it was. RasmusLerdorf unleashed the first version of PHP way back in 1994.

 PHP is a recursive acronym for "PHP: Hypertext Preprocessor".


 PHP is a server side scripting language that is embedded in HTML. It is used to manage
dynamic content, databases, session tracking, even build entire e-commerce sites.
 It is integrated with a number of popular databases, including MySQL, PostgreSQL,
Oracle, Sybase, Informix, and Microsoft SQL Server.
 PHP is pleasingly zippy in its execution, especially when compiled as an Apache module
on the Unix side. The MySQL server, once started, executes even very complex queries
with huge result sets in record-setting time.
 PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. PHP4
added support for Java and distributed object architectures (COM and CORBA), making
n-tier development a possibility for the first time.
 PHP is forgiving: PHP language tries to be as forgiving as possible.
 PHP Syntax is C-Like.

Common uses of PHP


 PHP performs system functions, i.e. from files on a system it can create, open, read,
write, and close them.
 PHP can handle forms, i.e. gather data from files, save data to a file, through email you
can send data, return data to the user.
 You add, delete, modify elements within your database through PHP.
 Access cookies variables and set cookies.
 Using PHP, you can restrict users to access some pages of your website.
 It can encrypt data.

Characteristics of PHP
Five important characteristics make PHP's practical nature possible −

 Simplicity

 Efficiency

 Security

ACK END: MYSQL


 It is software, developed by Microsoft, which is implemented from the specification of
RDBMS.
 It is also an ORDBMS.
 It is platform dependent.
 It is both GUI and command based software.
 It supports SQL (SEQUEL) language which is an IBM product, non-procedural,
common database and case insensitive language.

Usage of SQL Server

 To create databases.

 To maintain databases.

 To analyze the data through SQL Server Analysis Services (SSAS).

 To generate reports through SQL Server Reporting Services (SSRS).

 To carry out ETL operations through SQL Server Integration Services (SSIS).

SQL Server works in client-server architecture, hence it supports two types of components − (a)
Workstation and (b) Server.

 Workstation components are installed in every device/SQL Server operator’s machine.


These are just interfaces to interact with Server components. Example: SSMS, SSCM,
Profiler, BIDS, SQLEM etc.
 Server components are installed in centralized server. These are services. Example:
SQL Server, SQL Server Agent, SSIS, SSAS, SSRS, SQL browser, SQL Server full text
search etc.

 An instance is an installation of SQL Server.

 An instance is an exact copy of the same software.

 If we install 'n' times, then 'n' instances will be created.

 There are two types of instances in SQL Server a) Default b) Named.

 Only one default instance will be supported in one Server.

 Multiple named instances will be supported in one Server.

 Default instance will take the server name as Instance name.


 Default instance service name is MSSQLSERVER.

 16 instances will be supported in 2000 version.

 50 instances will supported in 2005 and later versions.

Advantages of Instances

 To install different versions in one machine.

 To reduce cost.

 To maintain production, development, and test environments separately.

 To reduce temporary database problems.

 To separate security privileges.

 To maintain standby server.

3.SYSTEM DESIGN AND DEVELOPMENT

3.1 Data Flow Diagram

Data Flow Diagram (DFD) is a two-dimensional diagram that describes how data is processed
and transmitted in a system. The graphical depiction recognizes each source of data and how it
interacts with other data sources to reach a mutual output. In order to draft a data flow diagram
one must
 Identify external inputs and outputs

 Determine how the inputs and outputs relate to each other

 Explain with graphics how these connections relate and what they result in.

Role of DFD:
 It is a documentation support which is understood by both programmers and non-
programmers. As DFD postulates only what processes are accomplished not how they are
performed.

 A physical DFD postulates where the data flows and who processes the data.

 It permits analyst to isolate areas of interest in the organization and study them by
examining the data that enter the process and viewing how they are altered when they
leave.

Level 0:

Admin

Super mrket
Management process supermarket management
Process Database

Staff

DFD Level 1:

Add staff
Entry
Super market Add Product
Admin Management process Details
login

Add purchase Super market


Details Management
Database
Manager

Add stock
Information

Add sales
Allotment

3.3 FILE DESIGN:


One problem that would overcome is how to deal with the relations and searching to
minimize I/O operations. All fields are variable length apart from the id, year & length.
Server should be able to synchronize the database to all clients with minimal operations.
When a client comes online, all changes part the date sync back to the client. Another
way to do this would have a separate table on the server which lists all the operations that
have happened and the date they happened; and sync in a similar happened.
Fast read operations for clients
Some sort of index will have to be stored for each table for where each record starts. This
could be small enough to load into memory and could be stores in files separate to the actual
tables to avoid issues.
Minimise I/O operations
The server will store an “index” of the tracks database in memory with the id and file
name so read operations are kept to a minimum. The main problem will be fragmentation
when a record is deleted. Because of the variable length fields, a new record cannot be added
in that place. So fixed length fields should not be used either (as the filename could be huge
for instance).
3.4 INPUT DESIGN
Input design is one of the most important phases of the system design. Input
design is the process where the input received in the system are planned and designed, so
as to get necessary information from the user, eliminating the information that is not
required. The goal of the input design is to make the data entry logical and free from
errors.
Input data are collected and organized into a group of similar data. Once
identified input media are selected for processing. In the software, importance is given to
develop Graphical User Interface (GUI), which is an important factor in developing
efficient and user- friendly software. For inputting user data, attractive forms are
designed. User can also select desired options from the menu, which provides all possible
facilities.
Input is any data or instructions entered into the memory of a computer. Two
types of input are data and instructions. Data is a collection of unorganized items that can
include
3.5 OUTPUT DESIGN
Computer output is the most important direct source of information to the user. The output
design refers to the result and information that it’s generated by the system forms many end
users. To produce the output which are displayed in a screen, efficient and intelligent output
design improves the system relationship with the users and help indecision making. It is
designed in a user-friendly way to avoid user burden.
Two of the most output media today are printers and screen. Most customers now access
their reports from a hard copy or screen display. Computer’s output is the most important and
direct source of information to the user, efficient, logical, output design should improve the
systems relations with the user and help in decision-making. As the outputs are the most
important source of information to the user, better design should improve the system’s relation
and also should help in decision-making.
3.6 DATABASE DESIGN
Data base is designed to manage large bodies of information. The management of data
involves both the definitions of structures for the storage of information. In addition the data base
system must provide for the safety of the information solved, despite system crashes or due to
attempts at unauthorized access. For developing an efficient database we have to fulfil certain
conditions such as controlled redundancy.
● Defining the data
● Inputting the data
● Locating the data
● Accessing the data
● Communicating the data
● Revising the data
Objectives of Data base deign
For designing data base design several objectives have to be met as follows:
● Ease of use
● Control of data integrity
● Control of redundancy
● Data independence (logical & physical)

4.TESTING AND IMPLEMENTATION


4.1 INTRODUCTION:
Testing is the process of detecting errors for which the required open web application
secure employment portal specifications stated. Testing performs a very critical role for quality
assurance and for ensuring the reliability of software. The results of testing are used later on
during the software maintenance. The aim of testing is often used to demonstrate that a program
works by showing that it has no errors. The basic purpose of testing phase is to detect the errors
that may be present in the program. Hence one should not start testing with the intent of showing
that a program works, but the intent should be to show that a program doesn’t work. The main
objective of testing is to uncover an error in systematic way with minimum effort and time.
TESTING OBJECTIVES
The testing objectives are summarized in the following three steps:
 Testing is process of executing a program with the intent of finding an error.
 A good test case is one that has high probability of finding an undiscovered error.
 A successful test is one that uncovers an as yet undiscovered error.
TESTING TYPES
The different types of testing are:
 Unit testing
 Integration testing
 System testing
 Acceptance testing
Unit Testing:
This test focuses on verification effort on the smallest unit of software module. Using the
detailed design and the process specifications testing is done to uncover errors within the
boundary of the module. All the modules must be successful in the unit test before the start of

the integration testing begins. In this project each service is a module like Login, Forms etc.
Each module has to be tested by giving different sets of inputs. The inputs are validated when
accepting from user.
Integration Testing:
After the unit testing the integration of modules has to be done and then integration
testing can be done. The goal here is to see if modules can be integrated properly, the emphasis
being on testing interfaces between different modules.
System Testing:
In the system testing the entire web portal is tested according the software requirement
specifications document.
Acceptance Testing:
The acceptance testing is performed with realistic data of the client, which focus on the
external behaviour of the system; the internal logic of the program is emphasized. Software
testing is a critical element of software quality assurance and represents the ultimate review of
specification, design and coding. Testing is the exposure of the system to trial input to see
whether it produces correct output.
TESTING PHASES:
Software testing phases include the following:
 Test activities are determined and test data selected.
 The test is conducted and test results are compared with the expected results.

TESTING METHODS:
Testing is a process of executing a program to find out errors. If testing is conducted
successfully, it will uncover all the errors in the software.

Any testing can be done basing on two ways:


 White Box Testing
 Black Box Testing

White Box Testing:


It is a test case design method that uses the control structures of the procedural design to
derive test cases.
Using this testing a software Engineer can derive the following test cases:
 Exercise all the logical decisions on either true or false sides.
 Execute all loops at their boundaries and within their operational boundaries.
 Exercise the internal data structures to assure their validity.
Black Box Testing:
It is a test case design method used on the functional requirements of the software. It will help a
software engineer to derive sets of input conditions that will exercise all the functional
requirements of the program.
Black Box testing attempts to find errors in the following categories:
 Incorrect or missing functions
 Interface errors
 Errors in data structures
 Performance errors
 Initialization and termination errors

By black box testing we derive a set of test cases that satisfy the following criteria:
 Test cases that reduce by a count that is greater than one
 The number of additional test cases that must be designed to achieve reasonable testing.
TESTING PLANS:
Testing can be done in two ways:
 Bottom up approach
 Top down approach

4.2 SYSTEM IMPLEMENTATION


System implementation is the important stage of project when the theoretical design is tunes
into practical system. The main stages in the implementation are as follows:
● Planning
● Training
● System testing and
● Changeover planning
Planning is the first task in the system implementation. Planning is deciding on the method
and the time scale to be adapted. At the time of implementation of any system people from
different departments and system analysis involve. They are confirmed to practical problem of
controlling various activities of people outside their own data processing departments.
The line manager controlled through an implementation co-ordinate committee. The
committee consists of idea, problems and complaints of user department. It must also be
consider,
● The implementation of system environment.
● Self-selection and allocation for implementation tasks.
● Consultation with unions and resources available.
● Standby facilities and channels of communication.
CONCLUSION
While developing the system a conscious effort has been made to create and develop a
software package, making use of available tools, techniques and resources - that would generate a
proper system.
While making the system, an eye has been kept on making it as user-friendly, as cost-
effective and as flexible as possible. As such one may hope that the system will be acceptable to
any user and will adequately meet his or her needs.
As in case of any system development processes where there are a number of
shortcomings, there have been some shortcomings in the development of this system also. The
project is still under modification.
BIBLIOGRAPHY

BOOK REFERENCES
 Doyle, Matt. Beginning PHP 5.3 (Wrox Programmer to Programmer), 2009.
 Lerdorf, Rasmus. PHP Pocket Reference, O'Reilly, 2000.
 Nixon, Robin. Learning PHP, MySQL, JavaScript, and CSS: A Step-by-Step Guide
to Creating Dynamic Websites, O'Reilly, 2012.
 Nixon, Robin. Robin Nixon's PHP Crash Course: Learn PHP in 14 easy lectures,
O'Reilly, 2012.
 Ullman, Larry. PHP Advanced and Object-Oriented Programming: Visual QuickPro
Guide (3rd Edition), 2012.
 Ullman, Larry. PHP for the Web: Visual QuickStart Guide, 2011.
 Welling, Luke and Thomson, Laura. PHP and MySQL Web Development, Third
Edition, Sams, 2008.
WEBSITE REFERENCES
● www.codecademy.com/learn/PHP
● www.tutorialspoint.com/PHP
● www.learnonline.com
● www.w3.school.com

APPENDICES:
Database Design:
Table name: Login Table

Field name Data type Size Constraints Description

login_id Text 15 Primary key User ID

login_username Varchar 15 Not null Username

Log_password Varchar 15 Not null password

Table name: Customer Table

Field name Data type Size Constraints Description

User_id Number 6 Primary key userid

User_name Varchar 20 Not null name

User_address Varchar 15 Not null address

User_mobile Varchar 15 Not null mobile

User_email Number 8 Not null Email id

User_password Varchar 15 Not null Password

Table name: product table

Field name Data type Size Constraints Description

Pro_id Number 6 Primary key Product id

Product_name Varchar 20 Not null Product name


Pro_desc Varchar 15 Not null Product description

Pro_items Varchar 15 Not null Product items

Pro_cattype Number 8 Not null Product cateogorytype

Pro_catid Varchar 15 Not null Productcategoryid

Product date Varchar 15 Not null Productmanufcture date

Table name: shopping table

Field name Data type Size Constraints Description

shp_id Number 6 Primary key Shop id

Shp_name Varchar 20 Not null Shop name

shp _desc Varchar 15 Not null Shop description

shp_items Varchar 15 Not null Shop items

shp_type Number 8 Not null Shop type

shp_date Varchar 15 Not null Shop date

Table name: order table

Field name Data type Size Constraints Description

ord_id Number 6 Primary key order id

ord _desc Varchar 15 Not null order description

ord _type Number 8 Not null order type

ord _date Varchar 15 Not null order date

Table name: Stocks table

Field name Data type Size Constraints Description


stock_id Number 6 Primary key Stock id

stock _desc Varchar 20 Not null Stock description

Stockqty Varchar 15 Not null Stock quantity

Table name: Payment table

Field name Data type Size Constraints Description

pay_id Number 6 Primary key Payment id

pay _amt Varchar 20 Not null Payment amount

pay _desc Varchar 15 Not null Payment description

pay _items Varchar 15 Not null Pay_ items

pay _type Number 8 Not null Payment type

pay _date Varchar 15 Not null Payment date

B.SOURCE CODE:
<?php
session_start();
if ($_SESSION['first_name'] === null || $_SESSION['last_name'] === null ||
$_SESSION['email'] === null) {
header("Location: ../login_and_register/index.php");
}

$db = new mysqli('localhost', 'root', '', 'esas')


or die("Error connecting to database!");

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['email'])) {
$_id = $_POST['_id'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$position = $_POST['position'];

if (isset($_POST['available'])) {
$available = true;
} else {
$available = false;
}

switch ($position) {
case 'professor':
$noa = 1;
break;
case 'associateProfessor':
$noa = 2;
break;
case 'assistantProfessor':
$noa = 4;
break;
case 'lecturer':
$noa = 6;
break;
default:
$noa = 0;
break;
}

$sql = "UPDATE staff SET "


."firstname = '$firstname', "
."lastname = '$lastname', "
."email = '$email', "
."position = '$position', "
."noa = '$noa', "
."available = '$available' "
."WHERE _id = '$_id'";

if ($db->query($sql)) {
header("Location: viewStaff.php");
} else {
$sql = "SELECT * from staff where _id = '$_id'";
$res = $db->query($sql);
$row = $res->fetch_assoc();
}
} else {
$_id = $_POST['update_id'];
$sql = "SELECT * from staff where _id = '$_id'";
$res = $db->query($sql);
$row = $res->fetch_assoc();
}
}

?>

<!DOCTYPE html>
<html>
<head>
<title>VES-ESAS</title>
<link rel="stylesheet" type="text/css" href="addStaff.css" />
<link href="https://fonts.googleapis.com/css?
family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
<script type="text/javascript" src="addStaff.js"></script>
</head>
<body>

<!-- header component -->


<div class="gen_header">

<div class="header_img">
<img src="../login_and_register/ves-logo.png" />
</div>

<div class="header_title">
<a href="../home/index.php">VESIT - ESAS</a>
<hr>
<div class="header_subtitle">VESIT Examination Staff Allotment System</div>
<div class="header_info">Welcome <?php echo $_SESSION['first_name']." ".
$_SESSION['last_name']."!"; ?></div>
</div>

<div class="logout">
<button onclick="location.href='../login_and_register/logout.php'">LOGOUT</button>
</div>

</div>
<div class="home_navigator">
<div class="link"><a href="viewStaff.php">🡨 Go Back</a></div>
</div>

<!-- content body -->


<div class="container_body">
<div class="container">

<div class="exam_form_header">
<div class="title">Update Staff Member!</div>
<div class="subtitle">Update staff member details: </div>
</div>

<div class="exam_form">

<div class="form_content" style="padding-left: 50px;">

<form method="POST" name="staffForm" action="updateStaff.php" onsubmit="return


validateRegisterForm();">

<input type="hidden" name="_id" value='<?php echo $row['_id'] ?>' placeholder="ID" />

<div class="form_title">First Name*: </div>


<input type="text" name="firstname" value='<?php echo $row['firstname'] ?>'
placeholder="First Name" />

<div class="form_title">Last Name*: </div>


<input type="text" name="lastname" value='<?php echo $row['lastname'] ?>' placeholder="Last
Name" />

<div class="form_title">E-mail*: </div>


<input type="text" name="email" value='<?php echo $row['email'] ?>' placeholder="E-mail" />

<div class="form_title">Position*: </div>


<div class="styled-select slate">
<select name="position">
<?php
if ($row['position'] == 'professor') {
echo '<option value="professor" selected>Professor</option>';
} else {
echo '<option value="professor">Professor</option>';
}

if ($row['position'] == 'associateProfessor') {
echo '<option value="associateProfessor" selected>Associate Professor</option>';
} else {
echo '<option value="associateProfessor">Associate Professor</option>';
}

if ($row['position'] == 'assistantProfessor') {
echo '<option value="assistantProfessor" selected>Assistant Professor</option>';
} else {
echo '<option value="assistantProfessor">Assistant Professor</option>';
}

if ($row['position'] == 'lecturer') {
echo '<option value="lecturer" selected>Lecturer</option>';
} else {
echo '<option value="lecturer">Lecturer</option>';
}
?>
</select>
</div>

<div>
<div class="form_title">Available: </div>
<div style="height: 15px;"><input type="checkbox" name="available" value="yes"
<?php if ($row['available']) {echo "checked";} ?>></div>
</div>
<br />

<div class="update_button">
<button type="submit">UPDATE</button>
</div>

</form>

</div>

</div>

</div>
</div>

</body>
</html>

<?php
session_start();
if ($_SESSION['first_name'] === null || $_SESSION['last_name'] === null ||
$_SESSION['email'] === null) {
header("Location: ../login_and_register/index.php");
}

$db = new mysqli('localhost', 'root', '', 'esas')


or die("Error connecting to database!");

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['delete'])) {
if ($_POST['delete'] == 'yes') {
$_id = $_POST['_id'];
$sql = "DELETE FROM staff WHERE _id = '$_id'";
if ($db->query($sql)) {
header("Location: viewStaff.php");
}
} else {
header("Location: viewStaff.php");
}

} else {
$_id = $_POST['delete_id'];
$sql = "SELECT * from staff where _id = '$_id'";
$res = $db->query($sql);
$row = $res->fetch_assoc();

}
} else {
$_id = $_POST['delete_id'];
$sql = "SELECT * from staff where _id = '$_id'";
$res = $db->query($sql);
$row = $res->fetch_assoc();
}
?>

<div class="gen_header">

<div class="header_img">
<img src="../login_and_register/ves-logo.png" />
</div>

<div class="header_title">
<a href="../home/index.php">VESIT - ESAS</a>
<hr>
<div class="header_subtitle">VESIT Examination Staff Allotment System</div>
<div class="header_info">Welcome <?php echo $_SESSION['first_name']." ".
$_SESSION['last_name']."!"; ?></div>
</div>

<div class="logout">
<button onclick="location.href='../login_and_register/logout.php'">LOGOUT</button>
</div>

</div>
<div class="home_navigator">
<div class="link"><a href="viewStaff.php">🡨 Go Back</a></div>
</div>

<!-- content body -->


<div class="container_body">
<div class="container">

<div class="exam_form_header">
<div class="title">Delete Staff Member!</div>
<div class="subtitle">Confirm your request: </div>
</div>

<div class="exam_form">

<div class="form_content" style="padding-left: 50px;">

<form method="POST" action="deleteStaff.php">


<div class="delete_confirmation">
Are you sure you want to delete the following Staff Member?
</div>

<div class="delete_details">

<input type="hidden" name="_id" value='<?php echo $row['_id'] ?>' placeholder="ID" />

<div class="delete_title">First Name: <span class="info"><?php echo $row['firstname'] ?


></span></div>

<div class="delete_title">Last Name: <span class="info"><?php echo $row['lastname'] ?


></span></div>

<div class="delete_title">E-mail: <span class="info"><?php echo $row['email'] ?


></span></div>

<div class="delete_title">Position: <span class="info">


<?php
switch ($row['position']) {
case 'professor':
echo "Professor";
break;
case 'associateProfessor':
echo "Associate Professor";
break;
case 'assistantProfessor':
echo "Assistant Professor";
break;
case 'lecturer':
echo "Lecturer";
break;
default:
echo "Not Assigned";
break;
}
?>
</span></div>
<div class="delete_title">Available for: <span class="info"><?php echo $row['noa']." times" ?
></span></div>

<div class="delete_title">Is Available: <span class="info"><?php if($row['available']) { echo


"Yes"; } else { echo "No"; } ?></span></div>

</div>

<div class="delete_yes">
<button type="submit" name="delete" value="yes">YES</button>
</div>

<div class="delete_no">
<button type="submit" name="delete" value="no">NO</button>
</div>

</form>

</div>

</div>

</div>
</div>

</body>
</html>
<?php
session_start();
if ($_SESSION['first_name'] === null || $_SESSION['last_name'] === null ||
$_SESSION['email'] === null) {
header("Location: ../login_and_register/index.php");
}
$_SESSION['message'] = 'Please enter your details!';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['email'])) {

$db = new mysqli('localhost', 'root', '', 'esas')


or die("Error connecting to database!");
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$position = $_POST['position'];

if (isset($_POST['available'])) {
$available = true;
} else {
$available = false;
}

switch ($position) {
case 'professor':
$noa = 1;
break;
case 'associateProfessor':
$noa = 2;
break;
case 'assistantProfessor':
$noa = 4;
break;
case 'lecturer':
$noa = 6;
break;
default:
$noa = 0;
break;
}

$sql = "INSERT INTO staff (firstname, lastname, email, position, noa, available)"
."VALUES ('$firstname', '$lastname', '$email', '$position', '$noa', '$available')";

if ($db->query($sql) === true) {


$_SESSION['message'] = "User added successfully!";
} else {
$_SESSION['message'] = "Error adding user to the database!";
}

} else {
$_SESSION['message'] = "Error: Fields not set!";
}
}
?>

<!DOCTYPE html>
<html>

<head>
<title>ESAS</title>
<link rel="stylesheet" type="text/css" href="addStaff.css" />
<link href="https://fonts.googleapis.com/css?
family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
<script type="text/javascript" src="addStaff.js"></script>
</head>

<body>

<!-- header component -->


<div class="gen_header">

<div class="header_img">
<img src="../login_and_register/ves-logo.png" />
</div>

<div class="header_title">
<a href="../home/index.php">VESIT - ESAS</a>
<hr>
<div class="header_subtitle">VESIT Examination Staff Allotment System</div>
<div class="header_info">Welcome <?php echo $_SESSION['first_name']." ".
$_SESSION['last_name']."!"; ?></div>
</div>

<div class="logout">
<button onclick="location.href='../login_and_register/logout.php'">LOGOUT</button>
</div>

</div>
<div class="home_navigator">
<div class="link"><a href="../home/index.php">🡨 Go Back</a></div>
</div>
<!-- content body -->
<div class="container_body">

<div class="container">

<table width="100%">

<tr>

<td>
<div class="exam_form_header">
<div class="title">Add Staff Member!</div>
<div class="subtitle">Enter staff member details: </div>
</div>
</td>

<td>
<div class="staff_list_header">
<div class="title">Staff Member List</div>
<div class="subtitle"><a href="addStaff.php">Refresh</a></div>
</div>
</td>

</tr>

<tr>

<td width="40%">

<div class="exam_form">

<div class="form_content">

<form method="POST" name="staffForm" action="addStaff.php" onsubmit="return


validateRegisterForm();">
<div class="form_title">First Name*: </div>
<input type="text" name="firstname" placeholder="First Name" />

<div class="form_title">Last Name*: </div>


<input type="text" name="lastname" placeholder="Last Name" />
<div class="form_title">E-mail*: </div>
<input type="text" name="email" placeholder="E-mail" />

<div class="form_title">Position*: </div>


<div class="styled-select slate">
<select name="position">
<option value="professor">Professor</option>
<option value="associateProfessor">Associate Professor</option>
<option value="assistantProfessor">Assistant Professor</option>
<option value="lecturer">Lecturer</option>
</select>
</div>

<div>
<div class="form_title">Available: </div>
<div style="height: 15px;"><input type="checkbox" name="available" value="yes"></div>
</div>
<br />
<div class="submit">
<button type="submit">Submit</button>
</div>

</form>

</div>

</div>

</td>

<td width="60%">

<div class="staff_list">

<table width="100%">

<tr>
<th>Sr. No.</th>
<th>First Name</th>
<th>Last Name</th>
<th>E-Mail</th>
<th>Position</th>
<th>Times Available</th>
<th>Available</th>
</tr>
<?php
$db = new mysqli('localhost', 'root', '', 'esas')
or die("Error connecting to database!");

$sql = "SELECT * from staff";

$results = $db->query($sql);

$i = 1;
while($row = $results->fetch_assoc()) {
?>

<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row['firstname']; ?></td>
<td><?php echo $row['lastname']; ?></td>
<td><?php echo $row['email']; ?></td>
<td>
<?php
switch ($row['position']) {
case 'professor':
echo "Professor";
break;
case 'associateProfessor':
echo "Associate Professor";
break;
case 'assistantProfessor':
echo "Assistant Professor";
break;
case 'lecturer':
echo "Lecturer";
break;
default:

<!DOCTYPE html>
<html>
<head>
<title>VES-ESAS</title>
<link rel="stylesheet" type="text/css" href="addStaff.css" />
<link href="https://fonts.googleapis.com/css?
family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
</head>
<body>

<!-- header component -->

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy