function displayDate ( $originalDate ) {
$timeStamp = strtotime( $originalDate );
$date = getdate( $timeStamp );
return $date["month"] . " " . $date["mday"] . ", " . $date["year"];
}
function displayTime ( $originalTime ) {
$time = getdate(strtotime( $originalTime ));
$minutes = ( $time["minutes"] < 10 ) ? "0" . $time["minutes"] : $time["minutes"];
return ( ( $time["hours"] > 12 ) ? ( ( intval( $time["hours"] ) - 12 ) . ":" . $minutes ) : ( $time["hours"] . ":" . $minutes ) );
}
$today = date("Y-m-d");
$todayTimeStamp = strtotime($today);
$phpDate1 = getdate($todayTimeStamp);
$lastDay = "";
$firstDay = "";
if ( $_GET["month"] == "" ) {
$firstDay = "" . $phpDate1["year"] . "-" . $phpDate1["mon"] . "-" . "01";
$lastDay = "" . $phpDate1["year"] . "-" . $phpDate1["mon"] . "-" . "31";
//"" . ( $_GET["month"] == "12" ? ( ( $phpDate1["year"] + 1 ) . "-01" ) : ( $phpDate1["year"] . "-" . ( intval($monthString) + 1 ) ) ) . "-" . "01";
//$lastDay = "" . $phpDate1["year"] . "-" . (intval($phpDate1["mon"]) + 1) . "-" . "01";
//echo "blank";
//echo $lastDay;
} else if ( $_GET["month"] == "all" ) {
$firstDay = "" . $phpDate1["year"] . "-" . $phpDate1["mon"] . "-" . "01";
//echo "all";
} else {
$monthString = $_GET["month"];
$yearString = ( ( intval( $monthString ) < $phpDate1["mon"] ) ? ( $phpDate1["year"] + 1 ) : ( $phpDate1["year"] ) );
$firstDay = "" . $yearString . "-" . $monthString . "-" . "01";
$lastDay = "" . ( $monthString == "12" ? ( ( $phpDate1["year"] + 1 ) . "-01" ) : ( $yearString . "-" . ( intval($monthString) + 1 ) ) ) . "-" . "01";
//echo "specific monthString: $monthString yearString: $yearString firstDayToDraw: $firstDayToDraw lastDayToDraw: $lastDayToDraw";
//echo $lastDay;
}
$firstDayDate = getdate(strtotime($firstDay));
// user name = habitat
// password = hhau6mi4|n4i||fi03r5
// stems from converting habitatfor -> ha6i|4|f0r and humanities -> hum4ni|i35 and then shuffling them together: hhau6mi4|n4i||fi03r5
mysql_connect ("localhost", "habitat", "hhau6mi4|n4i||fi03r5") or die("Cannot Connect to DB server");
mysql_select_db ("habitatForHumanities") or die("Cannot Select DB");
// Select the events for the given month from the mySQL database
$qryStr = "SELECT `date`, `activity`, `startTime`, `endTime`, `location` FROM `event` WHERE `date` >= '" . $firstDay . "' AND `date` < '" . $lastDay . "' ORDER BY `date` ASC";
$eventDatesQuery = mysql_query ($qryStr);
//echo "
$qryStr
"; //for debuging SQL
$bgColor = "#EEEEEE";
?>
|
|||||||||||||||||||||||||||||||||||||||||||