-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
98 lines (97 loc) · 3.7 KB
/
Copy pathprofile.php
File metadata and controls
98 lines (97 loc) · 3.7 KB
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
<!DOCTYPE html>
<?php
require_once(dirname(__FILE__).'/Controllers/Controller.php');
$msg = Controller::process();
if(UserController::getSessionUserId()) {
$user = UserController::getLoggedInUser();
$user_id = $user->id;
}
else {
header("Location:notFound.php");
}
?>
<html>
<head>
<link href="css/profile.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="img/main/favicon.ico"/>
<title>
<?php
if ($user->first_name != null && $user->last_name != null) {
echo $user->first_name . " " . $user->last_name;
}
else {
echo $user->username;
}
?>
</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<?php
include('page-elements/header.php');
?>
<main>
<div id="all">
<?php
$avatar = 'img/user-avatars/' . $user_id . '.jpg';
if (!file_exists($avatar)) {
$avatar = 'img/misc/placeholder-avatar.png';
}
?>
<img id="profile-img" src="<?php echo $avatar?>" alt="Avatar"/>
<div id="details">
<br/><span class="red">Name: </span>
<?php
$first = $user->first_name;
$last = $user->last_name;
if ($first == null && $last == null)
{
echo "N/A";
}
else {
echo $first . " " . $last;
}
?>
<br/><span class="red">Username: </span>
<?php
echo $user->username;
?>
<br/><span class="red">Age: </span>
<?php
$birthdate = new DateTime($user->birthdate);
$currentdate = new DateTime();
$interval = $birthdate->diff($currentdate);
echo $interval->format('%y years old');
?>
<br/><span class="red">Country: </span>
<?php
$id = $user->country;
$country_name = CountryController::getCountryName($id);
echo $country_name;
?>
</div>
<div id="img">
<h1>Watchlist</h1>
<?php
$aux = new Watchlist();
$aux->user = $user_id;
$watchlist = $aux->getByUser();
if ($watchlist) {
foreach ($watchlist as $object=>$ids) {
echo '<a href="movie.php?m=' . $ids->movie_id_movie . '"><div class="item"><p>' . MovieController::getTitle($ids->movie_id_movie) . '</p><img class="watched-img" src="img/movies/' . $ids->movie_id_movie .
'.jpg" alt="' . MovieController::getTitle($ids->movie_id_movie) . '"/></div></a>';
}
}
else {
echo '<h3>No movies yet!</h3>';
}
?>
</div>
</div>
</main>
<?php
include('page-elements/footer.php');
?>
</body>
</html>