-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
126 lines (113 loc) · 5.52 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(isset($_POST['signin']))
{
$uname=$_POST['username'];
$password=md5($_POST['password']);
$sql ="SELECT EmpId,EmailId,Password,Status,RoleID,id,Department FROM employees WHERE EmailId=:uname and Password=:password";
$query= $dbh -> prepare($sql);
$query-> bindParam(':uname', $uname, PDO::PARAM_STR);
$query-> bindParam(':password', $password, PDO::PARAM_STR);
$query-> execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
if($query->rowCount() > 0)
{
foreach ($results as $result)
{
$status=$result->Status;
$_SESSION['eid']=$result->id;
$_SESSION['empid']=$result->EmpId;
$_SESSION['roleID'] = $result->RoleID;
$_SESSION['department'] = $result->Department;
}
if($status==0)
{
$msg="Your account is Inactive. Please contact admin";
}
else
{
switch($_SESSION['roleID'])
{
case 1:
echo "<script type='text/javascript'> document.location = 'admin/dashboard.php'; </script>";
$_SESSION['alogin']=$_POST['username'];
break;
case 2:
echo "<script type='text/javascript'> document.location = 'supervisor/dashboard.php'; </script>";
$_SESSION['superlogin']=$_POST['username'];
break;
case 3:
echo "<script type='text/javascript'> document.location = 'leavehistory.php'; </script>";
$_SESSION['emplogin']=$_POST['username'];
break;
}
}
}
else
{
echo "<script>alert('Incorrect Username and/ Password');</script>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Title -->
<title>Employee leave management system | Employee</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta charset="UTF-8">
<meta name="description" content="Responsive Admin Dashboard Template" />
<meta name="keywords" content="admin,dashboard" />
<meta name="author" content="Steelcoders" />
<!-- Styles -->
<link type="text/css" rel="stylesheet" href="assets/plugins/materialize/css/materialize.min.css"/>
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="assets/plugins/material-preloader/css/materialPreloader.min.css" rel="stylesheet">
<link href="assets/css/alpha.min.css" rel="stylesheet" type="text/css"/>
<link href="assets/css/custom.css" rel="stylesheet" type="text/css"/>
</head>
<body class="signin-page">
<div class="mn-content valign-wrapper">
<main class="mn-inner container">
<div class="valign">
<div class="row">
<div class="col s12 m6 l4 offset-l4 offset-m3">
<div class="card darken-1">
<div class="card-content ">
<span class="card-title"><img src="assets/images/softstartImage.png" alt="SIGN IN" style="width:100%"></span>
<div class="card-body">
<div class="row">
<form class="col s12" name="signin" method="post">
<div class="input-field col s12">
<input id="username" type="text" name="username" class="validate" autocomplete="on" required >
<label for="email">Username</label>
</div>
<div class="input-field col s12">
<input id="password" type="password" class="validate" name="password" autocomplete="on" required>
<label for="password">Password</label>
</div>
<a class="col s12 center-align" href="forgot-password.php">Forgot password?</a>
<div class="col s12 center-align m-t-sm">
<input type="submit" name="signin" value="Sign in" class="waves-effect waves-light btn orange">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="copyright center" style="color:grey"><a href="https://www.softstartbti.co.za">SoftstartBTI</a> © 2022</p>
</main>
</div>
<!-- Javascripts -->
<script src="assets/plugins/jquery/jquery-2.2.0.min.js"></script>
<script src="assets/plugins/materialize/js/materialize.min.js"></script>
<script src="assets/plugins/material-preloader/js/materialPreloader.min.js"></script>
<script src="assets/plugins/jquery-blockui/jquery.blockui.js"></script>
<script src="assets/js/alpha.min.js"></script>
</body>
</html>