-
Notifications
You must be signed in to change notification settings - Fork 1
/
playlist.php
138 lines (124 loc) · 4.8 KB
/
playlist.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
<?php
session_start();
include "console.php";
//console_log($_SESSION['signedin']);
//console_log($_SESSION['username']);
$servername = "127.0.0.1";
$username = "root";
$password = "passmysql";
$dbname = "music";
$conn = new mysqli($servername, $username, $password, $dbname);
// test connection
if ($conn->connect_error) {
die("connect to mysql,failed: " . $conn->connect_error);
}
$get_playlist_meta = "select * from playlist where playlistid = ".$_GET['playlistid'].";";
$result = $conn->query($get_playlist_meta);
$playlist_meta = $result->fetch_assoc();
//console_log($playlist_meta);
$get_playlist_song = "select * from Pcontain natural join Track where playlistid = ". $_GET['playlistid']." order by porder;";
$result = $conn->query($get_playlist_song);
$playlist_song = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$playlist_song[] = $row;
}
}
//console_log($playlist_song);
$conn->close();
?>
<meta charset="utf-8">
<title>Cloud Music</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<link href="mystyle.css" rel="stylesheet" type="text/css"/>
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<div class="demo-layout-transparent mdl-layout mdl-js-layout">
<header class="mdl-layout__header mdl-layout__header--transparent">
<div class="mdl-layout__header-row">
<!-- Title -->
<span class="mdl-layout-title">Cloud Music. Inc</span>
<!-- Add spacer, to align navigation to the right -->
<div class="mdl-layout-spacer"></div>
<!-- Navigation -->
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="feed.php">Feed</a>
<a class="mdl-navigation__link" href="profile.php">Profile</a>
<a class="mdl-navigation__link" href="musictaste.php">MusicTaste</a>
<a class="mdl-navigation__link" href="search.php">Search</a>
<a class="mdl-navigation__link" href="manage_playlist.php">Playlist</a>
</nav>
</div>
</header>
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">
<img src="assets/user.jpg" class="demo-avatar" >
<?php
echo $_SESSION['username'];
?>
</span>
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="feed.php">Feed</a>
<a class="mdl-navigation__link" href="profile.php">Profile</a>
<a class="mdl-navigation__link" href="musictaste.php">MusicTaste</a>
<a class="mdl-navigation__link" href="search.php">Search</a>
<a class="mdl-navigation__link" href="manage_playlist.php">Playlist</a>
</nav>
</div>
<main class="mdl-layout__content">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--2-col"></div>
<div class="mdl-cell mdl-cell--8-col">
<div class="demo-card-play mdl-card mdl-shadow--2dp">
<div class="mdl-card__title mdl-card--expand">
<h2 class="mdl-card__title-text">
<i class="material-icons mdl-list__item-icon">queue_music</i>
<?php
echo $playlist_meta['playlisttitle'];
?>
</h2>
</div>
<div class="mdl-card__supporting-text">
<ul class="demo-list-icon mdl-list">
<?php
echo '<li class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-icon">person</i>
<a target="_blank" href="user.php?username=' .
$playlist_meta['owner'].
'">' .
$playlist_meta['owner'].
'</a>
</span>
</li>';
foreach($playlist_song as $r){
echo '<li class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-icon">music_note</i>
<a target="_blank" href="play.php?trackid=' .
$r['trackid'].
'&source=playlist&pdesc='.
$_GET['playlistid'].
'">' .
$r['tracktitle'].
'</a>
</span>
</li>';
}
?>
</ul>
</div>
</div>
</div>
<div class="mdl-cell mdl-cell--2-col"></div>
</main>
<footer class="mdl-mini-footer">
<div class="mdl-mini-footer--left-section">
<ul class="mdl-mini-footer--link-list">
<li><a href="#">Help</a></li>
<li><a href="#">Privacy and Terms</a></li>
<li><a href="#">User Agreement</a></li>
</ul>
</div>
</footer>
</div>