How can I show different html based on time of day? perhaps php code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfy
    Confirmed User
    • Dec 2003
    • 3574

    #1

    How can I show different html based on time of day? perhaps php code?

    I need to embed a flash file from 8-midnight CST (server time), and a different bit of html at all other times.

    Like
    Code:
    [I]From 8-midnight embed this movie[/I]
    
    then
    
    [I]all other times use this html.[/I]
    How do I do this?
  • Juicy D. Links
    So Fucking Banned
    • Apr 2001
    • 122992

    #2
    http://www.askapache.com/htaccess/ti...cond-time.html

    Comment

    • KimJI
      Confirmed User
      • May 2007
      • 1839

      #3
      Originally posted by Juicy D. Links
      Holy shit. Did Juicy just make a serious webmaster related reply? Or this one of the outsourced monkey that forgot what character he was logged in with?
      Trafficadept | Best traffic I have ever tested | web "@t" cuul.org

      Comment

      • Wolfy
        Confirmed User
        • Dec 2003
        • 3574

        #4
        thanks Big D

        Comment

        • RawAlex
          So Fucking Banned
          • Oct 2003
          • 9465

          #5
          Juicy likes pie... and apache!

          Comment

          • quantum-x
            Confirmed User
            • Feb 2002
            • 6863

            #6
            <? if (date('G') >= 8 && date('G') >= 12) { ?>

            Alternate code

            <? } else { ?>

            Other code

            <? } ?>
            PrettyInCash.com - BoozedGFs.com - TeenGFs.com - JizzGFs.com- MilfUploads.com -

            Comment

            • Juicy D. Links
              So Fucking Banned
              • Apr 2001
              • 122992

              #7
              Originally posted by KimJI
              Holy shit. Did Juicy just make a serious webmaster related reply? Or this one of the outsourced monkey that forgot what character he was logged in with?
              i gave them off for the weekend , they be back on Tues

              Comment

              • Wolfy
                Confirmed User
                • Dec 2003
                • 3574

                #8
                Damn - I tried the mod rewrite Juicy sent me. It worked fine at first, but it didn't switch it back at the appropriate hour.


                Originally posted by quantum-x
                <? if (date('G') >= 8 && date('G') >= 12) { ?>

                Alternate code

                <? } else { ?>

                Other code

                <? } ?>

                So I tried tat one, and it doesn't seem to be working either.

                Anyone can help me with this? 169334379

                Comment

                • uno
                  RIP Dodger. BEST.CAT.EVER
                  • Dec 2002
                  • 18450

                  #9
                  Originally posted by KimJI
                  Holy shit. Did Juicy just make a serious webmaster related reply? Or this one of the outsourced monkey that forgot what character he was logged in with?
                  I think someone hacked his nick.
                  -uno
                  icq: 111-914
                  CrazyBabe.com - porn art
                  MojoHost - For all your hosting needs, present and future. Tell them I sent ya!

                  Comment

                  • GrouchyAdmin
                    Now choke yourself!
                    • Apr 2006
                    • 12085

                    #10
                    Originally posted by Wolfy
                    So I tried tat one, and it doesn't seem to be working either.

                    Anyone can help me with this? 169334379
                    You need to set it to run at whatever your server time is, offset from yours. So if the server thinks it's 10, and you think it's 8, you set it for 10. If it didn't work at all, php short tags are off, replace the <? part with <?php and it should work.

                    Comment

                    • J4ck
                      Confirmed User
                      • Apr 2007
                      • 254

                      #11
                      Originally posted by uno
                      I think someone hacked his nick.
                      LOLLL
                      Regards,
                      Jack
                      ICQ: 1-739-018


                      Become affiliate now!

                      Comment

                      • quantum-x
                        Confirmed User
                        • Feb 2002
                        • 6863

                        #12
                        Originally posted by Wolfy
                        Damn - I tried the mod rewrite Juicy sent me. It worked fine at first, but it didn't switch it back at the appropriate hour.





                        So I tried tat one, and it doesn't seem to be working either.

                        Anyone can help me with this? 169334379

                        Sure it does.
                        If you need assitance, you can ICQ me for my hourly rate.
                        PrettyInCash.com - BoozedGFs.com - TeenGFs.com - JizzGFs.com- MilfUploads.com -

                        Comment

                        • Wolfy
                          Confirmed User
                          • Dec 2003
                          • 3574

                          #13
                          i just sent you an ICQ.


                          Hopefully your hourly rate is pro-rateable, since this should take you a couple seconds to fix :D

                          Comment

                          • psili
                            Confirmed User
                            • Apr 2003
                            • 5526

                            #14
                            I suck at programming, so if you try the following, you might be insane.

                            Code:
                            <?PHP
                             // default to all hours
                             $flash = "<object....><embed....></embed></object>";
                             // test time frame
                             if( date("H") >= 20 && date("H") != 0 ) 
                             {
                               $flash = "<object...>new shit<embed...>new shit</embed></object>";
                             }
                            ?>
                            Code:
                             <html>
                               <body>
                                <?PHP echo($flash); ?>
                               </body>
                             </html>
                            Again, I'll make no excuses for the above blowing up a server. Sorry. I like to bump threads sometimes with uselessnessnessness....ness.
                            Your post count means nothing.

                            Comment

                            • psili
                              Confirmed User
                              • Apr 2003
                              • 5526

                              #15
                              I do suck at programming... maybe the PHP "if" statement could have simply been:

                              if( date("H") >= 20 ) // 'H'
                              {
                              .. blah blah
                              }

                              anyway... back to nonsense.


                              Originally posted by psili
                              I suck at programming, so if you try the following, you might be insane.

                              Code:
                              <?PHP
                               // default to all hours
                               $flash = "<object....><embed....></embed></object>";
                               // test time frame
                               if( date("H") >= 20 && date("H") != 0 ) 
                               {
                                 $flash = "<object...>new shit<embed...>new shit</embed></object>";
                               }
                              ?>
                              Code:
                               <html>
                                 <body>
                                  <?PHP echo($flash); ?>
                                 </body>
                               </html>
                              Again, I'll make no excuses for the above blowing up a server. Sorry. I like to bump threads sometimes with uselessnessnessness....ness.
                              Your post count means nothing.

                              Comment

                              • Wolfy
                                Confirmed User
                                • Dec 2003
                                • 3574

                                #16
                                somebody ICQ me please - 169334379

                                Comment

                                • Wolfy
                                  Confirmed User
                                  • Dec 2003
                                  • 3574

                                  #17
                                  bargitty barg barg barg

                                  COME ON!!!!!!

                                  *New drink :D

                                  Comment

                                  • GrouchyAdmin
                                    Now choke yourself!
                                    • Apr 2006
                                    • 12085

                                    #18
                                    Hi Wolfy,

                                    Sorry I missed you - I was having dinner and my volume was set too low to notice. Feel free to hit me up. ICQ is in the sig.

                                    Comment

                                    • Wolfy
                                      Confirmed User
                                      • Dec 2003
                                      • 3574

                                      #19
                                      thank you GA and psili, you guys rock!

                                      Comment

                                      • psili
                                        Confirmed User
                                        • Apr 2003
                                        • 5526

                                        #20
                                        Originally posted by Wolfy
                                        thank you GA and psili, you guys rock!
                                        Grouchy's attentive, for a grouchy guy ;)
                                        He doesn't misplace or forget the special characters.
                                        Your post count means nothing.

                                        Comment

                                        • GrouchyAdmin
                                          Now choke yourself!
                                          • Apr 2006
                                          • 12085

                                          #21
                                          Originally posted by psili
                                          I do suck at programming... maybe the PHP "if" statement could have simply been:

                                          if( date("H") >= 20 ) // 'H'
                                          {
                                          .. blah blah
                                          }
                                          There's no need for the leading zeros. 'G' will work fine. This will work until 11:59, but if you want to get pedantic:

                                          Code:
                                          if (date("G") >= "20" || (date("G") == "0" && date("i")  == "00")) {
                                          Originally posted by psili
                                          Grouchy's attentive, for a grouchy guy ;)
                                          He doesn't misplace or forget the special characters.
                                          Hahaha. I love using a text editor that colorizes for me. I've used 'vi' until I switched to KDE, and Kate's my new babe.
                                          Last edited by GrouchyAdmin; 09-01-2007, 07:57 PM. Reason: append.

                                          Comment

                                          • psili
                                            Confirmed User
                                            • Apr 2003
                                            • 5526

                                            #22
                                            I totally see what you mean. When I was sadly trying to help Wolfy, after looking at his .txt file, I gave him:

                                            if (date("G") >= "20" {

                                            which made his PHP puke -- I missed the right parens. Oh well... that's why there's "programmers" and "script kiddies" (I'll be the latter) to help all others get confused, I guess.

                                            Originally posted by GrouchyAdmin
                                            There's no need for the leading zeros. 'G' will work fine. This will work until 11:59, but if you want to get pedantic:

                                            Code:
                                            if (date("G") >= "20" || (date("G") == "0" && date("i")  == "00")) {


                                            Hahaha. I love using a text editor that colorizes for me. I've used 'vi' until I switched to KDE, and Kate's my new babe.
                                            Your post count means nothing.

                                            Comment

                                            Working...