Week Three PHP

abstract

9:53:28 pm, Friday, November 21, 2008

There was a Young Lady of Ryde,
Whose shoe-strings were seldom untied.
She purchased some clogs,
And some small spotted dogs,
And frequently walked about Ryde.
~Edward Lear

Here are some examples of my page in different browsers. Thought it would be easier than you having to open a bunch of them ;)

CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

Countdown til Christmas!
Countdown til Christmas!


0 days 0 hours 0 minutes to go!
0 days 0 hours 0 minutes to go!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>PHP Intro Week 3</title>
<?php
// variable
$ff "ff.css";
?>
<?php
if (strstr ($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
echo 
"<link rel='stylesheet' href='ie.css' />";
} else if (
strstr ($_SERVER['HTTP_USER_AGENT'], "Firefox")) {
echo 
"<link rel='stylesheet' href='$ff' />";
} else if (
strstr ($_SERVER['HTTP_USER_AGENT'], "Netscape")) {
echo 
"<link rel='stylesheet' href='net.css' />";
} else {
echo 
"<link rel='stylesheet' href='other.css' />";
}
?> 
</head>
<body>

<h1 id="head">Week Three PHP</h1>
<?php
// include Content
include ("content.inc");
?>
<p class="center"><?php 
echo date("g:i:s a, l, F j, Y ");
?></p>
<div class="cboth"></div> 
<div id="box">
<div class="bg">
<div class="poem">
<?php
if (strstr ($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
include (
"lim1.inc");
} else if (
strstr ($_SERVER['HTTP_USER_AGENT'], "Firefox")) {
include (
"lim2.inc");
} else if (
strstr ($_SERVER['HTTP_USER_AGENT'], "Netscape")) {
include (
"lim3.inc");
} else {
include (
"lim4.inc"); 
}
?> 
</div>
</div>
<p class="center"><a href="week3a.php">Here are some examples of my page in different browsers</a>. Thought it would be easier than you having to open a bunch of them ;)</p>
</div>
<div id="bro">
<p class="center">
<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>
</p>
</div>
<div id="leetle">
<h2 style="line-height: 2pt;"><span style="color: #330000;">Countdown til Christmas!</span><br/><span style="color: #FF3030;">Countdown til Christmas!</span></h2>

<?php
// parameters: (year, month, day, hour, minute)
countdown(2007,12,25,0,0);


function 
countdown($year$month$day$hour$minute)
{
  
$cddate mktime($hour$minute0$month$day$year, -1);
  
$today time();

  
$difference $cddate $today;
  if (
$difference 0$difference 0;

  
$days_left floor($difference/60/60/24);
  
$hours_left floor(($difference $days_left*60*60*24)/60/60);
  
$minutes_left floor(($difference $days_left*60*60*24 $hours_left*60*60)/60);
  
  echo
"<br />";
  echo 
"<div style='line-height: 2pt'><span style='color: #330000;'> ".$days_left." days ".$hours_left." hours ".$minutes_left." minutes to go!</span><br /><span style='color: #FF3030;'> ".$days_left." days ".$hours_left." hours ".$minutes_left." minutes to go!</span></div>";
  
}
?>
</div>

<div id="foot">
<?php
// for loop to print menu
for ($i 1$i <= 6$i++) {
echo 
"<a href='http://www.sliloh.com/lvsfiles/phpintro/week$i/week$i.php'>Week $i</a> ";
}
?>
<p class="center">Anita Scripter &copy; 2007 - All Rights Reserved</p></div>
<hr />
<p class="source"><?php show_source("week3.php"); ?></p>

</body>
</html>