<html>
<head><title>Week #3 ~ Lestat </title>
<link rel="stylesheet" type="text/css" href="/css/scriptskewl.css">
</head>
<body>


<?
// Create an array to print a different url depending on 
// the day of the month, without using conditionals
// such as case/if-then

// Assign variable to array
$url=array('http://www.google.com','http://www.yahoo.com','http://www.dogpile.com','http://www.dalantech.com',
    
'http://www.adultnetsurprise.com','http://www.pogo.com','http://www.hotmail.com','http://www.msn.com',
    
'http://www.cnn.com','http://www.foxnews.com','http://www.msnbc.com','http://www.bradnersmith.com',
    
'http://www.tigerdirect.com','http://www.weather.com','http://www.cdw.com','http://www.phpbank.net',
    
'http://www.q90fm.com','http://www.fvtc.edu','http://www.casecooler.com','http://www.xoxide.com',
    
'http://www.xpcgear.com','http://www.fandango.com','http://www.efnet.org','http://www.symantec.com',
    
'http://www.oldversion.com','http://www.komando.com','http://www.annoyances.org','http://www.officedepot.com',
    
'http://www.bestbuy.com','http://www.arin.net','http://www.aprelium.com');

// Get day of the month less 1 day, because array starts at zero. There are 31 entries. Because of the zero, we need to make the date less 1 day.
$day_of_month=(date("j")-1);

// Print results
print("Today's url: <a href=\"$url[$day_of_month]\" target=_Blank>$url[$day_of_month]</a>");

// *Note, you could actually make the print statement a variable.

// End

?>

<br><br><br>


<? /* advanced assignment for #3:
      Write a script to print to the browser a different url every day of the month
      with a different category of url for each day of the week using a
      multi-dimensional array and no conditional statement.
      */

        
// Master Array
$master_array=array('football''baseball''basketball''hockey''volleyball''bowling''hunting');


// Category Array for 7 cataegories for different days of the week
// Multidimensional Array for 5 possible weeks in the month
$category = array('football' => array('www.nfl.com',
'www.football.com',
'www.profootballhof.com',
'www.collegefootball.org',
'www.thisis-football.com'
),

'baseball' => array('www.mlb.com',
'www.baseball-alminac.com',
'www.majorleaguebaseball.com',
'www.baseballamerica.com/',
'www.baseball-links.com/'
),

'basketball' => array('www.nba.com/',
'www.basketball.com/',
'www.usabasketball.com/ ',
'www.powerbasketball.com/ ',
'www.wnba.com/'
),

'hockey' => array('www.nhl.com/',
'www.usahockey.com/',
'www.exploratorium.edu/hockey/',
'www.hhof.com/',
'www.thehockeynews.com/'
),

'volleyball' => array('www.volleyball.org/',
'www.usavolleyball.org/',
'www.volleyball.com/ ',
'www.volleyhall.org/',
'www.volleyballmag.com/ '
),

'bowling' => array('www.bowling.com/',
'www.bowlingindex.com/',
'www.bowl.com/',
'www.amf.com/',
'www.brunswickbowling.com/'
),

'hunting' => array('www.hunting.net/',
'www.fishing-hunting.com/',
'www.cabelas.com/',
'www.hunting-trail.com/',
'www.huntinglinks.com/'
)

);

// Get day of month
$day_of_month date("j");

// Get day of the week
$day_of_week date("w");

// Get week of month ***THIS PART IS NOT CORRECT
$week_of_month $day_of_month/6;

// Create variables of equations to shorten coding
$subject=$master_array[$day_of_week];
$url=$category[$subject][$week_of_month];  //Week_of_month IS NOT CORRECT

// Print Results
print("Todays Subject is: $subject <br>");
print(
"Todays url is:  <a href=\"$url\">$url</a><br><br>");

?>








<pre>
</pre>
<br>
<iframe src='wk3basicsrc.php' width='850' height='300'></iframe>
<br>
<a href='../index.html'>BACK</a>
</body>
</html>