-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
158 lines (127 loc) · 4.22 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
error_reporting(0);
$id = "";
$pass = "";
if(isset($_POST['e_id'])){
$id = $_POST["e_id"];
}
if(isset($_POST['pass'])){
$pass = $_POST["pass"];
}
$host = "localhost";
$dbUsername = "id11037018_admin";
$dbPassword = "admin";
$dbname = "id11037018_payroll";
$warning = '';
if(isset($_POST['login'])){
if(empty($id)){
$warning = "Enter your User ID!";
}
elseif(empty($pass)){
$warning = 'Enter your Password!';
}
else{
$conn = new mysqli($host, $dbUsername, $dbPassword, $dbname);
if (mysqli_connect_error()) {
die('Connect Error('. mysqli_connect_errno().')'. mysqli_connect_error());
}
elseif($id == "admin"){
$SELECT = "Select NAME, Password from admin where NAME = 'admin' AND Password = ?;";
$stmt = $conn->prepare($SELECT);
$stmt->bind_param("s", $pass);
$stmt->execute();
// $stmt->bind_result($pass);
$stmt->store_result();
if($stmt->fetch()){
header("Location: https://payrollmngsys.000webhostapp.com/admin.php");
}
else{
$warning = "Incorrect Admin Password!";
}
}
else {
$q = "Select E_ID, Password from employee where E_ID = $id AND Password = '$pass';";
$query = mysqli_query($conn,$q);
$res = mysqli_fetch_array($query);
if($res)
{
header("Location: https://payrollmngsys.000webhostapp.com/emp.php?a=".$id);
}
else{
$warning = "Invalid User ID or Password!";
}
}
$conn->close();
}
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<!--<meta property="fb:app_id" content="678323255833318" />-->
<meta property="og:title" content="Payroll" />
<!--<meta property="og:type" content="article" />-->
<meta property="og:url" content="http://payrollmngsys.000webhostapp.com/" />
<meta property="og:image" content="https://images.unsplash.com/photo-1567604539011-ce1f37c5d657?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80" />
<meta property="og:description" content="BEST PAYROLL" />
<meta property="og:site_name" content="Payroll" />
<title>Payroll Management System</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" charset="utf-8"></script>
<link href="https://fonts.googleapis.com/css?family=Grand+Hotel&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
<style>
@-webkit-keyframes colorchange {
0% {
color: #3498db;
}
100% {
color: #8e44ad;
}
}
</style>
</head>
<body>
<div id = "welcome">
<div id = "heading">Welcome to</div>
<div id = "mainhead">PAYROLL MANAGEMENT</div>
<div id = "mainhead">SYSTEM</div>
<div style="font-size: 20px;
color: aliceblue;">Developed by Furqaan Thakur and Irfan Tagala</div>
</div>
<form action="index.php" method="POST" class="login-form" enctype="multipart/form-data">
<h1>Login</h1>
<div id="warning" style="
color: #8e44ad;
text-align: center;
font-weight: bold;
font-family: 'Montserrat', sans-serif;"><?php echo $warning; ?></div>
<div class="txtb">
<input type="text" name="e_id" value="<?php echo $id ?>">
<span data-placeholder="User ID"></span>
</div>
<div class="txtb">
<input type="text" name="pass" >
<span data-placeholder="Password"></span>
</div>
<input type="submit" class="logbtn" value="Login" name="login">
<div class="bottom-text">
Don't have an account? <a href="reg.php">Sign up</a>
</div>
</form>
<script type="text/javascript">
$( document ).ready(function() {
if($(".txtb input").val())
$(".txtb input").addClass("focus");
});
$(".txtb input").on("focus",function(){
$(this).addClass("focus");
});
$(".txtb input").on("blur",function(){
if($(this).val() == "")
$(this).removeClass("focus");
});
</script>
</body>
</html>