0% found this document useful (0 votes)
117 views

Leave Management System

The document describes an employee leave management system project that was developed using software engineering principles. The system provides an automated, paperless way to manage employee leave requests and related tasks. It has modules for employee information management, leave scheduling, monitoring work days and holidays, processing leave requests, and generating leave reports. The project documentation includes an introduction, literature review, methodology, and recommendations. UML diagrams like use case, class, sequence, and data flow diagrams were created to model the system functionality and architecture. The system was developed using front-end technologies like HTML, CSS, JavaScript and back-end technologies like PHP and MySQL.

Uploaded by

DHANUSH N
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views

Leave Management System

The document describes an employee leave management system project that was developed using software engineering principles. The system provides an automated, paperless way to manage employee leave requests and related tasks. It has modules for employee information management, leave scheduling, monitoring work days and holidays, processing leave requests, and generating leave reports. The project documentation includes an introduction, literature review, methodology, and recommendations. UML diagrams like use case, class, sequence, and data flow diagrams were created to model the system functionality and architecture. The system was developed using front-end technologies like HTML, CSS, JavaScript and back-end technologies like PHP and MySQL.

Uploaded by

DHANUSH N
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Employee Leave Management System

Name:
Project
The Employee leave management
system provides an automated,
speedier, error-free, requires less
paperwork, and is simple way to
Abstract:
manage employee’s leave. The system
was created utilizing a software
architecture approach to provide an
automated system.
Employee Information Management,
Employee Schedule Monitoring,
Modules: Monitor Working days and Holidays, set
leave processing and Generate leave
reports.
Introduction, RRL (Review of Related
Documentation: Literature), Methodology, Evaluation,
and Recommendations.
ER, Diagram, Use Case Diagram, Data
UML Diagrams: Flow Diagram, Class Diagram, Activity
Diagram, and Sequence Diagram.
Front end: HTML, CSS, JavaScript

Source Codes: Back end: PHP, MySQL


Employee Leave Management System –
Abstract:
Employee leave management systems project focuses on bringing together a
variety of processes and solving a couple of problems faced in employee
management. This project addresses the need for automation and simplification of
employee data, leave requests, and leave grant management.
Employees must plan their long leaves well in advance, and have a streamlined,
automated system in place to handle leaves and manage work situations in advance.
It demonstrates a strong work ethic and smoothens the work process. This is a
method of assisting your employees in achieving their full potential and achieving
your company’s objective.
As a result, an automated employee leave management system that is speedier,
error-free, requires less paperwork, and is simple to manage is deployed. The system
was created utilizing a software architecture approach to provide an automated
system.
Both the organization and its employees profit from an effective leave management
system. It makes it possible to plan ahead of time for an employee’s absence.
Employees can seek leave, view previous leave history, and the employer can review
and approve leave requests as well as track current leave through this project
Employee Leave Management System –
Modules:
• Employee Information Management: This module provides a consolidated
database for application tracking, employee demographics, compensation and
benefit options, time tracking, and more. It’s also the central location for all of
your personnel data, including the most up-to-date statistics on your
organization’s hiring and retention patterns.
• Employee Schedule Monitoring: Employee schedule monitoring entails the
use of a variety of workplace surveillance techniques to obtain information on
employees’ activities and whereabouts. Businesses keep tabs on employees in
order to boost efficiency and safeguard company assets.
• Monitor Working Days and Holidays: This is the practice of employers
watching over their employees’ activities in the workplace and working days in
order to ensure that they are productive. It will also help them to be aware
when should their customer be active or take a break.
• Set Leave Processing: Employee leave request, approval, and monitoring will
be aided by leave management in an organization’s administrative processes
and controls. With the help of this module, this task would be much lighter
and manageable for the admin.
• Generate Leave Reports: It’s useful for keeping track and securing the leave
information of the employees. This can also can assist in problem solving and
avoid conflicts. Generating these reports will assist the admin in updating
details regarding important information
Employee Leave Management System –
Documentation:
The employee management system project documentation contains all the
information and guideline for its development. This project documentation presents
chapters 1 to 5 containing the employee management system introduction, RRL,
methodology, and others. It provides the PDF file afterward to let you view what is
the actual documentation of the employee leave management system project.
Employee Management System ER
Diagram:
The employee management system ER Diagram is the model used to emphasize the
system’s “database design”. It gives a deep understanding of the employee
management system database (back end) and its tables. This also guides in managing
the “Employee database” as well as the relationships of tables in it.
Employee Management System Use Case
Diagram

The “employee management system use case diagram”/ is a visual representation of


how a user might interact with the employee system. It depicts the system’s
numerous use cases and different sorts of users. This diagram also determines the
possible features to identify the flow of the employee system.
Employee Management System Sequence
Diagram
The employee management system sequence diagram contains the sequence of
activities that happens when managing employees. This diagram also explains the
structure and the behavior of the Employee Management System.
Data Flow Diagram for Employee
Management System
The “Data Flow Diagram (DFD) for employee management system” represents the
flow of data and its transformation within the employee system. It carries out one of
the preparatory steps when developing the employee management system in form
of DFD levels 0, 1, and 2. Each of these levels elaborates the flow of data that enters
and exits the project.

The Level 0 DFD for Employee Management System (known as context diagram)
represents the abstract view of the project. It possess the single process and external
parties that depict the overall structure as a whole.
The Level 1 DFD for Employee Management System provides a broader overview of
the context diagram. It widens the processes from the context diagram and
determines the sub-processes that complete the employee management system.
The DFD level 2 for Employee Management System tells the ideas on where does
the data inputs goes and inputs come within the project. It shows not only the
detailed processes of the system but also gives you the precise destination of the
data that flows in it.
Employee Leave Management System
Source Codes
index:
<html>

<head>

<title>::Leave Management: :</title>

<link rel="stylesheet" href="style.css">

<style>

footer {

width:100%;

background-color : #cecece;

position: fixed;

bottom: 0;

font-family: "Segoe UI Light","Segoe WPC","Segoe UI",

Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

font-size: 17px;

font-style: normal;

font-variant: normal;

font-weight: 500;

height : 30px;

text-align: center;

box-shadow: 0px 1px 50px #5E5E5E;

</style>

</head>

<body>

<center>

<div class="heading"><h1>Leave Management System</h1></div>


<?php include 'navi.php';?>

<div class="heading"><h2>Welcome !</h2>

<p>A Small Leave Management System, fully created in php</p>

<p> A Project By dhanush.N </p>

</center>

</

</body>

</html>
Source code of admin:
adminnani
<!DOCTYPE html>

<html>

<head>

<style>

ul {

list-style-type: none;

margin: 0;

padding: 0;

overflow: hidden;

background-color: #f0f0f0;

font-family: "Segoe UI Light","Segoe WPC","Segoe UI",

Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

font-size: 17px;

font-style: normal;

font-variant: normal;

font-weight: 500;

color: #000000;

}
li {

float: left;

font-family: "Segoe UI Light","Segoe WPC","Segoe UI",

Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

font-size: 17px;

font-style: normal;

font-variant: normal;

font-weight: 500;

li a, .dropbtn {

display: inline-block;

color: white;

text-align: center;

padding: 14px 16px;

text-decoration: none;

font-family: "Segoe UI Light","Segoe WPC","Segoe UI",

Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

font-size: 17px;

font-style: normal;

font-variant: normal;

font-weight: 500;

color : #000000;

}
li a:hover, .dropdown:hover .dropbtn {

background-color: #949494;

li.dropdown {

display: inline-block;

.dropdown-content {

display: none;

position: absolute;

background-color: #f0f0f0;

min-width: 160px;

font-family: "Segoe UI Light","Segoe WPC","Segoe UI",

Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

font-size: 17px;

font-style: normal;

font-variant: normal;

font-weight: 500;

box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);

color: #000000;

.dropdown-content a {

color: #fefefe;

padding: 12px 16px;


text-decoration: none;

display: block;

text-align: left;

font-family: "Segoe UI Light","Segoe WPC","Segoe UI",

Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

font-size: 17px;

font-style: normal;

font-variant: normal;

font-weight: 500;

color: #000000;

.dropdown-content a:hover {background-color: #949494;}

.dropdown:hover .dropdown-content {

display: block;

</style>

</head>

<body>

<ul>

<li><a href="index.php">Admin Home</a></li>

<li class="dropdown">
<a href="#" class="dropbtn">Admin Tools</a>

<div class="dropdown-content">

<a href = "register">Register A New Employee</a>

<a href="searchemp.php">Remove An Employee</a>

<a href = "view_leaves.php">Accept/Reject Leave</a>

<a href = "set_leaves.php">Set Default Leave</a>

<a href = "extract_leaves.php">Extract Leaves</a>

</div>

</li>

<li><a href = "logout.php">Logout</a></li>

</ul>

</body>

</html>

Connect:

<?php

$servername = "localhost";

$username = "root";

$password = "";

$dbname = "phpdb";

// Create connection

$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection

if ($conn->connect_error) {
die("Connection failed ");

?>

Accept leave:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>

<?php

session_start();

?>

<html>

<head>

<title>::Leave Management::</title>

</head>

<body>

<link rel = "stylesheet" href = "style.css">

<div class = "textview">

<?php

echo "<h1>Leave Management System</h1>";

include 'adminnavi.php';
include 'connect.php';

include 'mailer.php';

if(filter_var($_GET['id'],FILTER_VALIDATE_INT) &&
filter_var($_GET['empid'],FILTER_VALIDATE_INT))

$id =$_GET['id'];

$empid =$_GET['empid'];

else

header('location:home.php');

if(isset($_SESSION['adminuser']))

$sql = "SELECT
id,EmpName,LeaveType,RequestDate,Status,LeaveDays,StartDate,EndDate FROM
emp_leaves WHERE id='".$id."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

$leavedays = $row["LeaveDays"];

$sql2 = "SELECT id,EarnLeave,SickLeave,CasualLeave,EmpEmail FROM


employees WHERE id = '".$empid."'";
$result2 = $conn->query($sql2);

if($result2->num_rows > 0)

while($row2 = $result2->fetch_assoc())

$earnleave = $row2["EarnLeave"];

$diff1 = $earnleave-$leavedays;

$sickleave = $row2["SickLeave"];

$diff2 = $sickleave-$leavedays;

$casualleave = $row2["CasualLeave"];

$diff3 = $casualleave-$leavedays;

$email = $row2["EmpEmail"];

if($row["LeaveType"] == "Earn Leave")

if($diff1 < 0)

echo "Processing Error !";

else

$sql3 = "UPDATE employees SET EarnLeave =


'".$diff1."' WHERE id = '".$empid."'";

else if($row["LeaveType"] == "Sick Leave")

if($diff2 < 0)

echo "Processing Error !";


else

$sql3 = "UPDATE employees SET SickLeave =


'".$diff2."' WHERE id = '".$empid."'";

else if($row["LeaveType"] == "Casual Leave")

if($diff3 < 0)

echo "Processing Error !";

else

$sql3 = "UPDATE employees SET CasualLeave =


'".$diff3."' WHERE id = '".$empid."'";

if($conn->query($sql3) === TRUE)

$sql4 = "UPDATE emp_leaves SET Status = 'Granted'


WHERE id = '".$id."'";

if($conn->query($sql4) === TRUE)

$msg = "Your Leave Has Been Granted Successfully


! \nEmployee Name : ".$row['EmpName']."\nLeave Type : ".$row['LeaveType']."\nNo.
Of Leave Days : ".$row['LeaveDays']."\nStarting Date : ".$row['StartDate']."\nEnd
date : ".$row['EndDate']."\n\n\nThanks,\nwebadmin, Leave Management System";

$status = mailer($email,$msg);

if($status === TRUE)

echo "The Leave Request Status mail For


".$row['EmpName']." Has been sent to his/her registered email address !<br/>";
}

else

header('location:index.php?err='.urlencode('Please Login First To


Access This Page !'));

?>

</div>

</body>

</html>
Extract Leave:
<?php

session_start();

echo "<div class = 'textview'>";

error_reporting(0);

require_once ('dompdf_config.inc.php');

include 'connect.php';

if(isset($_SESSION['adminuser']))

echo "<h1>Leave Management System</h1>";

include 'adminnavi.php';

echo "<h2>Extracted Data</h2>";

$startdate = strip_tags(trim($_POST['yearstart']))."-
".strip_tags(trim($_POST['monthstart']))."-
".strip_tags(trim($_POST['datestart']));

$enddate = strip_tags(trim($_POST['yearend']))."-
".strip_tags(trim($_POST['monthend']))."-".strip_tags(trim($_POST['dateend']));
$sql = "SELECT * FROM emp_leaves WHERE (StartDate >= '".$startdate."' AND
EndDate <= '".$enddate."') OR (EndDate >= '".$enddate."' AND StartDate <=
'".$startdate."') AND Dept = '".$_SESSION['dept']."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

echo "<table>

<tr>

<th>Employee Name</th>

<th>Leave Type</th>

<th>Request Date</th>

<th>Leave Days</th>

<th>Status</th>

<th>Starting Date</th>

<th>Ending Date</th>

<th>Department</th>

";

$pdf_content = "<h1>Data Extraction For user :


".$_SESSION['adminuser']."</h1>

<table>

<tr>

<th>Employee Name</th>

<th>Leave Type</th>

<th>Request Date</th>

<th>Leave Days</th>

<th>Status</th>

<th>Starting Date</th>

<th>Ending Date</th>
<th>Department</th>

";

while($row = $result->fetch_assoc())

echo "<tr>

<td>".$row['EmpName']."</td>

<td>".$row['LeaveType']."</td>

<td>".$row['RequestDate']."</td>

<td>".$row['LeaveDays']."</td>

<td>".$row['Status']."</td>

<td>".$row['StartDate']."</td>

<td>".$row['EndDate']."</td>

<td>".$row['Dept']."</td>

</tr>";

$pdf_content .= "<tr>

<td>".$row['EmpName']."</td>

<td>".$row['LeaveType']."</td>

<td>".$row['RequestDate']."</td>

<td>".$row['LeaveDays']."</td>

<td>".$row['Status']."</td>

<td>".$row['StartDate']."</td>

<td>".$row['EndDate']."</td>

<td>".$row['Dept']."</td>

</tr>";

}
$name = $_SESSION['adminuser'].$_SESSION['dept'].strtotime('now').'.pdf';

$reportPDF = createPDF($pdf_content, $name);

echo "</table>";

echo "<a href = 'data-extract/".$name."'>Download The Extracted Data


(PDF)</a>";

else

echo "0 Results !";

else

header('location:index.php?msg='.urlencode('Please Login First To Access This


Page!'));

function createPDF($pdf_content, $filename){

$path='data-extract/';

$dompdf=new DOMPDF();

$dompdf->load_html($pdf_content);

$dompdf->render();

$output = $dompdf->output();

file_put_contents($path.$filename, $output);

return $filename;

echo "</div>";

?>
<title>::Leave Management::</title>

<link rel = "stylesheet" href = "style.css">

<link rel = "stylesheet" href = "table.css">

Employee Delete :

<link rel="shortcut icon" type="image/png" href="favicon.png"/>

<?php

session_start();

?>

<title>: :Leave Management: :</title>

<?php

include 'connect.php';

echo "<h1>Leave Management System</h1>";

include 'adminnavi.php';

if(isset($_SESSION['adminuser']))

if(filter_var($_GET['id'],FILTER_VALIDATE_INT))
{

$id = $_GET['id'];

else

header('location:home.php');

$user = filter_var($_GET['user'],FILTER_SANITIZE_STRING);

$file = "../client/pro-pic/".$user.".jpg";

if(file_exists($file))

unlink($file);

else

{}

$sql = "DELETE FROM employees WHERE id='".$id."'";

echo "<center>";

if ($conn->query($sql) === TRUE)

header('location:home.php?msg='.urlencode('Employee Successfully Removed


!'));

else

header('location:home.php?msg='.urlencode('Error Removing Employee !'));

$conn->close();

else
{

header('location:index.php?err='.urlencode('Please login first to access this


page !'));

?>

Logout:
<?php

session_start();

session_unset();

session_destroy();

header('location:index.php?err='.URL encode('You Have Logged out succesfully'));

?>
Reject Leave:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>

<?php

session_start();

?>

<html>

<head>

<title>::Leave Management::</title>

</head>

<body>

<link rel = "stylesheet" href = "style.css">

<div class = "textview">

<?php

echo "<h1>Leave Management System</h1>";

include 'adminnavi.php';
include 'connect.php';

include 'mailer.php';

if(filter_var($_GET['id'],FILTER_VALIDATE_INT) &&
filter_var($_GET['empid'],FILTER_VALIDATE_INT))

$id =$_GET['id'];

$empid =$_GET['empid'];

else

header('location:home.php');

if(isset($_SESSION['adminuser']))

$sql = "SELECT * FROM emp_leaves WHERE id='".$id."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

$sql2 = "SELECT id,EmpEmail FROM employees WHERE id =


'".$empid."'";

$result2 = $conn->query($sql2);

if($result2->num_rows > 0)

while($row2 = $result2->fetch_assoc())

{
$email = $row2['EmpEmail'];

$sql3 = "UPDATE emp_leaves SET Status = 'Rejected'


WHERE id = '".$id."'";

if($conn->query($sql3) === TRUE)

$msg = "Your Leave Has Been Rejected !


\nEmployee Name : ".$row['EmpName']."\nLeave Type : ".$row['LeaveType']."\nNo. Of
Leave Days : ".$row['LeaveDays']."\nStarting Date : ".$row['StartDate']."\nEnd
date : ".$row['EndDate']."\n\n\nThanks,\nwebadmin, Leave Management System";

$status = mailer($email,$msg);

if($status === TRUE)

echo "The Leave Request Status Mail For


".$row['EmpName']." Has been sent to his/her registered email address !<br/>";

else

header('location:index.php?err='.urlencode('Please Login First To Access This


Page !'));

?>

</div>

</body>

</html>
Search Employee:
<link rel="shortcut icon" type="image/png" href="favicon.png"/>

<?php

session_start();

?>

<html>

<head>

<title>::Leave Management::</title>

<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

<?php
echo "<div class = 'textview'>";

echo "<h1>Leave Management System</h1>";

include 'adminnavi.php';

if(isset($_SESSION['adminuser']))

echo "<div class = 'textview'>";

echo "<center>";

echo "<h2>Search for the employee to be deleted</h2>";

echo "<table>";

echo "<form method = 'post' action = 'search.php'>";

echo "<tr><td><input type = 'text' name = 'name' class = 'textbox shadow


selected'></td><td><input type = 'submit' name = 'submit' value = 'Search' class
= 'login-button shadow'></td></tr>";

echo "</form>";

echo "</table>";

echo "</center>";

echo "</div>";

else

header('location:index.php?err='.urlencode('Please login first to access


this page !'));

?>

</body>

</html>
View Leave:
<?php

session_start();

?>

<title>::Leave Management::</title>

<link rel="stylesheet" type="text/css" href="style.css">

<link rel="shortcut icon" type="image/png" href="favicon.png"/>

<link rel="stylesheet" type="text/css" href="table.css">

<div class = "textview">

<center>

<?php
include 'connect.php';

echo "<h1>Leave Management System</h1>";

include 'adminnavi.php';

echo "<h2>View Employees' Leaves</h2>";

$count = 0;

if(isset($_SESSION['adminuser']))

$sql = "SELECT Dept, username FROM admins WHERE username =


'".$_SESSION['adminuser']."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

if($_SESSION['adminuser'] == $row['username'])

$sql2 = "SELECT
e.Id,e.Dept,e.EmpName,el.EmpName,el.LeaveType,el.RequestDate,el.LeaveDays,el.Star
tDate,el.EndDate,el.id,el.Dept FROM employees e, emp_leaves el WHERE e.Dept =
el.Dept AND e.Dept = '".$row['Dept']."' AND el.Status = 'Requested' AND e.EmpName
= el.EmpName";

$result2 = $conn->query($sql2);

if($result2->num_rows > 0)

echo "<table>";

echo "<tr>";

echo "<th>Employee Name</th>";

echo "<th>Leave Type</th>";


echo "<th>Request Date</th>";

echo "<th>Leave Days</th>";

echo "<th>Starting Date</th>";

echo "<th>Ending Date</th>";

echo "<th>Action</th>";

echo "</tr>";

while ($row2 = $result2->fetch_assoc())

echo "<tr>";

echo "<td>";

echo $row2['EmpName'];

echo "</td>";

echo "<td>";

echo $row2['LeaveType'];

echo "</td>";

echo "<td>";

echo $row2['RequestDate'];

echo "</td>";

echo "<td>";

echo $row2['LeaveDays'];

echo "</td>";

echo "<td>";

echo $row2['StartDate'];

echo "</td>";

echo "<td>";

echo $row2['EndDate'];

echo "</td>";
echo "<td><a href =
'acceptleave.php?id=".$row2['id']."&empid=".$row2["Id"]."'>Accept</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href =
'rejectleave.php?id=".$row2['id']."&empid=".$row2["Id"]."'>Reject</a></td>";

echo "</tr>";

$count++;

echo $count." Leave(s)";

echo "</table>";

else

header("location:index.php?err=".urlencode('Please login first to


view this page !'));

else

header('location:index.php?err='.urlencode('Please login first to view this


page !'));

?>

</div>
</center>

SOURCE CODE OF CLIENT:

Leave request:

<?php

echo "<link rel = 'stylesheet' href= 'style.css'>";

echo "<link rel = 'stylesheet' href= 'table.css'>";


echo "<center>";

echo "<div class = 'textview'>";

include 'connect.php';

echo "<h1>Leave Management System</h1>";

include 'clientnavi.php';

session_start();

if(isset($_SESSION['user']))

$user = $_SESSION['user'];

$sql = "SELECT * FROM employees WHERE UserName = '".$user."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

echo "<body>";

echo "<h2>Request For A Leave for : ".$_POST['type']."</h2>";

echo "<form action = 'request_confirm.php' method = 'post'>";

echo "<table>";

echo "<input type = 'hidden' name = 'empname' value =


'".$row["EmpName"]."'>";

echo "<input type = 'hidden' name = 'designation' value =


'".$row["Designation"]."'>";

echo "<input type = 'hidden' name = 'dept' value =


'".$row["Dept"]."'>";

echo "<input type = 'hidden' name = 'emptype' value =


'".$row["EmpType"]."'>";

echo "<input type = 'hidden' name = 'empfee' value =


'".$row["EmpFee"]."'>";
echo "<tr><th> * Starting Date : </th>

<td>

<select name = 'leavedate' class = 'textbox shadow selected'


style='width:50px;'>

<option value = '01'>1</option>

<option value = '02'>2</option>

<option value = '03'>3</option>

<option value = '04'>4</option>

<option value = '05'>5</option>

<option value = '06'>6</option>

<option value = '07'>7</option>

<option value = '08'>8</option>

<option value = '09'>9</option>

<option value = '10'>10</option>

<option value = '11'>11</option>

<option value = '12'>12</option>

<option value = '13'>13</option>

<option value = '14'>14</option>

<option value = '15'>15</option>

<option value = '16'>16</option>

<option value = '17'>17</option>

<option value = '18'>18</option>


<option value = '19'>19</option>

<option value = '20'>20</option>

<option value = '21'>21</option>

<option value = '22'>22</option>

<option value = '23'>23</option>

<option value = '24'>24</option>

<option value = '25'>25</option>

<option value = '26'>26</option>

<option value = '27'>27</option>

<option value = '28'>28</option>

<option value = '29'>29</option>

<option value = '30'>30</option>

<option value = '31'>31</option>

</select>

<select name = 'leavemonth' class = 'textbox shadow


selected'>

<option value = '01'>1</option>

<option value = '02'>2</option>

<option value = '03'>3</option>

<option value = '04'>4</option>

<option value = '05'>5</option>

<option value = '06'>6</option>

<option value = '07'>7</option>

<option value = '08'>8</option>

<option value = '09'>9</option>


<option value = '10'>10</option>

<option value = '11'>11</option>

<option value = '12'>12</option>

</select>

<select name = 'leaveyear' class = 'textbox shadow selected'>

<option value = '".date("Y")."'>".date("Y")."</option>

</select>

</td>

</tr>";

echo "<input type = 'hidden' name = 'leavetype' value =


'".$_POST['type']."'>";

echo "<tr><th> * No Of Leave Days : </th><td><input type = 'number'


min = '1' name = 'leavedays' class = 'textbox shadow selected' step =
'1'></td></tr>";

echo "<tr><th> * Resaon For Leave : </th><td><input type = 'text'


name = 'leavereason' class = 'textbox shadow selected'></td></tr>";

echo "<table>

<tr>

<th>Date </th>

<th>Time</th>

<th>Semester</th>

<th>Division/Batch</th>

<th>Room No.</th>

<th>Subject</th>

<th>Staff Member Who Will Engage Class</th>

</tr>

<tr>

<td><input type = 'text' name = 'value1' class = 'textbox


shadow selected' style='width:90px;'></td>
<td><input type='text' name = 'value2' class = 'textbox
shadow selected' style='width:100px;'></td>

<td><input type='number' min = '1' max = '8' step = '1' name


= 'value3' class = 'textbox shadow selected' style='width:40px;'></td>

<td><input type='text' name = 'value4' class = 'textbox


shadow selected' style='width:50px;'></td>

<td><input type='text' name = 'value5' class = 'textbox


shadow selected' style='width:100px;'></td>

<td><input type='text' name = 'value6' class = 'textbox


shadow selected' style='width:50px;'></td>

<td><input type='text' name = 'value7' class = 'textbox


shadow selected' style='width:50px;'></td>

</tr>

<tr>

<td><input type = 'text' name = 'value8' class = 'textbox


shadow selected' style='width:90px;'></td>

<td><input type='text' name = 'value9' class = 'textbox


shadow selected' style='width:100px;'></td>

<td><input type='number' min = '1' max = '8' step = '1' name


= 'value10' class = 'textbox shadow selected' style='width:40px;'></td>

<td><input type='text' name = 'value11' class = 'textbox


shadow selected' style='width:50px;'></td>

<td><input type='text' name = 'value12' class = 'textbox


shadow selected' style='width:100px;'></td>

<td><input type='text' name = 'value13' class = 'textbox


shadow selected' style='width:50px;'></td>

<td><input type='text' name = 'value14' class = 'textbox


shadow selected' style='width:50px;'></td>

</tr>

<tr>

<td><input type = 'text' name = 'value15' class = 'textbox


shadow selected' style='width:90px;'></td>

<td><input type='text' name = 'value16' class = 'textbox


shadow selected' style='width:100px;'></td>
<td><input type='number' min = '1' max = '8' step = '1' name
= 'value17' class = 'textbox shadow selected' style='width:40px;'></td>

<td><input type='text' name = 'value18' class = 'textbox


shadow selected' style='width:50px;'></td>

<td><input type='text' name = 'value19' class = 'textbox


shadow selected' style='width:100px;'></td>

<td><input type='text' name = 'value20' class = 'textbox


shadow selected' style='width:50px;'></td>

<td><input type='text' name = 'value21' class = 'textbox


shadow selected' style='width:50px;'></td>

</tr>

</font>

</table>";

echo "<br/><tr><td><input type = 'submit' value = 'Request a Leave'


class = 'login-button shadow'></td></tr>";

echo "</form>";

echo "</div>";

echo "</center>";

echo "</body>";

else

header('location:index.php?err='.urlencode('Please Login First To Access This


Site !'));

?>

<title>::Leave Management::</title>
<script type="text/javascript">

function noBack()

window.history.forward()

noBack();

window.onload = noBack;

window.onpageshow = function(evt) { if (evt.persisted) noBack() }

window.onunload = function() { void (0) }

</script>

Password:

<link rel = "stylesheet" type = "text/css" href = "style.css">

<?php

session_start();

include 'clientnavi.php';

include 'connect.php';

if(isset($_SESSION['user']))
{

$oldpass = $_POST['oldpass'];

$newpass = $_POST['newpass'];

$cnfnewpass = $_POST['cnfnewpass'];

$uname = $_SESSION['user'];

if($newpass == $cnfnewpass)

$sql = "SELECT id,UserName,EmpPass FROM employees";

if((strlen($newpass) >=10))

if($newpass != $_SESSION['user'])

$oldpass = hash_hmac('sha512', 'salt'.$oldpass, md5($uname));

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

if($uname == $row["UserName"])

$id = $row['id'];

if($oldpass == $row["EmpPass"])

$newpass = hash_hmac('sha512',
'salt'.$newpass, md5($uname));

$sql2 = "UPDATE employees SET


EmpPass='".$newpass."' WHERE id=".$id;

if($conn->query($sql2) === TRUE)

{
header("location:home.php?msg=".urlencode('Password Succesfully Changed !'));

else

header("location:changepass.php?err=".urlencode('Incorrect Old Password !'));

else

header('location:changepass.php?err='.urlencode('New
Password cannot be same as username !'));

else

header('location:changepass.php?err='.urlencode('New Password
must be atleast 10 characters long !'));

else

header("location:changepass.php?err=".urlencode('New Passwords Do Not


Match !'));

}
else

header('location:index.php?err='.urlencode('Please Login First To Access


This Page !'));

?>

Request leave:

<title>::Leave Management::</title>

<?php

session_start();

include 'connect.php';

if(isset($_SESSION['user']))

{
echo "<link rel='stylesheet' type='text/css' href='style.css'>";

echo "<center>";

echo "<div class = 'textview'>";

echo "<h1>Leave Management System</h1>";

include 'clientnavi.php';

echo "<h2>Please Select Your Leave Type</h2>";

if(isset($_GET['err']))

echo "<div class =


'error'><b><u>".htmlspecialchars($_GET['err'])."</u></b></div>";

echo "<form action = 'leaverequest.php' method = 'post'>";

$sql = "SELECT * FROM employees WHERE UserName = '".$_SESSION['user']."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

if($row['SickLeave'] > 0)

echo "<button type = 'submit' name = 'type' value = 'Sick


Leave' class = 'login-button shadow'>Sick Leave</button>";

else

echo "<button type = 'submit' name = 'type' value = 'Sick


Leave' class = 'error-button shadow' disabled>Sick Leave</button>";

if($row['EarnLeave'] > 0)

{
echo "<button type = 'submit' name = 'type' value = 'Earn
Leave' class = 'login-button shadow'>Earn Leave</button>";

else

echo "<button type = 'submit' name = 'type' value = 'Earn


Leave' class = 'error-button shadow' disabled>Earn Leave</button>";

if($row['CasualLeave'] > 0)

echo "<button type = 'submit' name = 'type' value = 'Casual


Leave' class = 'login-button shadow'>Casual Leave</button>";

else

echo "<button type = 'submit' name = 'type' value =


'Casual Leave' class = 'error-button shadow' disabled>Casual Leave</button>";

echo "</form>";

else

header('location:index.php?err='.urlencode('Please Login for Accessing


this page'));

}
?>

<script type="text/javascript">

function noBack()

window.history.forward()

noBack();

window.onload = noBack;

window.onpageshow = function(evt) { if (evt.persisted) noBack() }

window.onunload = function() { void (0) }

</script>

Update leave:

<?php

function update_leaves($user,$dept)

include 'connect.php';

$current_date = strtotime(date("Y-m-d"));
$sql2 = "SELECT SetSickLeave,SetCasualLeave,SetEarnLeave,Dept FROM admins
WHERE Dept = '".$dept."'";

if($conn->query($sql2) == TRUE)

$result2 = $conn->query($sql2);

if($result2->num_rows > 0)

while($row2 = $result2->fetch_assoc())

$setsickleave = $row2["SetSickLeave"];

$setearnleave = $row2["SetEarnLeave"];

$setcasualleave = $row2["SetCasualLeave"];

$sql = "SELECT * FROM employees WHERE UserName = '".$user."'";

$result = $conn->query($sql);

if($result->num_rows > 0)

while($row = $result->fetch_assoc())

if(strtotime($row["DateOfJoin"]) == strtotime('today'))

return false;

else if(strtotime($row["UpdateStatus"]) < strtotime('today'))

{
$date = $row["DateOfJoin"];

$day = date("d",strtotime($date));

$month = date("m",strtotime($date));

$year = date("Y");

$joining_date = $year."-".$month."-".$day;

$joining_date = strtotime($joining_date);

if($current_date == $joining_date)

$earnleave = $row["EarnLeave"] + $setearnleave;

if($earnleave >= 300)

$earnleave = 300;

$sickleave = $row["SickLeave"] + $setsickleave;

$casualleave = $setcasualleave;

$sql2 = "UPDATE employees SET EarnLeave =


'".$earnleave."',SickLeave = '".$sickleave."',CasualLeave =
'".$casualleave."',UpdateStatus = '".date("Y-m-d")."' WHERE id =
'".$row["id"]."'";

if($conn->query($sql2) == TRUE)

return true;

else

return false;

else if($row["UpdateStatus"] == "0000-00-00")


{

$date = $row["DateOfJoin"];

$day = date("d",strtotime($date));

$month = date("m",strtotime($date));

$year = date("Y");

$joining_date = $year."-".$month."-".$day;

$joining_date = strtotime($joining_date);

if($current_date == $joining_date)

$earnleave = $row["EarnLeave"] + $setearnleave;

if($earnleave >= 300)

$earnleave = 300;

$sickleave = $row["SickLeave"] + $setsickleave;

$casualleave = $setcasualleave;

$sql2 = "UPDATE employees SET EarnLeave =


'".$earnleave."',SickLeave = '".$sickleave."',CasualLeave =
'".$casualleave."',UpdateStatus = '".date("Y-m-d")."' WHERE id =
'".$row["id"]."'";

if($conn->query($sql2) == TRUE)

return true;

else

{
return false;

else

return false;

?>

You might also like