PHP Classes

File: start_timetable.php

Recommend this page to a friend!
  Classes of Rahman Haghparast   Radio   start_timetable.php   Download  
File: start_timetable.php
Role: Example script
Content type: text/plain
Description: a php initialzation file for time table mode
Class: Radio
Create an online radio for serving music playlists
Author: By
Last change:
Date: 19 years ago
Size: 648 bytes
 

Contents

Class file image Download
<?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();
}
?>