KRCC-FM Real-time Playlist
// set var to tell if we are using the current date
$current = 0; // not using current.
if ($debug) { print "uMon=$uMon, uDay=$uDay, uYear=$uYear, uHour=$uHour \n"; }
$dNow = date("D M j, Y g:i a");
$dNow .= " Mountain Time";
// check to see if the user provided mon day, year and hour.
if ($uMon == "" && $uDay == "" && $uYear == "" && $uHour == "")
{ ++$current; }
else
{ if ($uMon == date("m")) { ++$current; }
if ($uDay == date("d")) { ++$current; }
if ($uYear == date("Y")) { ++$current; }
if ($uHour == date("H")) { ++$current; }
// if user is using the current date and time then let the program know
if ($current == 4)
{ $uMon = $uDay = $uYear = $uHour = "";
$current = 1;
}
else
{ $current = 0;
// check to make sure the date is good
if (!checkdate($uMon,$uDay,$uYear))
{ $badDateTime = " The date you submitted $uMon-$uDay-$uYear is not correct, please, resubmit. ";
$uMon = "";
$uDay = "";
$uYear = "";
$uHour = "";
$uMin = "";
++$current;
}
else
{
// check to make sure the time is good
if ($uHour < 00 || $uHour > 23)
{ $badDateTime .= " The hour you submitted $uHour is not correct, please resubmit. ";
$uMon = "";
$uDay = "";
$uYear = "";
$uHour = "";
$uMin = "";
++$current;
}
}
}
} // if user provided date and time
if ($debug) { print "$badDateTime \n"; }
if ($current)
{ // set up for pull
print("");
}
?>
//iTunesSearch is called when the iTunes links in the play list are clicked. (kto)
?>
//get current date and set up search date and time
#$uMon = 9;
#$uDay = 31;
#$uYear = 1999;
$now = date("Y-m-d H:i");
//Next line figures out what the previous play list time would be (kto)
$prevtime = mktime(date("H") - 1, 0, 0, date("m"), date("d"), date("Y"));
if ($debug) { print "ulist $uList prevtime $prevtime \n"; }
$uMon != "" ? $sMon = $uMon : $sMon = date("m");
$uDay != "" ? $sDay = $uDay : $sDay = date("d");
$uYear != "" ? $sYear = $uYear : $sYear = date("Y");
//Next line checks if we're to display the previous play list or not. (kto)
if ($fore) {$uHour = date("H",$prevtime); }
if ($debug) { print "uhour $uHour \n"; }
if ($uHour != "")
{ $sHourStart = "$uHour:00";
}
else
{ $sHourStart = date("H");
$sHourStart .= ":00";
}
$sHourEnd = $sHourStart + 1;
if ($sHourEnd < 10) { $sHourEnd = "0$sHourEnd"; }
$sHourEnd .= ":00";
$uMin != "" ? $sMin = $uMin : $sMin = date("i");
if ($debug) print ("Now=$now, dNow=$dNow \n sMon=$sMon, sDay=$sDay, sYear=$sYear, sHourStart=$sHourStart, sHourEnd=$sHourEnd \n");
// MySQL Connection Information
$dbLink = mysql_connect("oregon.coinfotech.com","moorei_krcc","dElaney915");
mysql_select_db("moorei_krcc") || print "Can not log into database \n";
// set up search date time for display reading
$query = "select date_format(\"$sYear-$sMon-$sDay $sHourStart\",\"%a %M %d, %Y %l:%i %p\") as search_datetime, time_format(\"$sHourEnd\",\"%l:%i %p\") as sHourEnd";
$query = stripslashes($query);
if ($debug) { print "\$query=$query \n"; }
$dbResult = mysql_query($query, $dbLink);
$row = mysql_fetch_array($dbResult,MYSQL_ASSOC);
$search_datetime = $row[search_datetime];
$d_sHourEnd = $row[sHourEnd];
$search_datetime .= " to $d_sHourEnd";
if ($debug) { print "search_datetime = $search_datetime \n"; }
if ($current) { print "
This page will update automatically every three minutes.
"; }
?>
Current time is: print($dNow) ?>
Playlist for: print ("$search_datetime"); ?>
Program Information...
// set up the search string
$sstr = "date = \"$sYear-$sMon-$sDay\" and time between \"$sHourStart\" and \"$sHourEnd\"";
// show DJ
$query = "select dj,program,email from airlog where $sstr order by time desc limit 1";
$query = stripslashes($query);
if ($debug) { print "\$query=$query \n"; }
$row = mysql_num_rows($dbResult = mysql_query($query, $dbLink));
// not sure if this is a good thing.
//if ($rows < 1)
//{ // see if we can get data from the previous hour
// if ($sHourStart != "00:00")
// { $sHour = ereg_replace(":[0-9]+","",$sHourStart);
// --$sHour;
// $sHourStart = "$sHour:00";
// $sstr = "date = \"$sYear-$sMon-$sDay\" and time between \"$sHourStart\" and \"$sHourEnd\"";
// $query = "select dj,program,email from airlog where $sstr order by time desc limit 1";
// $query = stripslashes($query);
// if ($debug) { print "\$query=$query \n"; }
// $row = mysql_num_rows($dbResult = mysql_query($query, $dbLink));
// }
//}
if ($row > 0)
{ $row = mysql_fetch_array($dbResult,MYSQL_ASSOC);
$dj = $row[dj];
$ddj = $dj;
if ($row[email]) { $ddj = "{$row[dj]}"; }
print ("DJ: $ddj Show: {$row["program"]}");
}
else
{ print "No DJ Information found for the requested date and time"; }
// done with dj and program info
?>
Playlist Archives
// show the archive date and time section
// set up the months
$m_sed[$sMon] = "SELECTED";
if ($debug) { print "sMon=$sMon \n"; }
$month_select = "";
// set up day
$d_sed["$sDay"] = "SELECTED";
if ($debug) { print "sDay=$sDay \n"; }
$day_select =
"";
// set up year
$y_sed["$sYear"] = "SELECTED";
if ($debug) { print "sYear=$sYear \n"; }
$year_select = "";
// set up hour
#$sHour = $sHourStart;
$sHour = ereg_replace(":[0-9]+","",$sHourStart);
if ($debug) { print "sHour=$sHour \n"; }
$h_sed["$sHour"] = "SELECTED";
$hour_select =
"";
print ("
\n$badDateTime Previous Play List | Current Play List");
// end of archive section
?>
// show information during the time section
$query = "select time as sorttime, time_format(time,\"%l:%i\") as time,artist,song,title,label,comment from airlog where $sstr order by sorttime desc";
$query = stripslashes($query);
if ($debug) { print "\$query=$query \n"; }
if (mysql_num_rows($dbResult = mysql_query($query, $dbLink)) > 0)
{ print "
Time
Artist
Song
Album
";
while ($row = mysql_fetch_array($dbResult,MYSQL_ASSOC))
{ // see if this row is an air break
print "
";
}
print $line . "\n" . $comment;
} // while end
print "
\n";
print "
\n";
}
else
{ print "
No Data found for the following date and time: $search_datetime. Please use the playlist archives to find the correct date and time.
"; }
?>
Mysql_close($dbLink); ?>
KRCC receives a portion of the proceeds from every song you purchase at iTunes through our playlist. You must have iTunes installed on your computer. To download iTunes [CLICK HERE]. Note: iTunes may not have every song we play, or our spelling might differ.