<?php
$time=date("H:i",time());
$filename="timetable.txt";
$fp=fopen($filename,"r");
$data=fread($fp,filesize($filename));
$records=explode("\n",$data); //seperating records in the txt file
for ($i=0;$i<count($records)-1;$i++)
{
$fields=explode(",",$records[$i]); //seperating fields in the records
$url[$i]=$fields[0];
$t[$i]=$fields[1]; //$t is time
}
$j=0;
for ($i=0;$i<count($url);$i++)
{
if ($t[$i]>=$time)
{
$playlist[$j]=$url[$i];
$j++;
}
}
if (count($playlist)>0)
{
include "radio.class.php";
$radio=new music;
$radio->format="wma";
$radio->playlist=$playlist;
$radio->Start();
}
?>
|