$username = "oddsock";
$password = "";
$database = "oddsock";
$max_per_page = 10;
$start = $_GET["start"];
$num = $_GET["num"];
$sgenre = $_GET["sgenre"];
$stype = $_GET["stype"];
$search = $_GET["search"];
$link = mysql_connect("localhost", $username, $password);
mysql_select_db($database);
if ($num) {
$pagesize = $num;
}
else {
$pagesize = $max_per_page;
}
function contentTypeLookup($content_type, $server_subtype) {
if ($content_type == "application/x-ogg") {
return "Ogg Vorbis";
}
if ($content_type == "application/ogg") {
if (preg_match("/theora/i", $server_subtype)) {
return "Ogg Theora";
}
else if (preg_match("/vorbis/i", $server_subtype)) {
return "Ogg Vorbis";
}
return "Ogg Vorbis";
}
if ($content_type == "audio/mpeg") {
return "MP3 Audio";
}
if ($content_type == "audio/x-mpeg") {
return "MP3 Audio";
}
if ($content_type == "video/nsv") {
return "NSV Video";
}
if ($content_type == "audio/aac") {
return "AAC Audio";
}
if ($content_type == "audio/aacp") {
return "AAC+ Audio";
}
return $content_type;
}
function getPrevLink($current, $pagesize, $rowcounter) {
global $search;
global $sgenre;
global $stype;
if (($current - $pagesize) < 0) {
$prev = -1;
}
else {
$prev = $current - $pagesize;
}
$extra = "";
if ($search) {
$extra .= "&search=".urlencode($search);
}
if ($sgenre) {
$extra .= "&sgenre=".urlencode($sgenre);
}
if ($stype) {
$extra .= "&stype=".urlencode($stype);
}
if ($prev >= 0) {
return "Prev";
}
else {
return "";
}
}
function getNextLink($current, $pagesize, $rowcounter) {
global $search;
global $sgenre;
global $stype;
if ($rowcounter < $pagesize) {
return "";
}
$next = $current + $pagesize;
$extra = "";
if ($search) {
$extra .= "&search=".urlencode($search);
}
if ($sgenre) {
$extra .= "&sgenre=".urlencode($sgenre);
}
if ($stype) {
$extra .= "&stype=".urlencode($stype);
}
return "Next";
}
function getContentTypes() {
$query = "select distinct(server_type) from server_details";
$result = mysql_query($query);
if (!$result) {
print "
Mysql Error: ".mysql_error()."!
";
}
$result_string = "Format Search ";
$result_string .= "";
return $result_string;
}
function getTotalListeners() {
$query = "select sum(listeners) from servers where yp_status = 'verified'";
$result = mysql_query($query);
if (!$result) {
print "
Mysql Error: ".mysql_error()."!
";
}
$row = mysql_fetch_row($result);
if ($row) {
return $row[0];
}
}
function getTotalServers() {
$query = "select count(*) from servers a, server_details b where a.id = b.parent_id and a.yp_status = 'verified'";
$result = mysql_query($query);
if (!$result) {
print "
'.$description_tag.'Now playing on '.$mountpoint.' : '.substr($current_song, 0, 100).'
'.substr($genre, 0, 30).'
'.$audio_info.'
';
return $streamLine;
}
?>
$directory_data = '
Listen
Streams
Genre
Audio Info
';
$query = "select id, server_name, listeners from servers where yp_status = 'verified' order by rank desc";
$subquery = "";
if ($sgenre) {
$query = "select a.id, a.server_name, a.listeners from servers a, server_details b where a.id = b.parent_id and b.genre like '%$sgenre%' and yp_status = 'verified' group by a.id, a.server_name, a.listeners order by a.rank desc";
$subquery = "and genre like '%$sgenre%'";
}
if ($stype) {
$query = "select a.id, a.server_name, a.listeners from servers a, server_details b where a.id = b.parent_id and b.server_type like '%$stype%' and yp_status = 'verified' group by a.id, a.server_name, a.listeners order by a.rank desc";
$subquery = "and server_type like '%$stype%'";
}
if ($search) {
$query = "select a.id, a.server_name, a.listeners from servers a, server_details b where a.id = b.parent_id and (a.server_name like '%$search%' or b.description like '%$search%' or b.current_song like '%$search%' or b.genre like '%$search%') and yp_status = 'verified' group by a.id, a.server_name, a.listeners order by a.rank desc";
$subquery = "and (server_name like '%$search%' or description like '%$search%' or current_song like '%$search%' or genre like '%$search%')";
}
$result = mysql_query($query);
if (!$result) {
print "
Mysql Error: ".mysql_error()."!
";
}
$row_counter = 0;
$printed = 0;
while ($row = mysql_fetch_row($result)) {
$row_counter++;
if ($start) {
if ($row_counter < $start) {
continue;
}
}
if ($pagesize) {
if ($printed >= $pagesize) {
break;
}
}
$id = $row[0];
$server_name = htmlentities($row[1]);
$listeners = htmlentities($row[2]);
$cluster_flag = 0;
if ($cluster_id != "") {
$cluster_flag = 1;
}
if ($swap) {
$swap = 0;
$bgcolor = "#222222";
}
else {
$swap = 1;
$bgcolor = "#444444";
}
if ($cluster_flag) {
$cluster_text = "cluster";
}
else {
$cluster_text = "";
}
if ($server_name != "") {
$all_listeners = $listeners;
$clustercount = 1;
$query = "select description, genre, url, current_song, listen_url, server_type, bitrate, samplerate, channels, listeners+0, parent_id, id, playlist_id, server_subtype from server_details where parent_id = $id $subquery group by cluster_password";
$streamDetailsLine = "";
$result2 = mysql_query($query);
if (!$result2) {
print "