-
Notifications
You must be signed in to change notification settings - Fork 3
/
user-songs.php
200 lines (175 loc) · 8.33 KB
/
user-songs.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
<?php
session_start();
require_once "./classes/db-connector.php";
use classes\DBConnector;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Songs</title>
<link rel="icon" type="image/png" href="assets/logos/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap 5.0.2 -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js" integrity="sha384-fbbOQedDUMZZ5KreZpsbe1LCZPVmfTnH7ois6mU1QK+m14rQ1l2bGBq41eYeM/fS" crossorigin="anonymous"></script>
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/audio-player.css">
</head>
<body>
<!-- Topbar -->
<div>
<div class="topbar">
<div class="modal-layer" id="layer" onclick="toogleSidebar()"></div>
<nav class="navbar navbar-expand-lg nav-dashboard shadow">
<button onclick="myFunction()" class="navbar-toggler p-2 rounded w-auto" style="transform: rotate(180deg)">
<img src="./assets/slider-icon.svg" alt="menu" class="menu-icon">
</button>
<button class="navbar-toggler p-2 rounded w-auto" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul>
<li>
<a href="user-premium.html">Premium</a>
</li>
<li>
<a href="artist-main.html">For Artists</a>
</li>
<li class="divider">|</li>
<li>
<a href="user-signup.php" id="signup" style="display: block">Sign Up</a>
</li>
<li class="text-center">
<a href="./scripts/logout.php" id="logout" style="display: none;">Logout</a>
</li>
<li>
<a href="./user-login.php" id="login" style="display: block;">Login</a>
</li>
<?php
if (isset($_SESSION["listener_id"]) || isset($_SESSION["artist_id"])) {
?>
<script>
document.getElementById("signup").style.display = "none";
document.getElementById("logout").style.display = "block";
document.getElementById("login").style.display = "none";
</script>
<?php
}
?>
</ul>
</div>
</nav>
</div>
</div>
<div class="main-container">
<?php
$con = DBConnector::getConnection();
$query2 = "SELECT song_name, album.album_name, album.thumbnail_url, artist.artist_name, artist.profile_pic_url, audio, lyrics
FROM song, album, artist WHERE song.artist_id=artist.artist_id AND song.album_id=album.album_id ORDER BY RAND() LIMIT 3";
$pstmt2 = $con->prepare($query2);
$pstmt2->execute();
$rows2 = $pstmt2->fetchAll(PDO::FETCH_NUM);
?>
<div class="row melomaniac-playlists">
<h2>Top Songs of the Week</h2>
<div class="list">
<?php
foreach($rows2 as $row){
?>
<div class="item">
<img src="<?php echo $row[2] ?>" />
<div class="play" onclick="playSong(
'<?php echo $row[0] ?>',
'<?php echo $row[3] ?>',
'<?php echo './'.$row[2] ?>',
'<?php echo './'.$row[4] ?>',
'<?php echo './'.$row[5] ?>',
'<?php echo './'.$row[6] ?>')">
<span class="fa fa-play play"></span>
</div>
<h4><?php echo $row[0] ?></h4>
<p>From <?php echo $row[1] ?></p>
</div>
<?php
}
?>
</div>
</div>
<?php
$con = DBConnector::getConnection();
$query2 = "SELECT song_name, album.album_name, album.thumbnail_url, artist.artist_name, artist.profile_pic_url, audio, lyrics
FROM song, album, artist WHERE song.artist_id=artist.artist_id AND song.album_id=album.album_id ORDER BY album.release_date LIMIT 4";
$pstmt2 = $con->prepare($query2);
$pstmt2->execute();
$rows2 = $pstmt2->fetchAll(PDO::FETCH_NUM);
?>
<div class="row melomaniac-playlists">
<h2>Most Streamed Songs All Time</h2>
<div class="list">
<?php
foreach($rows2 as $row){
?>
<div class="item">
<img src="<?php echo $row[2] ?>" />
<div class="play" onclick="playSong(
'<?php echo $row[0] ?>',
'<?php echo $row[3] ?>',
'<?php echo './'.$row[2] ?>',
'<?php echo './'.$row[4] ?>',
'<?php echo './'.$row[5] ?>',
'<?php echo './'.$row[6] ?>')">
<span class="fa fa-play play"></span>
</div>
<h4><?php echo $row[0] ?></h4>
<p>From <?php echo $row[1] ?></p>
</div>
<?php
}
?>
</div>
</div>
<?php
$con = DBConnector::getConnection();
$query2 = "SELECT song_name, album.album_name, album.thumbnail_url, artist.artist_name, artist.profile_pic_url, audio, lyrics
FROM song, album, artist WHERE song.artist_id=artist.artist_id AND song.album_id=album.album_id ORDER BY RAND(artist.artist_name) LIMIT 5";
$pstmt2 = $con->prepare($query2);
$pstmt2->execute();
$rows2 = $pstmt2->fetchAll(PDO::FETCH_NUM);
?>
<div class="row melomaniac-playlists">
<h2>Melomaniac Favorites</h2>
<div class="list">
<?php
foreach($rows2 as $row){
?>
<div class="item">
<img src="<?php echo $row[2] ?>" />
<div class="play" onclick="playSong(
'<?php echo $row[0] ?>',
'<?php echo $row[3] ?>',
'<?php echo './'.$row[2] ?>',
'<?php echo './'.$row[4] ?>',
'<?php echo './'.$row[5] ?>',
'<?php echo './'.$row[6] ?>')">
<span class="fa fa-play play"></span>
</div>
<h4><?php echo $row[0] ?></h4>
<p>From <?php echo $row[1] ?></p>
</div>
<?php
}
?>
</div>
</div>
<div style="margin-bottom: 180px;"></div>
</div>
<script src="https://kit.fontawesome.com/23cecef777.js" crossorigin="anonymous"></script>
<!-- Audio Player Rendered as a Template-->
<script src="js/render-player.js"></script>
<script src="js/audio-player.js"></script>
<script src="js/render-siderbar.js"></script>
<script src="js/render-topbar.js"></script>
</body>
</html>