-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
144 lines (101 loc) · 3.61 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
<?php
session_start();
error_reporting(0);
include "php/db.php";
if(isset($_POST['alogin']))
{
$email = $_POST["email"];
$password = md5(md5(md5($_POST["password"])));
$stmt = $conn->prepare("SELECT id,firstname,lastname,email FROM customers WHERE email=? and password= ?");
// Bind parameters s - string, b - boolean, i - int, etc
$stmt->bind_param("ss", $email, $password);
// Execute SQL
$stmt->execute();
// Store result
$stmt->store_result();
// Bind the result
$stmt->bind_result($id, $firstname, $lastname, $email);
if ($stmt->num_rows == 1) {
// Fetching data
while ($row = $stmt->fetch()) {
$extra="dashboard.php";
$_SESSION['aemail']= $email;
$_SESSION['id']=$id;
$_SESSION['fullname']=$firstname ." ".$lastname;
echo "<script>window.location.href='".$extra."'</script>";
}
} else {
$_SESSION['action1']="<span style='color: red;'> Invalid username or password</span> <br>";
$extra="index.php";
echo "<script>window.location.href='".$extra."'</script>";
}
// Close the statement
$stmt->close();
}
// Close the connection
mysqli_close($conn);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Aurulias Basket</title>
<?php include "link.php";?>
</head>
<body>
<!-- Main navbar -->
<!-- /main navbar -->
<!-- Page content -->
<div class="page-content">
<!-- Main content -->
<div class="content-wrapper">
<!-- Content area -->
<div class="content d-flex justify-content-center align-items-center">
<!-- Login card -->
<form class="login-form" method="post" action="index.php">
<div class="card mb-0">
<div class="card-body">
<div class="text-center mb-3">
<img src="assets/extension/images/logo.png" style="height: 85px;" alt="">
<h5 class="mb-0">Login</h5>
<span class="d-block text-muted"><?php if(isset($_SESSION['action1'])){ echo $_SESSION['action1'];}?>please kindly fill up your info </span>
</div>
<div class="form-group form-group-feedback form-group-feedback-left">
<input type="text" name="email" class="form-control" placeholder="Email">
<div class="form-control-feedback">
<i class="icon-envelope text-muted"></i>
</div>
</div>
<div class="form-group form-group-feedback form-group-feedback-left">
<input type="password" name="password" class="form-control" placeholder="Password">
<div class="form-control-feedback">
<i class="icon-lock2 text-muted"></i>
</div>
</div>
<div class="form-group">
<button type="submit" name="alogin" class="btn btn-primary btn-block">Login <i class="icon-circle-right2 ml-2"></i></button>
</div>
<div class="form-group text-center text-muted content-divider">
<span class="px-2">Don't have an account?</span>
</div>
<div class="form-group">
<a href="signup.php" class="btn btn-light btn-block">Sign Up</a>
</div>
<span class="form-text text-center text-muted">By continuing, you're confirming that you've read our <a href="#">Terms & Conditions</a> and <a href="#">Cookie Policy</a></span>
</div>
</div>
</form>
<!-- /login card -->
</div>
<!-- /content area -->
<!-- Footer -->
<?php include "footer.php";?>
<!-- /footer -->
</div>
<!-- /main content -->
</div>
<!-- /page content -->
</body>
</html>