-
Notifications
You must be signed in to change notification settings - Fork 1
/
index1.php
68 lines (57 loc) · 2.05 KB
/
index1.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
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "admin";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
echo "hoi";
// Check connection
$id=$_GET['adminId'];
$pass=$_GET['adminpassword'];
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM admindata WHERE id='".$id."' AND password='".$pass."'";
echo $sql;
$numrows=mysqli_num_rows($sql);
if($numrows!=0)
{
echo "hi";
while($row=mysqli_fetch_assoc($sql))
{
$dbid=$row['id'];
$dbpassword=$row['password'];
echo $dbid;
echo $dbpassword;
}
if($id == $dbid && $pass == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$id;
/* Redirect browser */
header("Location: admin.php");
} else {
echo "Invalid username or password!";
}
}
mysqli_close($conn);
?>
<div class="main-menubar d-flex align-items-center">
<nav class="hide">
<a href="#home">Home</a>
<a href="#service">Services</a>
<!-- <a href="#appoinment">User signup</a> -->
<a><button data-toggle="modal" data-target="#adminModal" class="qwerty" style="border: none; border-color: #fff; border-width: 0px;">ADMIN</button></a>
<a href="user.php">View Records</a>
<a href="#governance">City Insights</a>
</nav>
<div class="menu-bar"><span class="lnr lnr-menu"></span></div>
</div>
<form method="GET" action = "admin.php">
Id: <input type="text" name="adminId" autocomplete="off">
<br><br>
Password: <input type="password" name="adminpassword" autocomplete="off">
<br><br>
<input type="submit"/>
</form>