[057badc] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | session_start();
|
---|
| 4 | if(!isset($_SESSION['user_ID'])) {
|
---|
| 5 | header("Location: ./Log In.php");
|
---|
| 6 | }
|
---|
| 7 |
|
---|
| 8 | require './connect.php';
|
---|
| 9 |
|
---|
| 10 | $res = mysqli_query($conn, "SELECT users_information.*, users.username, users.email FROM users_information INNER JOIN users ON users_information.user_id = users.user_ID WHERE
|
---|
| 11 | users.user_id = {$_SESSION['user_ID']};
|
---|
| 12 | ");
|
---|
| 13 |
|
---|
| 14 | $existing_data_res = mysqli_query($conn, "SELECT * FROM users WHERE users.user_id = {$_SESSION['user_ID']};");
|
---|
| 15 |
|
---|
| 16 | $orders_res = mysqli_query($conn, "SELECT * FROM orders WHERE user_id = {$_SESSION['user_ID']};");
|
---|
| 17 |
|
---|
| 18 | $user_data = $res->fetch_assoc();
|
---|
| 19 | $existing_data = $existing_data_res->fetch_assoc();
|
---|
| 20 |
|
---|
| 21 | $pending_orders = 0;
|
---|
| 22 | $active_orders = 0;
|
---|
| 23 | $delivered_orders = 0;
|
---|
| 24 |
|
---|
| 25 | foreach($orders_res as $order) {
|
---|
| 26 |
|
---|
| 27 | $order_item = mysqli_query($conn, "SELECT * FROM order_item WHERE order_id = {$order['id']};");
|
---|
| 28 | $total_sum = 0;
|
---|
| 29 |
|
---|
| 30 | foreach($order_item as $item) {
|
---|
| 31 | $total_sum = $total_sum + ($item['quantity']*$item['price']);
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | switch($order['status']) {
|
---|
| 35 | case 'p':
|
---|
| 36 | ++$pending_orders;
|
---|
| 37 | break;
|
---|
| 38 | case 'a':
|
---|
| 39 | ++$active_orders;
|
---|
| 40 | break;
|
---|
| 41 | case 'd':
|
---|
| 42 | ++$delivered_orders;
|
---|
| 43 | break;
|
---|
| 44 | default:
|
---|
| 45 | break;
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | ?>
|
---|
| 49 | <!DOCTYPE html>
|
---|
| 50 | <html lang="en">
|
---|
| 51 | <head>
|
---|
| 52 | <meta charset="UTF-8">
|
---|
| 53 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
---|
| 54 | <link rel="stylesheet"
|
---|
| 55 | href="https://unpkg.com/boxicons@latest/css/boxicons.min.css">
|
---|
| 56 | <link rel="stylesheet" href="./CSS/Header.css">
|
---|
| 57 | <link rel="stylesheet" href="./CSS/Profile.css">
|
---|
| 58 | <title>Profile</title>
|
---|
| 59 | </head>
|
---|
| 60 | <body>
|
---|
| 61 |
|
---|
| 62 | <?php include "./components/Header.html" ?>
|
---|
| 63 |
|
---|
| 64 | <div class="container">
|
---|
| 65 | <div style="display: flex; justify-content: space-between;">
|
---|
| 66 | <h1 id="container-section-label">
|
---|
| 67 | Your Profile
|
---|
| 68 | </h1>
|
---|
| 69 | <a href="./EditProfile.php" class="edit-profile-link">Edit</a>
|
---|
| 70 | </div>
|
---|
| 71 | <div class="personal-information-container">
|
---|
| 72 | <div class="profile-picture-container">
|
---|
| 73 | <img src="./svgs/user-solid.svg" id="profile-picture">
|
---|
| 74 | </div>
|
---|
| 75 | <div>
|
---|
| 76 | <div class="profile-name-label">
|
---|
| 77 | <?php
|
---|
| 78 | if(mysqli_num_rows($res) == 0) {
|
---|
| 79 |
|
---|
| 80 | if(mysqli_num_rows($existing_data_res) != 0) {
|
---|
| 81 | echo $existing_data['username'];
|
---|
| 82 | }
|
---|
| 83 | else {
|
---|
| 84 | echo 'None';
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
| 87 | else {
|
---|
| 88 | echo $user_data['username'];
|
---|
| 89 | }
|
---|
| 90 | ?>
|
---|
| 91 | </div>
|
---|
| 92 | <div class="personal-information-details">
|
---|
| 93 | <div class="personal-information-card">
|
---|
| 94 | <div class="persononal-information-card-header">
|
---|
| 95 | Email
|
---|
| 96 | </div>
|
---|
| 97 | <div class="personal-information-card-value">
|
---|
| 98 | <?php
|
---|
| 99 | if(mysqli_num_rows($res) == 0) {
|
---|
| 100 |
|
---|
| 101 | if(mysqli_num_rows($existing_data_res) != 0) {
|
---|
| 102 | echo $existing_data['email'];
|
---|
| 103 | }
|
---|
| 104 | else {
|
---|
| 105 | echo 'None';
|
---|
| 106 | }
|
---|
| 107 | }
|
---|
| 108 | else {
|
---|
| 109 | echo $user_data['email'];
|
---|
| 110 | }
|
---|
| 111 | ?>
|
---|
| 112 | </div>
|
---|
| 113 | </div>
|
---|
| 114 | <div class="personal-information-card">
|
---|
| 115 | <div class="persononal-information-card-header">
|
---|
| 116 | Address
|
---|
| 117 | </div>
|
---|
| 118 | <div class="personal-information-card-value">
|
---|
| 119 | <?php
|
---|
| 120 | if(mysqli_num_rows($res) == 0) {
|
---|
| 121 | echo 'None';
|
---|
| 122 | }
|
---|
| 123 | else {
|
---|
| 124 | echo $user_data['address'];
|
---|
| 125 | }
|
---|
| 126 | ?>
|
---|
| 127 | </div>
|
---|
| 128 | </div>
|
---|
| 129 | <div class="personal-information-card">
|
---|
| 130 | <div class="persononal-information-card-header">
|
---|
| 131 | City
|
---|
| 132 | </div>
|
---|
| 133 | <div class="personal-information-card-value">
|
---|
| 134 | <?php
|
---|
| 135 | if(mysqli_num_rows($res) == 0) {
|
---|
| 136 | echo 'None';
|
---|
| 137 | }
|
---|
| 138 | else {
|
---|
| 139 | echo $user_data['city'];
|
---|
| 140 | }
|
---|
| 141 | ?>
|
---|
| 142 | </div>
|
---|
| 143 | </div>
|
---|
| 144 | <div class="personal-information-card">
|
---|
| 145 | <div class="persononal-information-card-header">
|
---|
| 146 | Postal Code
|
---|
| 147 | </div>
|
---|
| 148 | <div class="personal-information-card-value">
|
---|
| 149 | <?php
|
---|
| 150 | if(mysqli_num_rows($res) == 0) {
|
---|
| 151 | echo 'None';
|
---|
| 152 | }
|
---|
| 153 | else {
|
---|
| 154 | echo $user_data['postal_code'];
|
---|
| 155 | }
|
---|
| 156 | ?>
|
---|
| 157 | </div>
|
---|
| 158 | </div>
|
---|
| 159 |
|
---|
| 160 | <div class="personal-information-card">
|
---|
| 161 | <div class="persononal-information-card-header">
|
---|
| 162 | Име
|
---|
| 163 | </div>
|
---|
| 164 | <div class="personal-information-card-value">
|
---|
| 165 | <?php
|
---|
| 166 | if(mysqli_num_rows($res) == 0) {
|
---|
| 167 | echo 'None';
|
---|
| 168 | }
|
---|
| 169 | else {
|
---|
| 170 | echo $user_data['name'];
|
---|
| 171 | }
|
---|
| 172 | ?>
|
---|
| 173 | </div>
|
---|
| 174 | </div>
|
---|
| 175 |
|
---|
| 176 | <div class="personal-information-card">
|
---|
| 177 | <div class="persononal-information-card-header">
|
---|
| 178 | Презиме
|
---|
| 179 | </div>
|
---|
| 180 | <div class="personal-information-card-value">
|
---|
| 181 | <?php
|
---|
| 182 | if(mysqli_num_rows($res) == 0) {
|
---|
| 183 | echo 'None';
|
---|
| 184 | }
|
---|
| 185 | else {
|
---|
| 186 | echo $user_data['surname'];
|
---|
| 187 | }
|
---|
| 188 | ?>
|
---|
| 189 | </div>
|
---|
| 190 | </div>
|
---|
| 191 |
|
---|
| 192 | <div class="personal-information-card">
|
---|
| 193 | <div class="persononal-information-card-header">
|
---|
| 194 | Тел. Број
|
---|
| 195 | </div>
|
---|
| 196 | <div class="personal-information-card-value">
|
---|
| 197 | <?php
|
---|
| 198 | if(mysqli_num_rows($res) == 0) {
|
---|
| 199 | echo 'None';
|
---|
| 200 | }
|
---|
| 201 | else {
|
---|
| 202 | echo $user_data['phone_number'];
|
---|
| 203 | }
|
---|
| 204 | ?>
|
---|
| 205 | </div>
|
---|
| 206 | </div>
|
---|
| 207 |
|
---|
| 208 | </div>
|
---|
| 209 | </div>
|
---|
| 210 | </div>
|
---|
| 211 | </div>
|
---|
| 212 |
|
---|
| 213 | <div class="container" style="width: 95%;">
|
---|
| 214 | <h1 id="container-section-label">
|
---|
| 215 | Pending Orders
|
---|
| 216 | </h1>
|
---|
| 217 | <div class="order-information-container">
|
---|
| 218 | <?php
|
---|
| 219 | if($pending_orders >= 1) {
|
---|
| 220 | foreach($orders_res as $order) {
|
---|
| 221 | if($order['status'] == 'p') {
|
---|
| 222 | ?>
|
---|
| 223 | <div class="order">
|
---|
| 224 | <div class="order-icon">
|
---|
| 225 | <img src="./svgs/bx-package.svg" width="100" height="100">
|
---|
| 226 | </div>
|
---|
| 227 | <div class="order-information">
|
---|
| 228 | <div class="order-card">
|
---|
| 229 | <h3 class="order-card-header">
|
---|
| 230 | Order Number:
|
---|
| 231 | </h3>
|
---|
| 232 | <div class="order-card-value">
|
---|
| 233 | <?php echo $order['id'] ?>
|
---|
| 234 | </div>
|
---|
| 235 | </div>
|
---|
| 236 | <div class="order-card">
|
---|
| 237 | <h3 class="order-card-header">
|
---|
| 238 | Order Date:
|
---|
| 239 | </h3>
|
---|
| 240 | <div class="order-card-value">
|
---|
| 241 | <?php echo $order['order_date'] ?>
|
---|
| 242 | </div>
|
---|
| 243 | </div>
|
---|
| 244 | <div class="order-card">
|
---|
| 245 | <h3 class="order-card-header">
|
---|
| 246 | Total Sum:
|
---|
| 247 | </h3>
|
---|
| 248 | <div class="order-card-value">
|
---|
| 249 | $
|
---|
| 250 | <?php echo $order["total_sum"] ?>
|
---|
| 251 | </div>
|
---|
| 252 | </div>
|
---|
| 253 | </div>
|
---|
| 254 | </div>
|
---|
| 255 |
|
---|
| 256 | <?php
|
---|
| 257 | }
|
---|
| 258 | }
|
---|
| 259 | }
|
---|
| 260 | else {
|
---|
| 261 | echo 'You have no pending orders!';
|
---|
| 262 | }
|
---|
| 263 | ?>
|
---|
| 264 |
|
---|
| 265 | <h1 id="container-section-label">
|
---|
| 266 | Active Orders
|
---|
| 267 | </h1>
|
---|
| 268 |
|
---|
| 269 | <div class="order-information-container">
|
---|
| 270 | <?php
|
---|
| 271 | if($active_orders >= 1) {
|
---|
| 272 | foreach($orders_res as $order) {
|
---|
| 273 | if($order['status'] == 'a') {
|
---|
| 274 | ?>
|
---|
| 275 | <div class="order">
|
---|
| 276 | <div class="order-icon">
|
---|
| 277 | <img src="./svgs/bx-package.svg" width="100" height="100">
|
---|
| 278 | </div>
|
---|
| 279 | <div class="order-information">
|
---|
| 280 | <div class="order-card">
|
---|
| 281 | <h3 class="order-card-header">
|
---|
| 282 | Order Number:
|
---|
| 283 | </h3>
|
---|
| 284 | <div class="order-card-value">
|
---|
| 285 | <?php echo $order['id'] ?>
|
---|
| 286 | </div>
|
---|
| 287 | </div>
|
---|
| 288 | <div class="order-card">
|
---|
| 289 | <h3 class="order-card-header">
|
---|
| 290 | Order Date:
|
---|
| 291 | </h3>
|
---|
| 292 | <div class="order-card-value">
|
---|
| 293 | <?php echo $order['order_date'] ?>
|
---|
| 294 | </div>
|
---|
| 295 | </div>
|
---|
| 296 | <div class="order-card">
|
---|
| 297 | <h3 class="order-card-header">
|
---|
| 298 | Total Sum:
|
---|
| 299 | </h3>
|
---|
| 300 | <div class="order-card-value">
|
---|
| 301 | <?php echo $order["total_sum"] ?>
|
---|
| 302 | </div>
|
---|
| 303 | </div>
|
---|
| 304 | <div class="order-card">
|
---|
| 305 | <h3 class="order-card-header">
|
---|
| 306 | Shipped Date:
|
---|
| 307 | </h3>
|
---|
| 308 | <div class="order-card-value">
|
---|
| 309 | <?php echo $order['shipped_date'] ?>
|
---|
| 310 | </div>
|
---|
| 311 | </div>
|
---|
| 312 | </div>
|
---|
| 313 | </div>
|
---|
| 314 |
|
---|
| 315 | <?php
|
---|
| 316 | }
|
---|
| 317 | }
|
---|
| 318 | }
|
---|
| 319 | else {
|
---|
| 320 | echo 'You have no active orders!';
|
---|
| 321 | }
|
---|
| 322 | ?>
|
---|
| 323 |
|
---|
| 324 | <h1 id="container-section-label">
|
---|
| 325 | Delivered Orders
|
---|
| 326 | </h1>
|
---|
| 327 |
|
---|
| 328 | <div class="order-information-container">
|
---|
| 329 | <?php
|
---|
| 330 | if($delivered_orders >= 1) {
|
---|
| 331 | foreach($orders_res as $order) {
|
---|
| 332 | if($order['status'] == 'd') {
|
---|
| 333 | ?>
|
---|
| 334 | <div class="order">
|
---|
| 335 | <div class="order-icon">
|
---|
| 336 | <img src="./svgs/bx-package.svg" width="100" height="100">
|
---|
| 337 | </div>
|
---|
| 338 | <div class="order-information">
|
---|
| 339 | <div class="order-card">
|
---|
| 340 | <h3 class="order-card-header">
|
---|
| 341 | Order Number:
|
---|
| 342 | </h3>
|
---|
| 343 | <div class="order-card-value">
|
---|
| 344 | <?php echo $order['id'] ?>
|
---|
| 345 | </div>
|
---|
| 346 | </div>
|
---|
| 347 | <div class="order-card">
|
---|
| 348 | <h3 class="order-card-header">
|
---|
| 349 | Order Date:
|
---|
| 350 | </h3>
|
---|
| 351 | <div class="order-card-value">
|
---|
| 352 | <?php echo $order['order_date'] ?>
|
---|
| 353 | </div>
|
---|
| 354 | </div>
|
---|
| 355 | <div class="order-card">
|
---|
| 356 | <h3 class="order-card-header">
|
---|
| 357 | Total Sum:
|
---|
| 358 | </h3>
|
---|
| 359 | <div class="order-card-value">
|
---|
| 360 | $
|
---|
| 361 | <?php echo $order["total_sum"] ?>
|
---|
| 362 | </div>
|
---|
| 363 | </div>
|
---|
| 364 | <div class="order-card">
|
---|
| 365 | <h3 class="order-card-header">
|
---|
| 366 | Shipped Date:
|
---|
| 367 | </h3>
|
---|
| 368 | <div class="order-card-value">
|
---|
| 369 | $
|
---|
| 370 | <?php echo $order['shipped_date'] ?>
|
---|
| 371 | </div>
|
---|
| 372 | </div>
|
---|
| 373 | <div class="order-card">
|
---|
| 374 | <h3 class="order-card-header">
|
---|
| 375 | Arrived Date:
|
---|
| 376 | </h3>
|
---|
| 377 | <div class="order-card-value">
|
---|
| 378 | <?php echo $order['arrived_date'] ?>
|
---|
| 379 | </div>
|
---|
| 380 | </div>
|
---|
| 381 | </div>
|
---|
| 382 | </div>
|
---|
| 383 |
|
---|
| 384 | <?php
|
---|
| 385 | }
|
---|
| 386 | }
|
---|
| 387 | }
|
---|
| 388 | else {
|
---|
| 389 | echo 'You have no delivered orders!';
|
---|
| 390 | }
|
---|
| 391 | ?>
|
---|
| 392 | </div>
|
---|
| 393 | </div>
|
---|
| 394 | </div>
|
---|
| 395 | </div>
|
---|
| 396 |
|
---|
| 397 | <section class="footer-class">
|
---|
| 398 | <div class="footer-div">
|
---|
| 399 | <div class="info-footer-first">
|
---|
| 400 | <img src="image/NewLogo.png">
|
---|
| 401 | <p>бул. АСНОМ 14 <br> Скопје, Македонија</p>
|
---|
| 402 | <p>+389 71 111 222</p>
|
---|
| 403 | <p>innovabuisness@gmail.com</p>
|
---|
| 404 | </div>
|
---|
| 405 |
|
---|
| 406 | <div class="info-footer-second">
|
---|
| 407 | <h4>Помош</h4>
|
---|
| 408 | <p><a href="./Information/Contact.html">Контакт</a></p>
|
---|
| 409 | <p><a href="./Information/AboutUs.html">За нас</a></p>
|
---|
| 410 | <p><a href="./Information/Privacy.html">Политика на приватност</a></p>
|
---|
| 411 | </div>
|
---|
| 412 |
|
---|
| 413 | <div class="info-footer-third">
|
---|
| 414 | <h4>Customers</h4>
|
---|
| 415 | <p>Гаранција</p>
|
---|
| 416 | <p>Студенски дискоунт</p>
|
---|
| 417 | <p>Return policy</p>
|
---|
| 418 | </div>
|
---|
| 419 | </div>
|
---|
| 420 | </section>
|
---|
| 421 | </body>
|
---|
| 422 | </html> |
---|