-
Notifications
You must be signed in to change notification settings - Fork 29
/
index.php
113 lines (93 loc) · 2.73 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
<?php
session_start();
if (isset($_SESSION['id'])) {
header('location:home.php');
}
?>
<html style="background: url(Picture/bg.png); background-repeat: no-repeat; background-size:cover;">
<title>Barangay Management Information System</title>
<link rel="stylesheet" type="text/css" href="Css/homepage.css">
<link rel="shortcut icon" href="Icon/indang logo.png">
<!-- <script src="css/ism-2.2.min.js"></script>
<link rel="stylesheet" href="Css/slider.css"> -->
<style type="text/css">
.nav {
background-color:#2e4a62;
border: none;
width: 100%;
position:fixed;
overflow: hidden;
top: 0;
left: 0;
text-transform: uppercase;
font-family: calibri;
}
</style>
<div class="nav">
<a href="index.php">home</a>
<a href="about.php">about</a>
</div>
<body>
<div class="container" >
<!-- <img src="Picture/indang1.jpg" style="float:left" width="60%" height="73%"> -->
</div>
<div class="right" >
<section class="banner">Sign In</section> </br> </br>
<Center><img src="Picture/banaba.png" height="100" width="100" ></center>
<form method="POST">
<input type="text" name="username" required autofocus placeholder="Enter Username">
<input type="password" name="password" required autofocus placeholder="Enter Password">
<input type="Submit" name="submit" value="Enter">
<script>
function myFunction() {
var x = document.getElementById("myInput");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "Passwordrd";
}
}
</script>
</div>
</form>
</div>
<?php
include('db.php');
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$qry = mysqli_query($db, "SELECT * FROM Accounts WHERE Username ='$username'");
$count = mysqli_num_rows($qry);
if ($count > 0) {
$accnt = mysqli_fetch_array($qry);
$pass=$accnt['Password'];
$_SESSION['id'] = $accnt['ID'];
if($pass==$password && $username==$username){
$pos = $accnt['position_id'];
$position=$accnt['Position'];
$committee=$accnt['Committee'];
$fullname = $accnt['Fullname'];
$_SESSION['LOGIN_STATUS'] = true;
$_SESSION['position'] = $position;
$_SESSION['USER'] = $username;
$_SESSION['committee'] = $committee;
$_SESSION['password'] = $password;
$_SESSION['emailaddress'] = $count['Emailaddress'];
$_SESSION['device_Id'] = $count['Position'];
$_SESSION['positionID'] = $pos;
$_SESSION['fullname'] = $fullname;
$_SESSION['position_id'] = $accnt['position_id'];
echo "<script>alert('Welcome.');</script>";
echo '<script>window.location = "home.php";</script>';
}
else {
echo "<script>alert('Incorrect Password.');</script>";
}
}
else {
echo "<script>alert('Invalid username.');</script>";
}
}
?>
</body>
</html>