Jump to content

Not loading correct file


advoor

Recommended Posts

Okay, im trying to make a online T.V kind of thing for a project. What the script is supposed to do is, check the day and the time, and then depending on the date and time, it should load a specific file with a different playlist.
I've used some basic functions to get it to work, but after getting some people to test it, i've found that it loads a older file then it should do. Can anyone see what is wrong with the script?

[code]
<?php
    $day = date("D");
    $time = date("G");
    $servertime = date("l");
    $file = "default.wmv";
    
//programs from 1 to 7

    if($time == "1" or "7") {
        if($day == "Mon") {
            $file = "monday_1_7.m3u";
        }
        elseif($day == "Tue") {
            $file = "tuesday_1_7.m3u";
        }
        elseif($day == "Wed") {
            $file = "wednesday_1_7.m3u";
        }
        elseif($day == "Thu") {
            $file = "thursday_1_7.m3u";
        }
        elseif($day == "Fri") {
            $file = "friday_1_7.m3u";
        }
        elseif($day == "Sat") {
            $file = "saturday_1_7.m3u";
        }    
        elseif($day == "Sun") {
            $file = "sunday_1_7.m3u";
        }
    }

//programs from 2 to 8

    if($time == "2" or "8") {
        if($day == "Mon") {
            $file = "monday_2_8.m3u";
        }
        elseif($day == "Tue") {
            $file = "tuesday_2_8.m3u";
        }
        elseif($day == "Wed") {
            $file = "wednesday_2_8.m3u";
        }
        elseif($day == "Thu") {
            $file = "thursday_2_8.m3u";
        }
        elseif($day == "Fri") {
            $file = "friday_2_8.m3u";
        }
        elseif($day == "Sat") {
            $file = "saturday_2_8.m3u";
        }    
        elseif($day == "Sun") {
            $file = "sunday_2_8.m3u";
        }
    }

//programs from 3 to 9

    if($time == "3" or "9") {
        if($day == "Mon") {
            $file = "monday_3_9.m3u";
        }
        elseif($day == "Tue") {
            $file = "tuesday_3_9.m3u";
        }
        elseif($day == "Wed") {
            $file = "wednesday_3_9.m3u";
        }
        elseif($day == "Thu") {
            $file = "thursday_3_9.m3u";
        }
        elseif($day == "Fri") {
            $file = "friday_3_9.m3u";
        }
        elseif($day == "Sat") {
            $file = "saturday_3_9.m3u";
        }    
        elseif($day == "Sun") {
            $file = "sunday_3_9.m3u";
        }
    }

//programs from 4 to 10

    if($time == "4" or "10") {
        if($day == "Mon") {
            $file = "monday_4_10.m3u";
        }
        elseif($day == "Tue") {
            $file = "tuesday_4_10.m3u";
        }
        elseif($day == "Wed") {
            $file = "wednesday_4_10.m3u";
        }
        elseif($day == "Thu") {
            $file = "thursday_4_10.m3u";
        }
        elseif($day == "Fri") {
            $file = "friday_4_10.m3u";
        }
        elseif($day == "Sat") {
            $file = "saturday_4_10.m3u";
        }    
        elseif($day == "Sun") {
            $file = "sunday_4_10.m3u";
        }
    }


//programs from 5 to 11


    if($time == "5" or "11") {
        if($day == "Mon") {
            $file = "monday_5_11.m3u";
        }
        elseif($day == "Tue") {
            $file = "tuesday_5_11.m3u";
        }
        elseif($day == "Wed") {
            $file = "wednesday_5_11.m3u";
        }
        elseif($day == "Thu") {
            $file = "thursday_5_11.m3u";
        }
        elseif($day == "Fri") {
            $file = "friday_5_11.m3u";
        }
        elseif($day == "Sat") {
            $file = "saturday_5_11.m3u";
        }    
        elseif($day == "Sun") {
            $file = "sunday_5_11.m3u";
        }
    }

//programs from 6 to 12

    if($time == "6" or "12") {
        if($day == "Mon") {
            $file = "monday_6_12.m3u";
        }
        elseif($day == "Tue") {
            $file = "tuesday_6_12.m3u";
        }
        elseif($day == "Wed") {
            $file = "wednesday_6_12.m3u";
        }
        elseif($day == "Thu") {
            $file = "thursday_6_12.m3u";
        }
        elseif($day == "Fri") {
            $file = "friday_6_12.m3u";
        }
        elseif($day == "Sat") {
            $file = "saturday_6_12.m3u";
        }    
        elseif($day == "Sun") {
            $file = "sunday_6_12.m3u";
        }
    }

?>
<body bgcolor="#666666">
<center>
<object id="VIDEO" width="320" height="240" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
      <param NAME="URL" value="<?php echo $file; ?>">
      <param NAME="AutoStart" value="-1">
      <param name="uiMode" value="full">
      <param name="PlayCount" value="9999">
      <param name="rate" value="1">
      <param name="balance" value="0">
      <param name="currentPosition" value="0">
      <param name="defaultFrame" value>
      <param name="currentMarker" value="0">
      <param name="invokeURLs" value="0">
      <param name="baseURL" value>
      <param name="volume" value="100">
      <param name="mute" value="0">
      <param name="stretchToFit" value="0">
      <param name="windowlessVideo" value="0">
      <param name="enabled" value="-1">
      <param name="enableContextMenu" value="0">
      <param name="fullScreen" value="0">
      <param name="SAMIStyle" value>
      <param name="SAMILang" value>
      <param name="SAMIFilename" value>
      <param name="captioningID" value>
      <param name="enableErrorDialogs" value="0">
      <param name="_cx" value="8467">
      <param name="_cy" value="6350">
</object>
<br><br>
<font color="FFFFFF">
The current server time is:
<?php
echo $servertime;
echo ", ";
echo $time;
echo " AM / PM (GMT)";
?>
</center>
[/code]
Link to comment
Share on other sites

Okay, ive uploaded the file at : [a href=\"http://www.advoor.net/vids/adult/watch.php\" target=\"_blank\"]http://www.advoor.net/vids/adult/watch.php[/a] (Warning, 18+ content)

If you look in the source code, it loads the saturday_6_12.m3u file, but the time is 7, so it should load the saturday_1_7.m3u file. Why it does this, i cant figure out.
Link to comment
Share on other sites

The lines like this:
[code]<?php if($time == "1" or "7")  ?>[/code]
should be written like:
[code]<?php if($time == "1" || $time == "7") ?>[/code]

That's the first think I saw. I may post more later.

It's later. :-)

Your code can be shortened considerably:
[code]<?php
    $day = strtolower(date("l"));
    $time = date("G");
    $servertime = date("l");
    $file_range = array('', '_1_7', '_2_8', '_3_9', '_4_10', '_5_11', '6_12', '_1_7', '_2_8', '_3_9', '_4_10', '_5_11', '6_12');
    $file = $day . $file_range[$time] . '.m3u';
?>[/code]

No more if statements at all, just get what you need out of an array and get the full day name.

Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.