-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
170 lines (149 loc) · 4.59 KB
/
user.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
<?php
require_once('frame_header.php');
// should check session first. if not go back to index.php
verifyUserSession();
$userid = $_SESSION["loginUsername"];
$isOwner = true;
if(isset($_GET['username']) && $_GET['username'] != $userid){
$isOwner = false;
$guestid=$_GET['username'];
$user = new User($conn,$guestid);
}
else{
$user = new User($conn,$userid);
}
//for testing
//$userid = "gtong900";
echo "<input type='hidden' class='userid' value='$userid'>";
//$userid = $_SESSION["loginUsername"];
?>
<div class="container-fluid">
<div class="row">
<div class="col-md text-primary">
<span class="details">Username:</span> <?php echo $user->getusername() ?>
<?php
echo "<input type='hidden' value='".$user->getusername()."'>";
if (!$isOwner) {
echo "<img src='assets/images/icons/like_follow.png' class='follow'>";
}
?>
</div>
<?php if($isOwner){ ?>
<div class="col-md text-primary">
<span class="details">Name:</span> <?php echo $user->getusertitle() ?>
</div>
<div class="col-md text-primary">
<span class="details">Email:</span> <?php echo $user->getuseremail() ?>
</div>
<div class="col-md text-primary">
<span class="details">City:</span> <?php echo $user->getusercity() ?>
</div>
<?php
}?>
</div>
</div>
<br>
<div class="container-fluid">
<div class="row">
<div class="col-md">
<h3 class="text-danger">Playlist Owned</h3>
<div>
<?php
if ($isOwner){
echo "<div class='listitem'>
<input type='text' class='newPlaylist' placeholder='Create New Playlist' required/><span class='details'> Private/Public </span>
<label class='switch'>
<input type='checkbox' class='makeitprivate' checked>
<span class='slider round'></span>
</label>
<img src='assets/images/icons/add.png' class='add'>
<hr class='bg-danger'>
</div>";
}
?>
<?php
if ($isOwner) {
$userplaylist=$user->getUserAllPlaylist();
}
else{
$userplaylist=$user->getUserPublicPlaylist();
}
// check if there are results
if ($userplaylist->num_rows >0){
while ($row=mysqli_fetch_assoc($userplaylist)) {
//ptitle, pdate, powner, public
$pid = $row["pid"];
$playlist=new Playlist($conn,$pid);
$number=$playlist->getNumber();
echo "<div class='listitem'>
<input type='hidden' class='pid' value='$pid'>
<a href='playlist.php?pid=$pid'><b>".$row["ptitle"]."</b>
<span class='unimportant'>$number Songs</span>
</a>";
if ($isOwner) {
echo "<img src='assets/images/icons/delete.png' class='delete'>";
}
echo "<hr class='bg-danger'>
</div>";
}
}else{
echo "<b>None</b>";
}
?>
</div>
</div>
<div class="col-md">
<h3 class="text-primary">Artist liked</h3>
<div>
<?php
$userLikes=$user->getUserLikes();
// check if there are results
if ($userLikes->num_rows >0){
while ($row=mysqli_fetch_assoc($userLikes)) {
//ptitle, pdate, powner, public
$artistid = $row["artistid"];
$artist = new Artist($conn,$artistid);
echo "<div class='listitem'>
<a href='artist.php?artistid=$artistid'><b>".$artist->getTitle()."</b></a>";
if($isOwner){
echo "<input type='hidden' class='artistid' value='$artistid'>
<img src='assets/images/icons/delete.png' class='unlike'>";
}
echo "<hr class='bg-primary'>
</div>";
}
}else{
echo "<b>None</b>";
}
?>
</div>
</div>
<div class="col-md">
<h3 class="text-secondary">User Followed</h3>
<div>
<?php
$userFollows=$user->getUserFollows();
// check if there are results
if ($userFollows->num_rows >0){
while ($row=mysqli_fetch_assoc($userFollows)) {
//ptitle, pdate, powner, public
$username=$row["username"];
echo "<div class='listitem'>
<input type='hidden' value='$username'>
<a href='user.php?username=$username'><b>".$username."</b></a>";
if($isOwner){
echo "<img src='assets/images/icons/delete.png' class='unfollow'>";
}
echo "<hr class='bg-secondary'>
</div>";
}
}else{
echo "<b>None</b>";
}
?>
</div>
</div>
</div>
</div>
<?php require_once('frame_footer.php'); ?>