-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsong.php
executable file
·58 lines (54 loc) · 2.15 KB
/
song.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
<?php
require 'includes/script.php';
$lastfm = new LastFM("092d316884d8385f35ad8b84f5f42ef8");
error_reporting(E_ALL ^ E_WARNING);
$track = $_GET['track'];
$artist = $_GET['artist'];
$track = str_replace('’', '\'', $track);
if ($track != null && $artist != null):
$trackInfo = $lastfm->getTrackInfo(str_replace(' ','+', $artist), str_replace(' ', '+', $track), $_GET["user"]);
endif;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href='style.css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="includes/style.css">
<title><?= $track ?> | <?= $artist ?></title>
<form>
<input id="back" type="button" value="back" onclick="history.go(-1)">
</form>
</head>
<body>
<div class="artist-title">
<?php if ($artist === null || $track === null): ?>
<h3>song not found.</h3>
<?php else: ?>
<div id="artist-name"><?= $artist ?></div>
<div id="track-name"><?= $track ?></div>
<?php endif;
foreach($trackInfo->track as $k=>$v): ?>
<div id="play-count"><?=$_GET["user"]?> has listened to this song <?= $v->userplaycount; ?> times</div>
<?php endforeach; ?>
</div>
<div class="information">
<div class="album-picture">
<?php foreach($trackInfo->track as $k=>$v):
foreach($v->album as $f=>$g):?>
<img src="<?= $g->image[3]; ?>" alt="unable to load">
<?php endforeach;
endforeach; ?>
</div>
<div class="album-information">
<?php foreach($trackInfo->track as $k=>$v):
foreach($v->wiki as $f=>$g):
$string = substr($g->summary, 0, strpos($g->summary, "<a"))?>
<?= $string . "test"; ?>
<?php endforeach;
endforeach; ?>
</div>
</div>
</body>
</html>