-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_admin.php
217 lines (178 loc) · 7.03 KB
/
index_admin.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
session_start();
$host = "localhost";
$user = "root";
$password = "";
$db = "presentseek";
$con = mysqli_connect($host, $user, $password, $db);
if (isset($_POST['user'])) {
$uname = $_POST['user'];
$password = $_POST['pass'];
$sql = "select * from loginformadmin where user='" . $uname . "' AND pass='" . $password . "' limit 1 ; ";
$result = $con->query($sql);
if (mysqli_num_rows($result) == 1) {
$_SESSION["user"] = $uname;
$_SESSION["pass"] = $password;
$_SESSION["loggedInA"] = true;
header("Location:Admin/dashboard.php");
exit();
} else {
$_SESSION["loggedInA"] = false;
echo "<script>
alert('Incorrect Credentials,Login with Correct Credentials');
setTimeout(function(){
window.location.href='index_admin.php';
});
</script>";
exit();
}
}
if (isset($_POST['submitS'])) {
$key = $_POST['key'];
$uname = $_POST['username'];
$password = $_POST['upass'];
$name = $_POST['uname'];
$exp = $_POST['uexp'];
$mail = $_POST['uemail'];
$phone = $_POST['uphone'];
$sql = "select `user` from loginformadmin ; ";
$result = mysqli_query($con, $sql);
$rows = mysqli_fetch_array($result);
foreach ($rows as $value) {
if ($value == $uname) {
echo "<script>alert('User with same credentials Exist');
window.location.replace('index_admin.php');
</script>";
exit();
}
if ($uname == "" or $uname == " ") {
echo "<script>alert('Invalid Credentials');
window.location.replace('index_admin.php');
</script>";
exit();
}
}
$query = "SELECT * FROM `pointer`;";
$value = mysqli_fetch_assoc(mysqli_query($con, $query));
if ($value['pointers'] == $key) {
$sql2 = "INSERT INTO `loginformadmin`(`user`, `pass`, `Name`, `email`, `phone`, `experience`) VALUES ('$uname','$password','$name','$mail','$phone','$exp')";
mysqli_query($con, $sql2);
echo "<script>alert('User Added Successfully');
window.location.replace('index_admin.php');
</script>";
exit();
} else {
echo "<script>alert('Invalid Key');
window.location.replace('index_admin.php');
</script>";
exit();
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Admin Login</title>
<link rel="shortcut icon" href="./images/favicon.ico" type="image/x-icon">
<style>
.boxShadow{
border-radius: 10px;
box-shadow: 7px 10px 30px rgb(39, 38, 38);
margin-top: 18vh !important;
}
body{
height: 100vh;
display: flex;
background-image: linear-gradient(to right, #a6b2ca,#85a6df,#3879e8);
}
input{
background-color: #a1bdee !important;
border-color: rgb(19, 63, 139) !important;
}
::placeholder{
color: #163874 !important;
}
.modal-body input{
background-color: initial !important;
border-color: initial !important;
}
</style>
</head>
<body>
<div class="boxShadow container m-auto d-flex flex-column w-25 p-3">
<h4 class="mt-5 mb-4 align-self-center"><strong style="color:#163874">ADMIN LOGIN</strong></h4>
<form method="POST">
<div class="mb-4 mt-3">
<input type="text" name="user" placeholder="User Id" class="form-control mt-2" id="exampleInputEmail1"
aria-describedby="emailHelp">
</div>
<div class="mb-4 mt-3">
<input type="password" name="pass" class="form-control mt-2" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="mb-2 mt-5 ">
<button name="submit" type="submit" class="btn btn-primary w-100">Sign In</button>
</div>
</form>
<div class="grid mt-3 mb-4">
<a class="btn btn-primary g-col-5 p-2" role="button" href="index.php" style="margin-right: 3rem;">Go Back</a>
<button type="button" class="btn btn-primary p-2 g-col-5 float-end" data-bs-toggle="modal" data-bs-target="#exampleModal"
data-bs-whatever="@mdo">Sign Up</button>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Enter Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form method="POST">
<div class="modal-body">
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Key:</label>
<input name="key" type="text" class="form-control" id="key">
</div>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Name:</label>
<input name="uname" type="text" class="form-control" id="name">
</div>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">UserName:</label>
<input name="username" type="text" class="form-control" id="username">
</div>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Password:</label>
<input name="upass" type="password" class="form-control" id="pass">
<span id="show-password" class="fa fa-eye-slash password-eye-icon"></span>
</div>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Experience:</label>
<input name='uexp' type="text" class="form-control" id="Experience">
</div>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Email:</label>
<input name="uemail" type="email" class="form-control" id="Email">
</div>
<div class="mb-3">
<label for="recipient-name" class="col-form-label">Phone:</label>
<input name="uphone" type="number" class="form-control" id="phone">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button name="submitS" type="submit" class="btn btn-primary">Save</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- <p class="mt-4 text-muted text-center">© 2022</p> -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
</body>
</html>