INTN 2201: Lab Assignment 5:
Basic PHP Scripting
Due Date and Marking
Lab 5 is due by March 6th 2010, by midnight. This means that you must have
sent an email with your link by that time (see "Handing In" section below). Be
sure to include the course code, and the lab number in the subject line of the
message (i.e. "INTN2201 Lab #5"). You will receive an email back within
a day or two, giving you your mark out of twenty, and the reasons for any loss of
marks, to be used as constructive criticism (i.e. fix the problems before the
next lab is submitted). NOTE: this assignment is worth two double your other assignments
due to the complexity of the prompted temperature page. This should inspire you to spend
some extra time completeing the assignment.
General
N.B. the formula to convert celsius to fahrenheit is: 9.0/5.0*celsius + 32
All the of the files you are to create for this assignment should include your header.php and footer.php files
created as part of the last assignment. This will entail you actually making
the files of type *.php (instead of *.html that the book asks for). You are also expected to place a header <h1> element
and a paragraph description on each of the pages you create for this assignment. NOTE: as per usual, all pages must validate to the XHTML transitional standard.
Read "Chapter 6: Using PHP Variables" in the Julie Meloni text on
Books 24x7, and the the first two pages
of "Appendix C: Writing Your Own Functions and Objects" out of the course text book (skip the section on Objects). Take note that
in Appendix C the include function is explained.
After completing the readings, work through all the php examples in Chapter 6.
Be sure to place single-quotes around the terms val1, val2 and calc in your array element names in
the calculate example. i.e. instead of $_POST[val1] you should type $_POST['val1'] (it will cause an warning in PHP if you do not).
Specific Requirements
-
Be sure that all your pages are visually appealing with a consistent look and feel. To acheive this, you are to incorporate
your intn2201.css stylesheet and your header.php and footer.php for all files created
as part of this assignment.
-
Similar to the last assignment, include PHP comments with your name and course code in any PHP
files created for this assignment. Additionally, add HTML comments to all your pages (this should occur if you implement your header.php file
correctly) that give your name, the file name, the date the file was created and a brief description of what the page does.
-
You are to create a lab5.php file that will act as the main navigation page for all files created for this assignment.
In addition to having a link to this page in your site's main nav bar, you are to incorporate a clearly labeled link on
each page created as part of this assignment back to the lab5.php page. Like all your pages, you should have a header and paragraph
explaining on each page the page's purpose.
-
Chapter 6 in the text has you create the files: calculate_form.html; calculate.php; phpinfo.php; remoteaddress.php;
and, useragent.php.
You do NOT have to incorporate the phpinfo.php as part of your website (though working through the example is still
worthwhile). ALL of the other files should have a *.php file extension (so they can include your header and footer).
As well, each of your filenames should be pre-fixed with lab5_ (i.e. remoteaddress.php should
be called lab5_remoteaddress.php).
-
In addition to the text examples, you are to create two (2) temperature conversion pages (one to be named lab5_simple_temp_convert.php and
another called lab5_function_temp_convert.php.
These two conversion pages will utilize a for loop that starts at a celsius temperature of -40° and loops to a temperature
of 100° inclusive by increments of 10°, converting each celsius temperature to its
equivalent fahrenheit temperature. To see what the instructor is looking for link to an example
temperature conversion page. To include the degree sign
you must include ° beside the number in the output. Reminder: be sure you give access to all these lab 5 pages from the file
lab5.php.
- The first temperature conversion page should perform the calculation of the conversion directly in
the for loop, the second page (whose table will look indentical to the first) instead should do the
calculation in an appropriately named function.
Handing In
Publish your pages on the opentech server and submit the URL of your index page to YOUR lab instructor. The
preferred method/location for the various instructor is:
| Instructor
|
Method
|
| Stephen Franks
|
Place URL in the appropriate lab drop box on WebCT
|
| John Mather
|
Mail your URL to
john.mather@durhamcollege.ca. BE SURE TO INCLUDE THE COURSE CODE AND
LAB NUMBER IN THE SUBJECT LINE.
|
| Darren Puffer
|
Mail your URL to
darren.puffer@durhamcollege.ca. BE SURE TO INCLUDE THE COURSE CODE AND
LAB NUMBER IN THE SUBJECT LINE.
|
Don't mail your files themselves or save them into WebCT; they are useless away from the server.
To publish your pages, upload them to the server in the directory /var/www/users/intn2201/userid
(this is the only folder that will work because that's what the Apache Web server
software is configured to look in for your files).
Keep your files on-line until you are sure they have been marked!
Directory and file names on the server are case-sensitive, so be sure to put everything
in lowercase letters. The default page name is index.html. Don't use
spaces, apostrophes, uppercase letters or quotation marks in your file name
(keep it simple, using letters and digits, otherwise people won't find your pages).
Linking file names to URLs
Let's say your login ID is speedy, then your file name on the
server is:
/var/www/user/intn2201/speedy/index.html
The corresponding URL is:
http://opentech.durhamcollege.ca/~intn2201/speedy/
Don't forget the ~ (tilde) symbol. It means "speedy's home directory".
For the rest of the files in your site, you need to give the name in the URL.
The file named:
/var/www/users/intn2201/speedy/page2.html
has the corresponding URL is:
http://opentech.durhamcollege.ca/~intn2201/speedy/page2.html
|