This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
p_profiles.php
411 lines (333 loc) · 10.8 KB
/
p_profiles.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<?php
require_once("connect.php");
require_once("header.php");
require_once("hash_functions.php");
require_once("position_check.php");
$sScheduleID;
$sPlaylistID;
$sShowID;
$dj;
//get show that has aired on wsbf
if (isset($_GET['scheduleID'])) {
$sScheduleID = $_GET['scheduleID'];
}
//get individual show for archive and playlist
if (isset($_GET['playlistID'])) {
$sPlaylistID = $_GET['playlistID'];
}
else if (isset($_GET['showID'])) {
$sShowID = $_GET['showID'];
}
//get shows and archives and playlists for a user
if (isset($_GET['dj'])) {
$dj = $_GET['dj'];
}
//for list view, allow filter by showType
if (isset($_GET['showType'])) {
$showType = $_GET['showType'];
}
$md_ret_value = MD_check();
echo "
<div id = 'filters'>
<table><tr>
<td><div id = 'search'><input id = 'searchInput' type='text' value='Search: '></div></td>
<td><div id = 'centerlab'><a href='p_profiles.php?'>Dasein</a></div></td>
<td></td>
<td><div id = 'review_label'><a href='p_library.php?rot=0'>Active</a></div></td>
<td></td>
<td><div id = 'rotationtypes'><a href='p_library.php?rot=1'>Specialty</a></div></td>
</tr></table>
</div>";
//Playlist // or Show
// detail - DJ, Show
// list - tracks
if( !empty($sPlaylistID) ) {
$tracksquery = "
SELECT
a.album_name, m.albumID,
b.artist_name, b.artistID,
m.track_num, t.track_name
FROM libPlaylistTrackMap m
JOIN libplaylists p on p.playlistID = m.playlistID
JOIN libtrack t on t.albumID = m.AlbumID and t.track_num = m.track_num
JOIN libalbum a on a.albumID = m.AlbumID
JOIN libartist b on b.ArtistID = a.ArtistID
WHERE m.playlistID = ".$sPlaylistID;
$detailquery = "
SELECT
a.album_name, m.albumID,
b.artist_name, b.artistID,
m.track_num, t.track_name,
p.playlist_name, p.username
FROM libPlaylistTrackMap m
JOIN libplaylists p on p.playlistID = m.playlistID
JOIN libtrack t on t.albumID = m.AlbumID and t.track_num = m.track_num
JOIN libalbum a on a.albumID = m.AlbumID
JOIN libartist b on b.artistID = a.artistID
WHERE m.playlistID = ".$sPlaylistID."
LIMIT 1";
//Submit Queries
$details = mysql_query($detailquery, $link);
$list = mysql_query($tracksquery, $link);
//If query returns FALSE, no albums were returned. Die with error
if (!$list) die ('No Tracks returned, this album is fucked up: ' . mysql_error());
if (!$details) die ('No Tracks returned, this album is fucked up: ' . mysql_error());
$deet = mysql_fetch_assoc($details);
echo "
<div id='results'>
<div id='detail'>
<strong>".$deet['playlist_name']."</strong><br>
by <a href= 'p_profiles.php?dj=".$deet['username']."'>".$deet['username']." </a> <br>
</div>
<div id = 'list'>
<table>
<tr>
<th>Track</th>
<th>Album</th>
<th>Artist</th>
<th></th>
<tr>";
while ( $row = mysql_fetch_assoc($list) ) {
echo "<tr>
<td><a href = ''>".$row['track_name']."</a></td>
<td><a href = 'artistID=".$row['artistID']."''>".$row['artist_name']."</a></td>
<td><a href = 'albumID=".$row['albumID']."''>".$row['album_name']."</a></td>
<td>hp <a href='heart.php?liker=you&thing=albumID'> 14 </a></td>
</tr> ";
}
echo "</div>
</div>";
}
// detail - scheduled show name, time, username
// list - tracks played
else if( !empty($sShowID) ) {
$tracksquery = "
SELECT DISTINCT
l.lb_track_name, l.lb_artist,
l.lb_album, l.time_played,
a.album_name, a.albumID,
b.artist_name, b.artistID,
l.lb_track_num, t.track_name
FROM logbook l
LEFT JOIN libalbum a on a.album_code = l.lb_album_code
LEFT JOIN libtrack t on t.albumID = a.albumID and t.track_num = l.lb_track_num
LEFT JOIN libartist b on b.ArtistID = a.ArtistID
WHERE l.showID = ".$sShowID."
and l.played = 1
ORDER BY l.time_played ASC";
$detailquery = "
SELECT c.start_time, c.scheduleID, c.showID, sch.show_name, sh.username
FROM `show` c
LEFT JOIN schedule sch on c.scheduleID = sch.scheduleID
LEFT JOIN `schedule_hosts` sh on c.scheduleID = sh.scheduleID
WHERE c.showID = ".$sShowID."
LIMIT 1";
//Submit Queries
$details = mysql_query($detailquery, $link);
$list = mysql_query($tracksquery, $link);
//If query returns FALSE, no albums were returned. Die with error
if (!$list) die ('Somethings fucky: ' . mysql_error());
if (!$details) die ('fucky with the details ' . mysql_error());
$deet = mysql_fetch_assoc($details);
echo "
<div id='results'>
<div id='detail'>
<strong> <a href='p_profiles.php?scheduleID=".$deet['scheduleID']."'>".$deet['show_name']."</a></strong> ".$deet['start_time']."<br>
by <a href= 'p_profiles.php?dj=".$deet['username']."'>".$deet['username']." </a> <br>
</div>
<div id = 'list'>
<table>
<tr>
<th>Track</th>
<th>Artist</th>
<th>Album</th>
<th></th>
<tr>";
while ( $row = mysql_fetch_assoc($list) ) {
echo "<tr>
<td>".$row['lb_track_name']."</td>
<td><a href = 'p_library.php?artistID=".$row['artistID']."'>".$row['lb_artist']."</a></td>
<td><a href = 'p_library.php?albumID=".$row['albumID']."'>".$row['lb_album']."</a></td>
<td><img src='crystal2.png'> 13 <a href = ''>+</a></td>
</tr> ";
}
echo "</table></div>
</div>";
}
// Scheduled Show
// detail - DJ(s)
// list - playlists
else if(!empty($sScheduleID)) {
$showsquery = "
SELECT c.start_time, c.scheduleID, c.showID, sch.show_name, sh.username
FROM `show` c
LEFT JOIN schedule sch on c.scheduleID = sch.scheduleID
LEFT JOIN `schedule_hosts` sh on c.scheduleID = sh.scheduleID
WHERE c.scheduleID = ".$sScheduleID."
ORDER BY c.start_time DESC";
$detailquery = "
SELECT c.start_time, c.scheduleID, c.showID, sch.show_name, sh.username
FROM `show` c
LEFT JOIN schedule sch on c.scheduleID = sch.scheduleID
LEFT JOIN `schedule_hosts` sh on c.scheduleID = sh.scheduleID
WHERE c.scheduleID = ".$sScheduleID."
LIMIT 1";
//Submit Queries
$details = mysql_query($detailquery, $link);
$list = mysql_query($showsquery, $link);
//If query returns FALSE, no albums were returned. Die with error
if (!$list) die ('this scheduled show is fucky: ' . mysql_error());
$deet = mysql_fetch_assoc($details);
echo "<div id='results'>
<div id='detail'>
<strong>".$deet['show_name']."</strong><br>
by <a href= 'p_profiles.php?dj=".$deet['username']."'>".$deet['username']." </a> <br>";
echo "</div>
<div id='list'>
<table>
<tr>
<th>Shows</th>
<th></th>
<th></th>
</tr>";
//Get row from SQL Query, populate tables with shows
while($row = mysql_fetch_assoc($list)) {
echo "<tr>
<td><a href = 'p_profiles.php?showID=".$row['showID']."'>".$row['start_time']."</a></td>
<td><img src='crystal2.png'> 13 <a href = ''>+</a></td>
</tr> ";
}
echo "
</table>
</div>
</div>";
}
// DJ
// detail - name, info or whatever
// list - playlists by show
else if(!empty($dj)) {
$showsquery = "
SELECT c.start_time, c.scheduleID, c.showID, sch.show_name, sh.username
FROM `show` c
LEFT JOIN schedule sch on c.scheduleID = sch.scheduleID
LEFT JOIN `schedule_hosts` sh on c.scheduleID = sh.scheduleID
WHERE username = '".$dj."'
ORDER BY c.start_time DESC
LIMIT 50";
$playlistsquery = "
SELECT
p.playlist_name
FROM playlists p
WHERE p.username = ".$dj."
LIMIT 15";
$detailquery = "
SELECT c.start_time, c.scheduleID, c.showID, sch.show_name, sh.username
FROM `show` c
LEFT JOIN schedule sch on c.scheduleID = sch.scheduleID
LEFT JOIN `schedule_hosts` sh on c.scheduleID = sh.scheduleID
WHERE username = '".$dj."'
LIMIT 1";
//Submit Query
$details = mysql_query($detailquery, $link);
$list = mysql_query($showsquery, $link);
//If query returns FALSE, no albums were returned. Die with error
if (!$list) die ('No Tracks returned, this artist aint got shit: ' . mysql_error());
$deet = mysql_fetch_assoc($details);
echo "
<div id='results'>
<div id='detail'>
<strong>".$deet['username']."</strong><br>
<p>shows</p>
</div>
<div id='list'>
<table>
<tr>
<th>Show</th>
</tr> ";
//Get row from SQL Query, populate tables with Albums
while($row = mysql_fetch_assoc($list)) {
echo "
<tr>
<td><a href = 'p_profiles.php?scheduleID=".$row['scheduleID']."'>".$row['show_name']."</a></td>
<td><a href = 'p_profiles.php?showID=".$row['showID']."'>".$row['start_time']."</a></td>
<td><img src='crystal2.png'> 13</td>
</tr> ";
}
echo " </table>
</div>
</div>";
}
// list of everything
// filter by
// DJ
// - active
// - team
// SHOW
// - current
// - showtype
// - genre?
else { //nothing set
// default to list of latest shows/playlists -
// show/playlist name, username(s), date
$showsquery = "
SELECT c.start_time, c.scheduleID, sch.show_name, sh.username
FROM `show` c
LEFT JOIN schedule sch on c.scheduleID = sch.scheduleID
JOIN `schedule_hosts` sh on c.scheduleID = sh.scheduleID
ORDER BY c.start_time DESC
LIMIT 50";
//Submit Query
$list = mysql_query($showsquery, $link);
//If query returns FALSE, no albums were returned. Die with error
if (!$list) die ('WSBF is fucked: ' . mysql_error());
echo "
<div id = 'results'>
<div id = 'list'>
<table>
<tr>
<th>Show</a></th>
<th>DJ(s)</th>
<th>Time</td>
</tr> ";
//Get row from SQL Query, populate tables with albums
while($row = mysql_fetch_assoc($list)) {
echo " <tr>
<td><a href = 'p_profiles.php?scheduleID=".$row['scheduleID']."'>".$row['show_name']."</a></td>
<td><a href = 'p_profiles.php?dj=".$row['username']."'>".$row['username']."</a></td>
<td>".$row['start_time']."</td>
<td><img src='crystal2.png'> 13</td>
</tr>";
}
echo " </table>
</div>
</div>";
}
echo "
<script type = 'text/javascript'>
$('#search').click(function(event) {
$('#results').hide();
if ( $('#searchInput').attr('value') == 'Search: ' ) {
$('#searchInput').attr('value','');
$.post('p_search.php', function(data) {
$('#center').append(data);
});
}
$('#searchresults').show();
});
$('#centerlab a').click(function(event){
event.preventDefault();
var qs = $(this).attr('href');
$.post(qs, function(data) {
$('#center').html(data);
});
});
$('#results a').click(function(event){
event.preventDefault();
var qs = $(this).attr('href');
$.post( qs, function(data) {
$('#center').html(data);
});
});
</script>
";
?>