This is Krisse's assignment site for LVS course. Instructor Jeramie Risinger.
In this week we did read and practice about:
Control Structures - IF(), IF-ELSE, phpinfo Function, Browser Detect, strstr Function
The first menubar is made in a table.
The second menubar is as a list.
I also practise using for-loop in menubar.
The phpinfo function is a small code saved to a file in a server. It shows the list of variables and PHP settings
for example $_SERVER['HTTP_USER_AGENT']. That information tells, which browser user is using.
This page is being produced using PHP code to determine what browser is being used.
The background color and the image of the page will change depending on your browser.
Here are the aswers I got from server, testing it with different browsers.
Opera/9.26 (Macintosh; PPC Mac OS X; U; fi)
Mozilla/4.0 (compatible; MSIE 6.0; Mac_PowerPC; fi) Opera 9.26 Opera/9.26
Mozilla/5.0 (Macintosh; PPC Mac OS X; U; fi; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.26
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.12) Gecko/20080219 Firefox/2.0.0.12 Navigator/9.0.0.6
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3
Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; fi-fi) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)
iCab/4.0 (Macintosh; U; PPC Mac OS X) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Mozilla/4.79 (Macintosh; U; PPC)
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-en; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-en; rv:1.4) Gecko/20030619 Netscape/7.1
Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6c
Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.6.2) (KHTML, like Gecko)
Opera/9.0 (Macintosh; U; PPC Mac OS X; en)
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-en; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; fi-fi) AppleWebKit/525.13 (KHTML, like Gecko) Shiira Safari/125
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/523 (KHTML, like Gecko, Safari/523.10) OmniWeb/v616.0.98704
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
<!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=UTF-8" />
<meta name="author" content="Kristiina Hillerström" />
<meta name="Description" content="An assignment site" />
<title>Introduction to PHP</title>
<?php
///////////////////////////////////////////////////////////
// detect browser and send style sheet for that browser
//////////////////////////////////////////////////////////
if (strstr ($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$styles="<link rel='stylesheet' href='styles/ie.css'>";
} else if (strstr ($_SERVER['HTTP_USER_AGENT'], "Netscape")) {
$styles="<link rel='stylesheet' href='styles/net.css'>";
} else if (strstr ($_SERVER['HTTP_USER_AGENT'], "Opera")) {
$styles="<link rel='stylesheet' href='styles/opera.css'>";
} else if (strstr ($_SERVER['HTTP_USER_AGENT'], "Safari")) {
$styles="<link rel='stylesheet' href='styles/safari.css'>";
} else if (strstr ($_SERVER['HTTP_USER_AGENT'], "Firefox")) {
$styles="<link rel='stylesheet' href='styles/firefox.css'>";
} else {
$styles="<link rel='stylesheet' href='styles/other.css'/>";
}
echo $styles;
?>
<link href="styles/style_week3.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container"><!-- container -->
<!-- header -->
<div id="header"><a name="Up" id="Up"></a>
<img src="images/introphp_header.jpg" alt="header" width="700" height="110" />
<h1>Introduction to PHP</h1>
</div>
<!-- /header -->
<div id="valikko"><!-- menu 1-->
<table width="550px" cellspacing="0" cellpadding="0">
<tr>
<td><a href="index.php">Index</a></td>
<?php //for-loop to print menu in table
for ($i = 1; $i <= 6; $i++) {
echo "<td><a href='week$i.php'>Week $i</a></td>" ;
}
?>
<td><a href="../index.en.html">Home</a></td>
</tr>
</table>
</div>
<!-- /menu 1-->
<div id="tabs"> <!-- Menubar 2 -->
<ul>
<li><a href="index.php"><span>Index</span></a></li>
<?php //for-lop to print menu usind div and list
for ($i = 1; $i <= 6; $i++) {
echo "<li><a href='week$i.php'><span>Week $i</span></a></li>";
}
?>
<li><a href="../index.en.html"><span>Home</span></a></li>
</ul>
</div><!-- /Menubar 2 -->
<p>This is Krisse's assignment site for
<a href="http://www.lvsassociates.com/register/product_info.php?products_id=136">LVS</a> course. Instructor
<a href="http://www.lvsonline.com/instructors.shtml#jeramie">Jeramie Risinger</a>.</p>
<h2>Week 3</h2>
<p>In this week we did read and practice about:</p>
<p>Control Structures - IF(), IF-ELSE, phpinfo Function, Browser Detect, strstr Function</p>
<h3>IF()</h3>
<?php //if() statement to declare used menubar 1
$menubar = "yes";
if ($menubar == "yes") {
echo "<p> The first menubar is made in a table.</p>";
}
?>
<h3>IF-ELSE</h3>
<?php //if-else statement to declare used menubar 2
$menubar = "no";
if ($menubar == "yes") {
echo "<p> The first one is made in a table.</p>";
} else {
echo "<p>The second menubar is as a list. </p>";
}
?>
<p>I also practise using for-loop in menubar.</p>
<h3>phpinfo Function </h3>
<p>The phpinfo function is a small code saved to a file in a server. It shows the list of variables and PHP settings</p>
<p>for example $_SERVER['HTTP_USER_AGENT']. That information tells, which browser user is using.</p>
<h3>Browser Detect</h3>
<h1>Browser-Depending Stylesheets</h1>
<p>This page is being produced using PHP code to determine what browser is being used.<br />
The background color and the image of the page will change depending on your browser.</p>
<h3><img src="images/pixback_ie.jpg" alt="ie.jpg" width="20" height="20" />
Internet Explorer <span class="red">Red</span></h3>
<h3><img src="images/pixback_netscape.jpg" alt="netscape.jpg" width="20" height="20" />
Netscape <span class="blue">Blue</span></h3>
<h3><img src="images/pixback_opera.jpg" alt="opera.jpg" width="20" height="20" />
Opera <span class="orange">Orange</span></h3>
<h3><img src="images/pixback_safari.jpg" alt="safari.jpg" width="20" height="20" />
Safari <span class="light_grey">Light Grey</span></h3>
<h3><img src="images/pixback_firefox.jpg" alt="firefox.jpg" width="20" height="20" />
Firefox <span class="mint">Mint</span></h3>
<h3><img src="images/pixback_other.jpg" alt="other.jpg" width="20" height="20" />
Other <span class="green">Green</span></h3>
<h3>The browser you are using is:</h3>
<h3>
<?php //shows the user browser
echo $_SERVER['HTTP_USER_AGENT'];
?>
</h3>
<p>Here are the aswers I got from server, testing it with different browsers.</p>
<h3><strong>Opera 9.26 OSX</strong></h3>
<p>Opera/9.26 (Macintosh; PPC Mac OS X; U; fi)<br />
Mozilla/4.0 (compatible; MSIE 6.0; Mac_PowerPC; fi) Opera 9.26 Opera/9.26<br />
Mozilla/5.0 (Macintosh; PPC Mac OS X; U; fi; rv:1.8.0) Gecko/20060728 Firefox/1.5.0 Opera 9.26</p>
<h3><strong>Navigator9.0.6 OSX</strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.12) Gecko/20080219 Firefox/2.0.0.12 Navigator/9.0.0.6</p>
<h3><strong>Netscape 7.2 OSX</strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2</p>
<h3> <strong>Netscape 6.2.3 OSX</strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:0.9.4.1) Gecko/20020508 Netscape6/6.2.3 </p>
<h3><strong>IE 5.23 OSX</strong></h3>
<p>Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC) </p>
<h3><strong>Safari3.1 OSX</strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; fi-fi) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13<br />
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)<br />
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)<br />
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.1)</p>
<h3> <strong>iCab 4.0 OSX</strong> </h3>
<p>iCab/4.0 (Macintosh; U; PPC Mac OS X) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)<br />
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) <br />
Mozilla/4.79 (Macintosh; U; PPC) <br />
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-en; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-en; rv:1.4) Gecko/20030619 Netscape/7.1
Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6c <br />
Mozilla/5.0 (compatible; Konqueror/3.2; Linux 2.6.2) (KHTML, like Gecko) <br />
Opera/9.0 (Macintosh; U; PPC Mac OS X; en)<br />
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-en; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9</p>
<h3> <strong>Shiira OSX </strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; fi-fi) AppleWebKit/525.13 (KHTML, like Gecko) Shiira Safari/125 </p>
<h3><strong>OmniWeb OSX</strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/523 (KHTML, like Gecko, Safari/523.10) OmniWeb/v616.0.98704</p>
<h3><strong>Firefox 2.0.0.12 OSX</strong></h3>
<p>Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12</p>
<p class="koodi">
<?php
show_source("week3.php");//shows the source code of the page
?>
</p>
<div id="footer"><!-- footer -->
© K.Hillerström 2008
<a href="http://validator.w3.org/check?uri=referer">
<img src="../valid-xhtml10-blue.png" alt="html validation" width="88" height="31" border="0" class="footer_img"/></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img src="../vcss-blue.gif" alt="css validation" width="88" height="31" border="0" class="footer_img"/></a> Last Updated
<!-- #BeginDate format:Ge1m -->25.01.2009 1:58<!-- #EndDate -->
</div><!-- /footer -->
<p><a href="#Up">[Up]</a></p>
</div>
<!-- /container -->
</body>
</html>