Location: PHPKode > projects > Fretsweb > fretsweb-1.2/fretsweb/songs.php
<?php

/*
Fretsweb - A Frets on Fire chart server
Copyright (C) 2009  Daan Sprenkels

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/


// Include the common file
require_once "admin/common.php";

// Send headers for content-type
header('Content-Type: text/html; charset=utf-8');

// Include the language
require_once "lang/$language.php";


// Write header
print_header($lang['songs']);


if($_GET['sort'] == 'artist')
{
	$orderby = 'ORDER BY `artist` ASC';
}
else
{
	$orderby = 'ORDER BY `title` ASC';
}

// Fetch a list of songs, link not needed
$sql = "SELECT `hash`,`artist`,`title` FROM `contest_songs` WHERE `request` = '0' $orderby";
$query = mysql_query($sql);
if(mysql_num_rows($query) > 0 )
{
	echo "<table class=\"regular\"><tr><th><a href=\"{$_SERVER['PHP_SELF']}?sort=artist\">Artist</a></th>
	<th><a href=\"{$_SERVER['PHP_SELF']}?sort=title\">Title</a></th></tr>\n";
	$rows;
	while($row = mysql_fetch_assoc($query))
	{
		echo "<tr>
<td><a href=\"song.php?hash={$row['hash']}\">{$row['artist']}</a></td>
<td><a href=\"song.php?hash={$row['hash']}\">{$row['title']}</a></td>
</tr>";
	}
	echo "</table>";
}
else
{
	echo "<p>{$lang['no_songs']}</p>";
}


// Write a link to asksong.php if allowed
if($allowsongrequests)
{
	echo "<p><a href=\"asksong.php\">{$lang['click_here_request_song']}</a></p>";
}
echo "</div>";
include "admin/pagefooter.php";
echo "
</div>
</body>
</html>";


// Close database link
mysql_close( $db_link );

?>
Return current item: Fretsweb