Contents


Exercise PHP

  1. Getting Started:
    Execute the hello_world example and modify the string (e.g., include HTML tags). Try to view the page source with you browser.

  2. Basics and Output:
    Create a page only with PHP that prints your name and age, which are stored in variables.
    Use the various possibilities of print() and echo.
    Include comments in the PHP code.

  3. Variables and Operators:
    Write a PHP script that calculates a division with an arbitrary number of digits. Arguments are two integer variables and the calculation should only use operations on integers.

  4. Arrays and Strings:
    Store a table with students and information (name, ID, password, crypted password, etc) in a multi-dimensional array "stud".
    Output the stud table in form of a table.

  5. Control Statements and Loops:
    Rewrite the integer division from III using a loop.
    Use a loop to output the table stud table.

  6. Functions:
    Implement the following functions for the stud table:
    A "check" function that checks that the are no duplicate entries and that all passwords are valid: at least 5 characters including one special character,
    an output function,
    an insert function with default values for the stud table,
    a delete function which accepts one or more students at a time,
    and the search function get_name_from_ID.

  7. File IO:
    Write load and save functions for the stud table with a switch for binary IO.

  8. Include and require:
    Use Include or require to implement a page that constantly calls itself ($PHP_SELF) and prints out an other student name from the stud table every time.

  9. Date and time:
    Output the current date and time in English date() and getdate() and German with strftime().
    Output the date and time of you birth in French.

  10. Objects:
    Wrap the stud table with all functions that manipulate it in an object.

  11. Forms:
    Try the example form the lecture with the GET method. Do see any difference?

    Create a page with a HTML-form and a php-script that check the username and password for validity before loading the "real page". All students should have access to the "real page".
    Consult the on-line PHP manuals for help!

  12. File Uploads:
    Implement a HTML upload form and a PHP script that moves the uploaded file from the server's temporary directory and displays it.


Project Hash Table:
Implement a hash table for the stud table and a search function that used it. It takes a student-name and returns its ID (or array-index).
The hash table should be stored in an array separate to the array used for the students.


Project Tron:
Use the Ming module to implement the game Tron in PHP. It should be playable in parallel by multiple users from different location on the Internet. It should run in a browser.