-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
184 lines (145 loc) · 6.03 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
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
<?php
session_start();
include("connection.php");
include("functions.php");
if ($_SERVER['REQUEST_METHOD'] == "POST") {
// something was posted
$user_name = $_POST['username'];
$password = $_POST['password'];
if (!empty($user_name) && !empty($password)) {
// read from database
$query = "SELECT * FROM users WHERE user_name = ?";
$stmt = $con->prepare($query);
$stmt->bind_param("s", $user_name);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows === 1) {
$user_data = $result->fetch_assoc();
$stored_password = $user_data['password'];
// Verify password without hashing
if ($password === $stored_password) {
$_SESSION['user_id'] = $user_data['user_id'];
header("Location: profile.php");
die;
} else {
echo "Wrong username or password!";
}
} else {
echo "Wrong username or password!";
}
} else {
echo "Please enter username and password!";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Triploo | Login With Your Account</title>
<!-- Fav Icon -->
<link rel="icon" href="../images/logos/favIconPng.png" />
<!-- Bootstrap 5 css file -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" />
<!-- External CSS file -->
<link rel="stylesheet" href="../css/style.css" />
<!-- Utilities Css file -->
<link rel="stylesheet" href="../css/utilities.css" />
<!-- Dizzpy custom button -->
<link rel="stylesheet" href="../css/dizzpayButton.css" />
<!-- About us CSS -->
<link rel="stylesheet" href="../css/pages/about-us.css" />
<!-- Login and Singup button css file -->
<link rel="stylesheet" href="../css/pages/login-singup.css">
<!-- Remix icon cdn -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/remixicon/3.5.0/remixicon.min.css" />
<!-- Google font link -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Gabarito:wght@400;500;600;700;800;900&family=Lato:wght@700&family=Onest:wght@100;200;300;400;500;600;700;800;900&family=Source+Sans+3:wght@600&display=swap"
rel="stylesheet" />
<style>
.LoginFormContainer{
margin-top: 8%;
}
</style>
</head>
<body>
<!-- Nav Bars start -->
<div class="container-fluid">
<div class="container fixed-top">
<nav class="navbar navbar-expand-lg bg-body-tertiary px-4 py-0 mt-4 d-NavContainerFluid">
<a class="navbar-brand" href="/index.html">
<img src="/images/logos/logoPrimary.svg" alt="MainLogo" class="main-logo" />
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link D-Active" href="/index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/html/J-PackagesMain.html">Packages</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/html/T-Shop-MainPage.html">Shop</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/html/M-Blog-MainPage.html">Blog</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/html/about-us.html">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/html/contact-us.html">Contact</a>
</li>
</ul>
<div class="d-flex justify-content-center g-4">
</div>
</div>
</nav>
</div>
</div>
<!-- NavBar end -->
<div class="container d-flex justify-content-center align-items-center vh-100">
<form method="post" class="col-12 col-md-5 col-lg-6">
<div class="card px-4 py-3">
<h1 class="Log-MainText mt-4">Welcome to Triploo</h1>
<p class="Log-SubHeading">We are really happy to see you again!</p>
<!-- Search box section -->
<div class="Log-InputBoxs">
<!-- User name -->
<div class="mb-4">
<label for="username" class="form-label">
<span class="j-SearchBarLabel">Username <span class="j-redStarMark">*</span></span>
</label>
<input type="text" class="form-control form-input" id="username" placeholder="JohnDoe" name="username" required>
</div>
<!-- Password -->
<div class="mb-4">
<label for="password" class="form-label">
<span class="j-SearchBarLabel">Password <span class="j-redStarMark">*</span></span>
</label>
<input type="password" class="form-control form-input" id="password" placeholder="Password" name="password" required>
</div>
</div>
<!-- Login button -->
<div class="Log-LoginButton text-center mt-3 mb-3">
<button class="D-Button-Primary btn-block" type="submit">Login</button>
</div>
<a href="signup.php">
<p class="Log-SubHeading mt-3 text-center">Click to Register</p>
</a>
</div>
</form>
</div>
<!-- Bootstrap 5 js file -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- components js -->
</body>
</html>