-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
139 lines (133 loc) · 5.35 KB
/
login.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
<!DOCTYPE html>
<html>
<head>
<title>Banking</title>
<?php require 'assets/autoloader.php'; ?>
<?php require 'assets/function.php'; ?>
<?php
$con = new mysqli('localhost','root','','mybank');
define('bankName', 'IndianDhan Bank',true);
$error = "";
if (isset($_POST['userLogin']))
{
$error = "";
$user = $_POST['email'];
$pass = $_POST['password'];
$result = $con->query("select * from userAccounts where email='$user' AND password='$pass'");
if($result->num_rows>0)
{
session_start();
$data = $result->fetch_assoc();
$_SESSION['userId']=$data['id'];
$_SESSION['user'] = $data;
header('location:index.php');
}
else
{
$error = "<div class='alert alert-warning text-center rounded-0'>Username or password wrong try again!</div>";
}
}
if (isset($_POST['cashierLogin']))
{
$error = "";
$user = $_POST['email'];
$pass = $_POST['password'];
$result = $con->query("select * from login where email='$user' AND password='$pass'");
if($result->num_rows>0)
{
session_start();
$data = $result->fetch_assoc();
$_SESSION['cashId']=$data['id'];
//$_SESSION['user'] = $data;
header('location:cindex.php');
}
else
{
$error = "<div class='alert alert-warning text-center rounded-0'>Username or password wrong try again!</div>";
}
}
if (isset($_POST['managerLogin']))
{
$error = "";
$user = $_POST['email'];
$pass = $_POST['password'];
$result = $con->query("select * from login where email='$user' AND password='$pass' AND type='manager'");
if($result->num_rows>0)
{
session_start();
$data = $result->fetch_assoc();
$_SESSION['managerId']=$data['id'];
//$_SESSION['user'] = $data;
header('location:mindex.php');
}
else
{
$error = "<div class='alert alert-warning text-center rounded-0'>Username or password wrong try again!</div>";
}
}
?>
</head>
<body style="background: url(images/bg-login2.jpg);background-size: 100%">
<h1 class="alert alert-success rounded-0"><?php echo bankname; ?><small class="float-right text-muted" style="font-size: 12pt;"><kbd>Presented by:Sanay Kumar</kbd></small></h1>
<br>
<?php echo $error ?>
<br>
<div id="accordion" role="tablist" class="w-25 float-right shadowBlack" style="margin-right: 222px">
<br><h4 class="text-center text-white">Select Your Session</h4>
<div class="card rounded-0">
<div class="card-header" role="tab" id="headingOne">
<h5 class="mb-0">
<a style="text-decoration: none;" data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<button class="btn btn-outline-success btn-block">User Login</button>
</a>
</h5>
</div>
<div id="collapseOne" class="collapse" role="tabpanel" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<form method="POST">
<input type="email" value="some@gmail.com" name="email" class="form-control" required placeholder="Enter Email">
<input type="password" name="password" value="some" class="form-control" required placeholder="Enter Password">
<button type="submit" class="btn btn-primary btn-block btn-sm my-1" name="userLogin">Enter </button>
</form>
</div>
</div>
</div>
<div class="card rounded-0">
<div class="card-header" role="tab" id="headingTwo">
<h5 class="mb-0">
<a class="collapsed btn btn-outline-success btn-block" data-toggle="collapse" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Manager Login
</a>
</h5>
</div>
<div id="collapseTwo" class="collapse" role="tabpanel" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
<form method="POST">
<input type="email" value="manager@manager.com" name="email" class="form-control" required placeholder="Enter Email">
<input type="password" name="password" value="manager" class="form-control" required placeholder="Enter Password">
<button type="submit" class="btn btn-primary btn-block btn-sm my-1" name="managerLogin">Enter </button>
</form>
</div>
</div>
</div>
<div class="card rounded-0">
<div class="card-header" role="tab" id="headingThree">
<h5 class="mb-0">
<a class="collapsed btn btn-outline-success btn-block" data-toggle="collapse" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Cashier Login
</a>
</h5>
</div>
<div id="collapseThree" class="collapse" role="tabpanel" aria-labelledby="headingThree" data-parent="#accordion">
<div class="card-body">
<form method="POST">
<input type="email" value="cashier@cashier.com" name="email" class="form-control" required placeholder="Enter Email">
<input type="password" name="password" value="cashier" class="form-control" required placeholder="Enter Password">
<button type="submit" class="btn btn-primary btn-block btn-sm my-1" name="cashierLogin">Enter </button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>