Advertisement
gregrickaby

Jock Rotator 1.7.1 (As used on 700thefarm.com)

Nov 16th, 2011
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.95 KB | None | 0 0
  1. <?php
  2. /**
  3.  * File mod_jock.php
  4.  *
  5.  * @version 1.7.1
  6.  * @date 11.16.11
  7.  * @author Greg Rickaby
  8.  *
  9.  */
  10.  
  11. // don't allow other scripts to grab and execute our file
  12. defined('_JEXEC') or die('Direct Access to this location is not allowed.');
  13.  
  14.  
  15. /**
  16.  * Force Time Zone (Requires PHP 5.1+)
  17.  *
  18.  * @since 1.4
  19.  * @author Greg Rickaby
  20.  *
  21.  
  22. This forces the Jock Rotator to ignore the server Time Zone (which is usually GMT) and allows you to specify your own. You must be running PHP 5.1 or above. If your server doesn't use PHP 5.1 or above, ask your server admin to upgrade. You could also delete this section.
  23.  
  24. Example Time Zones:
  25. Eastern time = America/New_York
  26. Central time = America/Chicago
  27. Mountain time = America/Denver
  28. Pacific time = America/Los_Angeles
  29. To find your timezone visit: http://unicode.org/cldr/data/diff/supplemental/territory_containment_un_m_49.html
  30.  */
  31. date_default_timezone_set( 'America/Chicago' );
  32.  
  33. /**
  34.  * Begin Jock Rotator
  35.  *
  36.  * @since 1.0
  37.  * @author Greg Rickaby
  38.  *
  39. The Jock Rotator is nothing more than a PHP Case Statement. What it does is look at the server date and time, and asks: "Is it before 10:00am? Yes? Then display this jock. etc..." Edit the HTML in each respective time-slot below to customize.
  40.  
  41. $i = equals the numerical value of the day of the week
  42.  
  43. Sunday = 0
  44. Monday = 1
  45. Tuesday = 2
  46. Wednesday = 3
  47. Thursday = 4
  48. Friday = 5
  49. Saturday = 6
  50.  
  51. $x = equals the 24-hour format of an hour with minutes (without the leading zero). You must use 24-hour time!
  52.  
  53. Examples:
  54. 0000 = Midnight
  55. 900 = 9:00 AM
  56. 1200 = Noon
  57. 1430 = 2:30 PM
  58. 1845 = 6:45 PM
  59.  */
  60. $i = date( "w" ); // day of the week
  61. $x = date( "Hi" ); // hour and minutes
  62. switch ($i) { // start the case statement
  63.  
  64. ############################# Start Monday - Friday ###################################
  65.  
  66. case "1":  
  67. case "2":  
  68. case "3":  
  69. case "4":  
  70. case "5":  
  71.  
  72. //------------------------------- Weekday Overnights 12a-6a ---------------------------
  73. if ($x < 600 ) { echo '
  74.  
  75.     <center><img src="/images/now_playing/700_the_farm_logo.jpg"><br />700 The Farm</center>
  76.  
  77. '; }
  78. //------------------------------- Weekday Mornings 6a-10a -----------------------------
  79. elseif ($x < 900 ) { echo '
  80.  
  81.     <center><a href="http://www.700thefarm.com/index.php/eli-and-stan"><img src="/images/now_playing/6a_9a_eli_stan.jpg"><br />Eli &amp; Stan 6a-9a</a></center>
  82.  
  83. '; }
  84. //------------------------------ Weekday Middays 9a-Noon ------------------------------  
  85. elseif ($x < 1200 ) { echo '
  86.  
  87.     <center><a href="http://boortz.com"><img src="/images/now_playing/9a_12p_neal_boortz.jpg"><br />Neal Boortz 9a-12p</a></center>
  88.  
  89. '; }
  90.  
  91. //------------------------------- Weekday Afternoons Noon-1p ----------------------------
  92. elseif ($x < 1300 ) { echo '
  93.  
  94.     <center><img src="/images/now_playing/12p_farm_report.jpg">Noon Farm Report</center>
  95.  
  96. '; }
  97. //------------------------------- Weekday Afternoons 1p-4p ----------------------------
  98. elseif ($x < 1600 ) { echo '
  99.  
  100.     <center><a href="http://www.mikeonline.com/"><img src="/images/now_playing/1p_4p_mike_gallagher.jpg"><br />Mike Gallagher 1p-4p</a></center>
  101.  
  102. '; }
  103. //------------------------------- Weekday Nights 7p-11:59p ----------------------------
  104. elseif ($x < 2359 ) { echo '
  105.  
  106.     <center><img src="/images/now_playing/700_the_farm_logo.jpg"><br />700 The Farm</center>
  107.  
  108. '; }
  109.  
  110. break;
  111.  
  112. ################################# Start Saturday ######################################
  113.  
  114. case "6":  
  115.  
  116. //------------------------------ Saturday All Day ---------------------------
  117. if ($x < 2359 ) { echo '
  118.  
  119.     <center><img src="/images/now_playing/700_the_farm_logo.jpg"><br />700 The Farm</center>
  120.  
  121. '; }
  122.  
  123. break;
  124.  
  125. ################################# Start Sunday ######################################
  126.  
  127. case "0":
  128.  
  129. //------------------------- Sunday All Day-------------------------------------
  130. if ($x < 2359 ) { echo '
  131.  
  132.     <center><img src="/images/now_playing/700_the_farm_logo.jpg"><br />700 The Farm</center>
  133.    
  134. '; }
  135.  
  136. // end
  137. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement