-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshow_user_info.php
57 lines (46 loc) · 1.45 KB
/
show_user_info.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
<?php
function displayUserInfo($displayUser) {
include_once('database/connection.php');
include_once('database/user.php');
$user = getUserInfo($displayUser);
$username = $user['username'];
$about = $user['about'];
$imgPath = ("images/user/profile/" . $username . ".jpg");
echo '<div class="profile-pic">';
echo '<img src=' .
(file_exists($imgPath) ?
$imgPath : "images/user/profile/default.jpg").
' alt="user profile picture">';
echo '</div>';
echo '<div class="username-info">';
echo '<h2>' . $username . '</h2>';
echo '<h4>' . $about . '</h4>';
echo '</div>';
}
function displayCurrUserInfo() {
?> <script type="module" src="scripts/edit_profile.js"></script> <?php
displayUserInfo($_SESSION['username']);
?>
<button type="button" class="btn" id="edit-profile" >
<span><i class="fa fa-pencil"></i>Edit Profile</span>
</button>
<?php
}
function getUserProfile($user) {
if ($user == $_SESSION['username'])
displayCurrUserInfo();
else
displayUserInfo($user);
}
function getUserThumbnail($user) {
$imgPath = ("images/user/thumbnails/" . $user . ".jpg");
if (file_exists($imgPath))
echo '"' . $imgPath . '"';
else
echo '"images/user/thumbnails/default.jpg"';
}
function getCurrUserThumbnail() {
include_once('includes/session.php');
getUserThumbnail(getCurrentUser());
}
?>