1)\r\n"; if($lastintro[0]>2){ //Last intro was too long ago - play intro and reset counter echo "Sending Intro because last intro was ".$lastintro[0]." songs ago\r\n"; copy('c:\\lor shows\\intro.lsc', 'c:\\lor shows\\weeksched.lsc'); $introfile = fopen('c:\\lor shows\\lastintro.txt', 'w'); fputs($introfile, "0"); fclose($introfile); }else{ echo "NOT Sending Intro because last intro was ".$lastintro[0]." songs ago\r\n"; $introfile = fopen('c:\\lor shows\\lastintro.txt', 'w'); $lastintroout = $lastintro[0]+1; fputs($introfile, $lastintroout); fclose($introfile); echo "\r\nTesting Elements: ".$elements." (remember test is for elements>-1)\r\n"; if($elements>-1){ echo "Elements: $elements\r\n\r\n"; echo "Current Entry: $contents[0]\r\n\r\n"; echo "Now Playing: ".substr($contents[0],1,1)."\r\n\r\n"; $nowplaying = "Request,".substr($contents[0],4,10).",".substr($contents[0],16,8).",".substr($contents[0],26,11).",".substr($contents[0],39,10); //Here we will replace the Schedule file with the next queued request $source = "C:\\lor shows\\".substr($contents[0],1,1).".lsc"; echo "Source: ".$source."\r\n\r\n"; copy($source, 'c:\\lor shows\\weeksched.lsc'); fputs($sourcefile, $nowplaying); $newqueue = fopen('c:\\lor shows\\queue.txt',"w"); for ($x=1;$x<=$elements;$x++){ echo "Next Line: $contents[$x]\r\n"; fputs($newqueue, $contents[$x]."\r\n"); } fclose($newqueue); echo "End of File!\r\n\r\n"; }else{ echo "No Queue Exists! Playing Full Show.\r\n\r\n"; //Here we will replace the current show with the full show because no requests are in the queue] //mod 10/17/2009: Use PHP Random Number Generator because LOR is broken! $rnum = rand(0,11); echo "\r\nTesting rnum: ".$rnum." ($rnum != $lastrnumber[0]) Num Elements: ".count($lastrnumber)."\r\n"; if($rnum == substr($lastrnumber[0],0,1)){ $randstat = "Regen"; $prevrand = $rnum; srand($rnum); $rnum = rand(0,11); }else{ $randstat = "Onegen"; } $fromfile = "c:\\lor shows\\".$rnum.".lsc"; copy($fromfile, 'c:\\lor shows\\weeksched.lsc'); fputs($sourcefile, "PHP RAND Show"); fputs($randfile,"Status: ".$randstat." Original Rand Num: ".$prevrand." New Rand Num: ".$rnum."\r\n"); $randfile2 = fopen('c:\\lor shows\\rand.txt', 'w'); fputs($randfile2,"$rnum"); } } fclose($sourcefile); fclose($randfile); ?>