'Advanced Assignments
Image Viewers Options | PHP API Mash ups | Advance IDEs | E-Commerce | PHP w MySQL Integration | Guest Book
A1
PHP Functions with HTML Tags

Create an Array of all available PHP Functions; Output this Array to the screen. Hint start searching at function_exists.

Hint 1: this entire assignment can be done in about 3-6 lines of PHP code.
Hint 2: In XHTML, browsers render multiple white spaces as a single space.
Hint 3: You need to add only a single XHTML tag before and after print_r,
Hint 4: This assignment is geared toward learning how to search the available functions at php.net
Hint 5: When I say start searching at function_exists, I imply you need to read through function_exist description, and see if it can point you in the correct direction.

Then Add button for PHPInfo, can open another web page or display a hidden div.

Extra Credit: Construct a Web Page with all the functions that includes links back to php.net documentation. This is a three step process....

  1. Get a list/array of available functions (You did this above)
  2. Extract Array internal element and sort element using the php.net/sort function.
  3. For each array element that has been sorted, make it a link to the php.net system.
  4. The address "http://us.php.net/abs" is the URL for abs function.
A2
HTML Form - universal temperature conversion

Wwrite a set of functions that can convert celsiusToKelvin, celsiusToFahrenheit, fahrenheitToCelsius, kelvinToCelsius. .

In your form file, you should read in a temperature and its type either Celsius, kelvin or Fahrenheit; On submit you should print out the temperature in all three formats: Celsius, Fahrenheit and kelvin.

A3

snapShots

You actually have three possible homework assignment points.

  1. Integrated Coppermine Image Gallery, into cim snapShots.
  2. Or Create an enhanced version of snapShots. using a your own PHP script.
  3. Or create a flickr interface to snapShots. Will need to use the flickr API and create a snapShot XML file based on a flickr query.

I want options 1 and 3 completed will give extra home work points for these two

 

A4

Create a PHP Mashup, This is a partial PHP Mash up example, in an actual mash up you obtain data from more than one source and them mash up the data forming new Web page content. For these homework points you obtain one homework point for each site you mash up. This section has multiple options...

  1. PHP mashup using google notepad. | google maps | google calendar.
  2. Mashg up information from $_SERVER client IP address, use the PEAR class net_geof and net_geoIP to obtain location and the class pxweather.com to get current weather conditions at client IP location. You may also consider using another weather data source like accuweather not a data source or Weather Data.
  3. Use the above IP Address to get travel information to Saddleback.
  4. Use a Yahoo or Google Curl to get stock information.
  5. Nasa also has a data source API
A5

Classroom presentation on using an advance IDE. Present in class on either...

  1. Embarcadeo radPHP
  2. PHEclips or PDT with Eclipse - IBM Web Services
  3. Netbeans with PHP-XDebug.
A6
PHP Database or File & Session Variable Counter

Create a dual counter (page hit) system one should count the total number of times a page is loaded. The second counter should only count the number of times a specific browser - user has loaded the page. Both of these are available in the class lecture notes, the second one has to be a cookie, why? The first one cannot be a cookie, why?

Hints...

Note if you are taking CIM264C, you can create a Flash File that reads and displays PHP counter. Just use set param in the object tag, file.swf?count=20, will set the Text field var count to 20 in the flash swift.

Remember a session, is a cookie that expires when you close the browser, cookies are created on the server and stored on the client. The first time the server creates the cookie (or starts a session), the server page doesn't have the cookie, you have to reload page to save cookies to client and then read them. You can also have special code to handle this first access.

The next Assignments group is geared toward intermingling PHP with a MySQL Database
A7

Basic PHP/MySQL Interface

After setting up your database above, write a program that outputs the contents of your database tables similar to inventoryFruit1.php, but should be enhanced with the following...

  • List of Your Available Databases - query 'show databases' or search php.net for list_dbs - note you must send this query before choosing the databases.
  • List information about the current status of mysqli_stat, and host info mysqli_get_host_info,
  • Output the name of each table in your DBsbusername database; (select DB; then query 'show tables' )
  • Output the contents of your fruit and inventory tables - (select * from inventory; and select * from fruit ); Just like inventoryFruit1.php
A8

Production Level Fruit Database Interface

To complete this assignment write a more production level version of inventoryFruit5.php. You need to implement an improved interfaces consisting but not limited to...

  • mysqli calls should check for errors. All functions mysqli_connect, etc return false on error. Also th3ey have error methods such as mysqli_connect_error.
  • Add a query text field, that sends a query to your fruit database, this field should be checked so that only the select query is allowed. You must protect against SQL injection. I did this in JavaScript but you need to do this in PHP. Why?
  • You should also only allow input from the file with the forms, Do this by comparing $_SERVER[ URI_REQUEST ] with $_SERVER[ PHP_SELF ].
  • Create an advance query, joining the two tables, you should bookmark the query in PHPMyAdmin and then implement in your PHP/MySQL program.
  • Implement a Database reset button, that drops your current database tables, then recreates and insert the database tables fruit and inventory. Use PHPMyAdmin to generate the query strings.
  • On mysqli_connect, I don't check for errors, read the php.net API and add code to handle possible failures in sending a query or opening a connection.
  • Other Points to consider in your design.
    1. use frames (top frame fixed size with forms and a bottom main Frame with the output of the last query.
    2. or make sure only query output is redrawn on only the lower half of the screen, this is accomplished by having a fixed size top NavBar - interface whose size is constant.
    3. Also consider implementing a Flash/Action Script interface similar to. inventoryFruit6..html
A9

Customer Order Page

Using authorize.net or paypal merchant account (sand box) create a customer order page,using the fruit database.

Shopping Cart: this can be done several ways

  1. add session variable that keeps track of the items on the summary sheet, they can come back later on to pay
  2. create a database record of order and use cookie to identify the order
  3. look around on the Web for existing shopping carts

Note the preferred way to do an e-commerce site paypal merchant account, gbuy, ebay, amazon, yahoo stores, or zen cart.

A10

Guest book - this is easy just add a username, date, and text to a MySQL table.

Database Counter

Using phpMyAdim add a record to the database DBcim - table counter, the Record consists of a username count; you can access the username everyone. Add this counter to your home page. Also consider add a guest book capability either using PHP File I/O or DBpublic/guestbook when adding records need to put username comment field.

Guest book, star trek saying - last section PHPMySQL viewgraphs has a public database section, the public databases have not been created, but you should be able to do this assignment by creating the tables in your own database.

  PHP Games
cim278a