📄 index.php
字号:
print("</table>\n");
}
/********** Song Functions **********/
function song() {
$id = addslashes($_GET['id']);
$array = addslashes($_GET['array']);
if( $array == 'yes' ) {
$id = split(",",$id);
}
print("<title>Musicbox Player version 2.1</title>");
print("<div id='XShell' style='position:absolute; left:0px; top:0px; width:470px; height:200px; z-index:1' topmargin='0' leftmargin='0' rightmargin='0' bottommargin='0'><img id='playerImg' src='player/skins/skin1default.jpg' width='468' height='200' border='0'></div>");
if( is_array($id)) {
foreach( $id as $cur_id ) {
if( $cur_id == '' ) {
break;
}
$query = "SELECT SUM(song.plays) as total_plays, AVG(song.rating/song.num_rating) as average_rating, song.id as song_id, song.lyric_id as lyric_id, song.lyrics_approved as lyrics, song.song_name as song_name, album.album_name as album_name, album.album_photo, artist.name AS artist_name, artist.id as artist_id, album.id as album_id FROM song, album, artist WHERE song.id = '".$cur_id."' AND album.id = song.album_id AND artist.id = song.artist_id GROUP BY song.id ORDER BY song.song_name ASC";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
print("<div id='ratealbum' style='position:absolute; left:309px; top:136px; z-index:19'><a href='javascript:rateSong(".$row['song_id'].")'><img border='0' src='images/".((round($song['average_rating'])<1)?'1':round($song['average_rating']))."_s.gif' alt='".round($song['average_rating'],2)."'></a></div>");
}
} else {
$cur_id = $id;
if( $cur_id == '' ) {
break;
}
$query = "SELECT SUM(song.plays) as total_plays, AVG(song.rating/song.num_rating) as average_rating, song.id as song_id, song.lyric_id as lyric_id, song.lyrics_approved as lyrics, song.song_name as song_name, album.album_name as album_name, album.album_photo, artist.name AS artist_name, artist.id as artist_id, album.id as album_id FROM song, album, artist WHERE song.id = '".$cur_id."' AND album.id = song.album_id AND artist.id = song.artist_id GROUP BY song.id ORDER BY song.song_name ASC";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
print("<div id='showpic' style='position:absolute; left:300px; top:62px; width:85px; height:100px; z-index:19'><img src='".$row['album_photo']."' width='80' height='70' alt='From album ".$row['album_name']."'></div>");
print("<div id='ratealbum' style='position:absolute; left:309px; top:136px; z-index:19'><a href='javascript:rateSong(".$row['song_id'].")'><img border='0' src='images/".((round($song['average_rating'])<1)?'1':round($song['average_rating']))."_s.gif' alt='".round($song['average_rating'],2)."'></a></div>");
}
$this->launch($id);
}
/********** Artist Functions **********/
function artist() {
$id = addslashes($_GET['id']);
if( $id != '' ) {
$this->displayArtist($id);
} else {
$this->listArtist();
}
}
function displayArtist( $id )
{
global $session;
$query = "SELECT * FROM artist WHERE artist.id = '".$id."'";
$result = mysql_query($query) or die(mysql_error());
$artist = mysql_fetch_assoc($result);
print("<title>".$artist['name']." All Albums</title>");
print("<table width='100%' cellspacing='1' cellpadding='1' bgcolor='#CBE9E9'> <tr><td width='100%' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><font face='arial' size='3'><b>".$artist['name']." All Albums</b></font></b></font></td></tr></table><br>\n");
print("<table width='100%' cellspacing='1' cellpadding='1' bgcolor='#CBE9E9'>\n\n");
print("<tr><td width='80' height='100' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><img src='".$artist['artist_photo']."' width='100' height='100' align=absmiddle hspace='5' vspace='3' border='1' ></td>\n");
print("<td width='100%' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><table border='0' bgcolor='#ECF2F2' cellpadding='0 cellspacing='2' width='100%' background='template/images/background.jpg'><tr><td valign='top' align='left' style='text-align:justify'><b>".$artist['name']."</b>\n");
if( $artist['url'] != '' ) {
print(" <br><b>Website:</b> <a href='".$artist['url']."' target='_blank'>Click here to visit</a>\n");
}
if( $artist['artist_info'] != '' ) {
print(" <br><b>Artist Info:</b><br>\n");
print($artist['artist_info']);
}
print("</td></tr></table></td></tr></table><br><br>");
$query = "SELECT * FROM `album` WHERE `artist_id` = '$id' ORDER BY album_name, album.album_photo, album.album_info";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
echo "<table><tr><td><a href='?action=album&id={$row['id']}'><img src='".$row['album_photo']."' width='100' height='99' border='0' align='left' hspace='5' vspace='1' ></a><a href='?action=album&id={$row['id']}'>{$row['album_name']}</a><br><font size='2'>{$row['album_info']}</font></td></tr></table>";
echo '';
/*
$query = "SELECT SUM(plays) as total_plays, AVG(rating/num_rating) as average_rating, id, song_name, lyrics_approved, lyric_id FROM song WHERE artist_id = '".$id."' GROUP BY id";
$result = mysql_query($query) or die(mysql_error());
print("<form name='listing' action='".$this->thisfile."?action=launch' method='post'>\n");
print("<table cellspacing='1' cellpadding='4' width='100%' bgcolor='#CBE9E9' border='0'>\n");
$this->topButtons();
$alternateColor = TRUE;
$colorLight = "ECF2F2";
$colorDark = "FFFFFF";
while( $song = mysql_fetch_assoc($result) )
{
if ($alternateColor == TRUE)
{
print("<tr><td bgcolor='#".$colorLight."' width='100%'><table>\n");
$alternateColor = FALSE;
}
else
{
print("<tr><td bgcolor='#".$colorDark."' width='100%'><table>\n");
$alternateColor = TRUE;
}
print("<tr><td style='width:20px; text-align:center' cellspacing='1' cellpadding='4'><input type='checkbox' name='song_id' value='".$song['id']."' /></td><td><a href='javascript:playSong(".$song['id'].")'>".$song['song_name']."</a> <a href='javascript:rateSong(".$song['id'].");'><img border='0' src='images/".((round($song['average_rating'])<1)?'1':round($song['average_rating']))."_s.gif' alt='".round($song['average_rating'],2)."'></td><td>".(($song['lyrics_approved']==1)?"<img src='images/lyrics_txt.gif' onClick='javascript:showLyrics(".$song['lyric_id'].");' alt='Lyrics' border='0'>":" ")."</td><td style='text-align: right;' ><a href='javascript:mailFriend(0,0,".$song['id'].",0)'><img src='images/mail.gif' alt='Email this Song' border='0'></a></td></tr>\n");
print("<tr><td colspan='1'> </td><td colspan='3'><span>Times Played</span> ".$song['total_plays']." ".(($session->logged_in)?"<a href='javascript:addToPlaylist(".$song['id'].")'><font color='#CD238F'>Add to Playlist</font></a> ":"").(($song['lyrics_approved']!=1)?" <a href='".$this->thisfile."?action=addlyrics&song=".$song['id']."'><font color='#9A17C5'>Add Lyrics</font></a>":"")."</td></tr>\n");
}
print("</table>\n");
$this->bottomButtons();
print("</form>\n");
*/
print("\n</div>\n");
}
function listArtist() {
$sortby = addslashes($_POST['sort']);
$query = "SELECT id, name FROM artist";
$result = mysql_query($query) or die(mysql_error());
print("<title>Musicbox - List of Artists</title>
<font face='arial' size='3'><b>List of Artists</b></font><br>");
// number of items per column
$columnTracks = 2;
$artistCounter = 0;
$columnBegin = TRUE;
// loop printing out the information on the screen
$lastchar = '';
while( $artist = mysql_fetch_assoc($result) )
{
// get initial name character
$thischar = $artist['name']{0};
if ($columnBegin == TRUE) {
print("<table border='0' width='100%' id='table1' cellspacing='10' cellpadding='0'>\n<tr>\n<td>");
$columnBegin = FALSE;
}
if ($artistCounter == $columnTracks) {
print("</td>\n<td bgcolor='#000000' width='1'></td>\n<td>");
$artistCounter = 0;
}
// Check to see if different than last
if( $lastchar != $thischar ) {
print("<b>".$thischar."</b><br>\n");
if( $lastchar != '' ) {
print("\n");
}
}
// Print album Info
print("<a class=text href='".$this->thisfile."?action=artist&id=".$artist['id']."'>".$artist['name']."</a>\n<br>");
// Store character
$lastchar = $thischar;
$artistCounter++;
}
print("</td></tr></table>\n");
print("");
}
/********** Album Functions **********/
function album() {
$id = addslashes($_GET['id']);
if( $id != '' ) {
$this->displayalbum($id);
} else {
$this->listalbums();
}
}
function displayalbum( $id )
{
global $session;
$query = "SELECT TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, album.album_name, artist.name as artist_name, album.album_photo, album.album_info, artist.id as artist_id FROM album, artist WHERE album.id = '".$id."' AND album.artist_id = artist.id";
$result = mysql_query($query) or die(mysql_error());
$album = mysql_fetch_assoc($result);
print("<title>".$album['artist_name']." - ".$album['album_name']."</title>");
print("<table width='100%' cellspacing='1' cellpadding='1' bgcolor='#CBE9E9'> <tr><td width='100%' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><font face='arial' size='3'><b>".$album['artist_name']." - ".$album['album_name']."</b></font></td></tr></table><br>\n");
print("<table width='100%' cellspacing='1' cellpadding='1' bgcolor='#CBE9E9'>\n\n");
print("<tr><td width='80' height='100' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><img src='".$album['album_photo']."' width='100' height='100' align='left' hspace='5' vspace='3' border='1'></td>\n");
print("<td width='100%' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><table border='0' bgcolor='#ECF2F2' cellpadding='0 cellspacing='2' width='100%' background='template/images/background.jpg'><tr><td valign='top' align='left' style='text-align:justify'><b>".$album['album_name']." ".(($album['date_diff']<14)?"<img src='images/new.gif'
alt='New'>":"")."</b><br>\n");
print("<b>Artist:</b> <a href='".$this->thisfile."?action=artist&id=".$album['artist_id']."'>".$album
['artist_name']."</a>\n");
if( $album['album_info'] != '' ) {
print("<br><b>Album Info:</b><br>\n");
print($album['album_info']);
}
print("</td></tr></table></td></tr></table><br><br>");
$query = "SELECT SUM(plays) as total_plays, AVG(rating/num_rating) as average_rating, id, song_name, lyrics_approved, lyric_id FROM song WHERE album_id = '".$id."' GROUP BY id";
$result = mysql_query($query) or die(mysql_error());
print("<form name='listing' action='".$this->thisfile."?action=launch' method='post'>\n");
print("<table cellspacing='1' cellpadding='4' width='100%' bgcolor='#CBE9E9' border='0'>\n");
$this->topButtons();
$alternateColor = TRUE;
$colorLight = "ECF2F2";
$colorDark = "FFFFFF";
while( $song = mysql_fetch_assoc($result) )
{
if ($alternateColor == TRUE)
{
print("<tr><td bgcolor='#".$colorLight."' width='100%'><table>\n");
$alternateColor = FALSE;
}
else
{
print("<tr><td bgcolor='#".$colorDark."' width='100%'><table>\n");
$alternateColor = TRUE;
}
print("<tr><td width='20px' align='left' cellspacing='1' cellpadding='4'><input type='checkbox' name='song_id' value='".$song['id']."' /></td><td width='100%'><a href='javascript:playSong(".$song['id'].")'><b><font color='#000000' size='2' face='arial'>".$song['song_name']."</font></b></a> <a href='javascript:rateSong(".$song['id'].");'><img border='0' src='images/".((round($song['average_rating'])<1)?'1':round($song['average_rating']))."_s.gif' alt='".round($song['average_rating'],2)."'></td><td align='right'> ".(($song['lyrics_approved']==1)?"<img src='images/lyrics_txt.gif' onClick='javascript:showLyrics(".$song['lyric_id'].");' alt='Lyrics' border='0'>":" ")." </td><td style='text-align: right;' ><a href='javascript:mailFriend(0,0,".$song['id'].",0)'><img src='images/mail.gif' alt='Email this Song' border='0'></a></td></tr>\n");
print("<tr><td colspan='1'> </td><td colspan='3'><font color='#666666'>Times Played</span> ".$song['total_plays']." ".(($session->logged_in)?"<a href='javascript:addToPlaylist(".$song['id'].")'><font color='#CD238F'>Add to Playlist</font></a> ":"").(($song['lyrics_approved']!=1)?" <a href='".$this->thisfile."?action=addlyrics&song=".$song['id']."'><font color='#cc000'>Add Lyrics</font></a>":"")."</td></tr>\n");
print("</table></td></tr>\n");
}
print("</table>\n");
$this->bottomButtons();
print("</form>\n");
print("\n</div>\n");
}
function listalbums() {
$sortby = addslashes($_POST['sort']);
/**
* Only list 5 newest albums if this is the homepage
*/
if (!$_GET)
$query = "SELECT TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, album.album_name, artist.name as artist_name, album.album_photo, album.album_info, album.id as album_id, artist.id as artist_id FROM album, artist WHERE album.artist_id = artist.id ORDER BY album.post_date DESC LIMIT 5";
else
$query = "SELECT TO_DAYS(now())-TO_DAYS(album.post_date)as date_diff, album.album_name, artist.name as artist_name, album.album_photo, album.album_info, album.id as album_id, artist.id as artist_id FROM album, artist WHERE album.artist_id = artist.id ORDER BY album.post_date DESC LIMIT 5";
$result = mysql_query($query) or die(mysql_error());
print("<table width='100%' cellspacing='1' cellpadding='1' bgcolor='#CBE9E9'> <tr><td width='100%' align='left' valign='top' bgcolor='#ECF2F2' background='template/images/background.jpg'><font face='arial' size='3'><b>5 Newest Releases</b></font></td></tr></table>");
print("<div id='content'>\n");
$lastchar = '';
while( $album = mysql_fetch_assoc($result) )
{
// get initial name character
if( $sortby == 'album' ) {
$thischar = $album['album_name']{0};
$display = $album['album_name']." - ".$album['artist_name'];
} else {
$thischar = $album['artist_name']{0};
$display = $album['artist_name']." - ".$album['album_name'];
}
// Check to see if different than last
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -