-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_profile.php
75 lines (70 loc) · 2.86 KB
/
user_profile.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
<?php
require_once "../includes/config_session.inc.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Quirx - My Profile</title>
<link rel="stylesheet" href="../css/global.css" />
<link rel="stylesheet" href="../css/profile.css" />
<link rel="stylesheet" href="../css/navbar.css" />
</head>
<body>
<?php include_once('../includes/components/navbar.inc.php') ?>
<?php
// check if user is logged in
if (!isset($_SESSION['user_id'])) {
// if not, redirect to login page
header('Location: ./login.php');
exit();
}
?>
<main class="profile">
<h1 class="profile__title">My Profile</h1>
<section class="profile__hero">
<div class="profile__hero__img">
<img src="<?php
if ($_SESSION["user_pfp"] === null) {
echo "../assets/default_pfp.svg";
} else {
echo "../uploads/pfp/" . $_SESSION["user_pfp"];
}
?>" alt="<?php
if ($_SESSION["user_pfp"] === null) {
echo "Default profile picture";
} else {
echo "Profile picture of " . $_SESSION["user_username"];
}
?>" width="200" height="200">
</div>
<p class="profile__hero__fullname">
<?php if (isset($_SESSION['user_fullname'])) {
echo $_SESSION['user_fullname'];
} else {
echo "User";
} ?>
</p>
<p class="profile__hero__username">@<span><?php if (isset($_SESSION['user_username'])) {
echo $_SESSION['user_username'];
} else {
echo "username";
} ?>
</span></p>
<p class="profile__hero__email">
<?php if (isset($_SESSION['user_email'])) {
echo $_SESSION['user_email'];
} else {
echo "email";
} ?>
</p>
<?php if (isset($_SESSION['user_is_admin']) && $_SESSION['user_is_admin'] === 'Y') { ?>
<p>Role: Admin</p>
<?php } ?>
</section>
<a href="./edit_profile.php" class="profile__btn">Edit Profile</a>
<a href="./user_dashboard.php" class="profile__btn">Dashboard</a>
</main>
</body>
</html>