Dina Research School

Workshop: Databases and webprogramming

Tune Landboskole, 13-14 January 2005

Preliminary programme

Thursday, January 13

11:00
Arrival and accommodation
12:00
Lunch
13:00
Introduction and presentation of participants
Anders Ringgaard Kristensen, The Dina Research School
13:15
Web pages (HTML), web servers (HTTP), HTML forms, your first PHP
script. Explanation of some example websites.
Peter Sestoft, The Dina Research School

To lay the ground for later lectures we explain how to write a Web page using HTML and how to publish it on the Web so it can be seen by everybody. We explain how Web servers work and how browsers such as Internet Explorer or Firefox interact with them. We explain how to put so-called forms (with fields that the user can fill in) on Web pages, and how the filled-in fields are sent to the Web server. Finally, we show how a Web page can be generated dynamically by a script written in PHP.
14:00
Computer exercises

Create static web page containing a FORM and a TABLE. Use the FORM and the given PHP script to generate a dynamic response page. We get to try in practice what was learnt during the lecture.
15:00
Coffee break
15:30
PHP concepts and examples: Variables, expressions, data, PHP arrays; accessing form variables, conditional statements; loops and functions.
Morten Larsen, Department of Natural Sciences; KVL

The basic building blocks of PHP scripts are explained. We learn how to do simple calculations as well as more complex ones requiring choices between different alternatives and/or iteration. We also look more in-depth at how form data from the user's browser is transferred to a PHP script and can be used in the script. Finally, we look at how PHP code can be organized in functions to improve readability and reusability of scripts.
16:30
Computer exercises

Using PHP; build HTML tables using PHP loops, and so on. We write PHP scripts that accept form data from the user and that require both simple computations and iteration.
18:00
Dinner
19:00
The SQL database query language; relational databases with MySql; accessing MySql from PHP.
Peter Sestoft, The Dina Research School.

We explain how relational database systems used for storing and manipulating data, and in particular present the Mysql database system. We explain the SQL query language which is used to extract data from the databases and to make calculations on those data, and illustrate the convenience and power of relational databases. Finally we show how to use SQL from PHP so that a Web page (generated by PHP) can contain data drawn directly from a relational database.
20:00
Computer exercises

Make SQL queries from PHP, generate web pages from databases. Try some SQL queries on an MySql existing database. Create your own database. Write PHP scripts that extract data from a database and generate a Web page showing these data.
22:00
Sandwiches etc

Friday, January 14

7:45
Breakfast
8:30
Review of Thursday's exercises
9:00
Validation of user input from form variables; security issues; PHP regular expressions.
Morten Larsen, Department of Natural Sciences, KVL

We look at PHP script security and robustness and cover validation of form data from the user. One powerful tool for validation is "regular expressions", which is a compact yet flexible notation for the form of texts (in this case the allowed form of input fields). We also look at how to avoid pitfalls and security breaches when user input is to be used in SQL queries.
10:00
Computer exercises

Form variable validation using regular expressions. User login. We improve some of our earlier scripts, making them more user friendly, secure and robust.
11:45
Closing and evaluation
12:00
Lunch
13:00
Departure

Dina logoAuthor: phd@dina.kvl.dk. Updated: 03 december 2004