Spring 2014

COM372: Dynamic Web Design and Programming

Dr. Patrick Logan | 108 Davis Hall | 401-874-2970 | mayfly@uri.edu
Course Website | Assignments and Grading | Reading Notes | Dr. Logan

COURSE GOALS: We seek an advanced mastery of web-development techniques that use databases to create content—HTML form objects, database connections, and server-side programming. We will use open-source MySQL as our database, structured query language (SQL), and PHP5 for programming.

TEXTS:PHP and MySQL Web Development—Fourth Edition. 2009. Luke Welling and Laura Thomson. Addison-Wesley.

Dr. Logan will provide copies of this text. The Fifth Edition will not be out in time for this semester. A pdf of the text and listings of all code samples are available on the course server as well.

Additional material will be provided from the course website and as handouts from the instructor.

FORMAT: We will have two lectures and two labs per week. Exercises will follow text examples and projects. Office hours are liberal and you are encouraged to take advantage of them.

GRADES: Programming assignments—in parallel with the text— will be graded. You are expected to attend and participate in all classes, to have completed assigned readings on time. A rubric for grading will be provided with each assignment. (Details)

PREREQUISITES: The course is for advanced students with career or program-related needs for Web applications training. Students should be familiar with Windows operating systems and with technology for static web pages, equivalent to COM271. Students who are deficient in client-side programming technique should discuss this with Dr. Logan, who will work with you to bring you fully up to speed, as needed.

SCHEDULE: Lecture, T-Th 12:30-1:20, 220 White Hall; Lab, MW 12:00-1:50, 215 Quinn Hall | Office Hours

COURSE OUTLINE

PHP

Week 1 (Jan. 22 - 23)

Introduction: Course goals, syllabus, and classroom procedures explained.

Review: XHTML. CSS.

Overview: PHP for server-side programming.

Forms: <form>, attributes Method and Action. <input>, <textarea>, <select>, and <option> elements. Radio buttons, checkboxes, scrolled lists, textboxes, hidden text, and submit buttons. (Examples)

Reading: Chapter 1 (p. 13-57) (notes)

Programming: 1—"Setting Up"

Week 2 (Jan. 27 - 30)

PHP Overview:Embedding PHP scripts with tags <?php and ?>. Accessing form variables. Identifiers. Variables (types, values). Constants. Scope. Operators. Expressions. Functions. Conditions with if, else, and switch. Iteration with while, do, and for.

Storing and Using Data:Saving data for later use. Creating, opening, reading from, writing to, and closing files. Locking and deleting files. Files versus relational databases.

Arrays: Array indices (numerical, non-numerical). Array operators. Multidimensional arrays. Sorting. Array functions.

Reading: Chapters 2, 3 (pages 59-106) (notes 2 | (notes 3)

Programming: 2—"The Grocery List"

Week 3 (Feb. 3 - 6)

Strings and Regular Expressions: Trimming, formatting, joining, and splitting strings. String comparisons. Functions for matching and replacing substrings. Using regular expressions.

Demo codes: Trimming | inquire() vs. inquire' ' |Replacing form-line-feeds with html breaks (<br />) | Quick lookup of common string functions and basic regular expression syntax.

More Demos: Repopulating a form for further editing.

Functions: Reusing code. Require ( ) and include ( ). Defining functions. Using parameters. Scope. Returning values. Calling by reference (pointer); calling by value. Recursions.

Reading: Chapters 4, 5 (pages 107-158) (notes 4 | notes 5)

Programming: Assignment 3—Error-checking and Form Feedback

Week 4 (Feb. 10 - 13)

Object-oriented PHP: Concepts. Classes, attributes, and operations. Class attributes, constants, methods. Inheritance. Access modifiers. Static methods. Type hinting. Object cloning. Abstract classes. Class design. Advanced object-oriented functionality.

Exception Handling: Concepts. Try...throw...catch. Class Exception. User-defined exceptions. Other error handling methods.

MySQL

Database Design Overview: Relational database concepts and terminology. Principles and practices of database design. Normalization and de-normalization.

Reading: Chapters 6, 7, 8 (pages 159-218) (notes 6 | notes 7 (Form handling example) | notes 8)

Programming: Assignment 4—Object Oriented Web Programming

Week 5 (Feb. 17 - 20)

(Monday, February 17, is Presidents Day: Classes DO meet; offices are open.)

Setting Up Databases: Creating a database. Setting users and privileges. Creating tables. Column types (=fields). Setting indices and primary keys.

Using the MySQL Database: SQL (Structured Query Language). Inserting and retrieving data from a table. Joining tables. Subqueries. Updating records. Deleting records. Modifying or deleting tables.

Reading: Chapters 9, 10 (pages 219-241) (notes 9 | notes 10).

Programming: Assignment 5—Setting up a database (using phpMyAdmin)

Week 6 (Feb. 24 - 27)

State: Remembering in a client-server dynamic exchange. Hidden form fields, text files, cookies, sessions, and databases.

Database Access From PHP Web Pages: Web server communications with database server. Opening and Closing Connections. Finding and selecting available databases. Querying and retrieving query results. PEAR, an interface.

SQL Primer: Common SQL phrases | Retrieving records from a database table | Setting up a <Select> list to choose a record to modify (MSWord doc)

Advanced MySQL Administration: The MySQL privilege system in detail. Securing the database. Speeding up queries. Optimizing. Backup and Recovery. Replication.

Advanced MySQL Programming: The Load Data Infile statement. Transactions. Foreign keys. Stored queries / procedures.

Building a Blog Registry: Overview.

Building a Blog Registry: Database Design.

Building a Blog Registry: Selecting and Displaying Records—browse.php

Reading: Chapters 11, 12, 13 (pages 267-323) (notes 11 | notes 12 | notes 13).

Programming: Assignment 6—Building a Front End

E-commerce and Security

Week 7 (March 3 - 6)

E-commerce Overview: Site design and goals. Alternative designs. Risks and Threats. Strategies.

E-commerce Security Issues: Securing your information. Threats. Policies. Tradeoffs (usability, performance, cost, security). Authentication (an example (MSWord); see also notes 23). Principles and practices of encryption. Digital signatures and certificates. Secure servers. Auditing and logging. Firewalls. Backups. Physical security.

Web Application Security: Strategies. Identifying threats. Securing code, your web server, and PHP. Securing databases. Network security.

Building a Blog Registry: Adding Records—register.php

Building a Blog Registry: The Validation Problem.

Building a Blog Registry: Editing Records.

Reading: Chapters 14, 15, 16 (pages 327-390) (notes 14 | notes 15 | notes 16).

Programming: Assignment 7—Back end

Week 8 (March 17 - 20)

March 10-16 is Spring Break!

Authentication with PHP and MySQL: Identifying visitors. Controlling access. Basic authentication. Apache authentication. Custom authentication.

Secure Transactions with PHP and MySQL: Providing secure transactions. Secure Sockets Layer (SSL). Secure storage. Storing (or not) credit card numbers. More on encryption,

Advanced PHP Techniques

Web Server File System: Uploading files. Directory functions. Interacting with server files. Executing server-side applications. Server environment variables. Image upload example. Server-file-interactions example.

Network and protocol functions: Sending and reading email. Using other websites via HTTP. Network lookup functions. FTP.

Reading: Chapters 17, 18, 19, 20 (pages 391-468) (notes 17 | notes 18 | notes 19 | notes 20).

Week 9 (March 24 - 27)

Date and Time: Getting date and time. Converting date formats. Date calculations. Calendar functions.

Images on the fly: Image support in PHP. Image formats. Creating images. Using automatically generated images on web pages. Using text and fonts to create images. Drawing figures and graphing data.

PHP Sessions: Session control. Cookies. Setting up a session. Session variables. Sessions and authentication.

Miscellaneous PHP features: Magic quotes. eval( ) for strings. Terminating execution with die and exit. Serializing variables and objects. Accessing the PHP environment. PHP extensions. Highlighting source code.

Reading: Chapters 21, 22, 23, 24 (pages 469-532) (notes 21 | notes 22 | notes 23 | notes 24 ).

Programming: Assignment 8—AJAX

Week 10 (Mar. 31 - Apr. 3)

Managing Large Projects: Software engineering for web development. Project planning and management. Reusable and durable coding. Development environments. Documentation. Prototypes (wireframes). Optimization. Separating content, structure, style, and programming.

Debugging: Program errors (syntax, runtime, logic). Error messages and levels. Handling errors gracefully.

An example: Debugging Form Input (my blog needed fixing).

Reading: Chapters 25, 26 (pages 535-567) (notes 25 | notes 26).

Practical PHP and MySQL Projects

We will not cover all of these chapters in depth. You will pick and choose and apply some to a master project, TBA.

Week 11 (April 7 - 10)

Authentication and Personalization: Logging in. Authenticating users. Passwords. User preferences. Personalized content. Suggesting content based on a user profile.

A Shopping Cart: A product database. Online categorized product catalog. Shopping cart to track purchases. Checkout script for payment and shipping. Administrative interface.

Database-driven Navigation: Flexible menu for a blog, allows for future growth of database without need to reconstruct navigation.

Reading: Chapters 27, 28 (pages 569-650) (notes 27 | notes 28).

Week 12 (April 14 - 17)

Web-based Email: Connecting to POP3 and IMAP mail servers. Reading and sending mail. Replying to and forwarding mail. Deleting mail from an account.

Mailing List Manager: Subscriber database. Uploading and previewing newsletters. Setting up and managing lists.

Online Forums: Tree database for articles. Adding articles. Use of classes.

Application: Adapting the tree database for blog commentaries.

Reading: Chapters 29, 30, 31 (pages 651-770) (notes 29 | notes 30 | notes 31).

Week 13 (April 21 - 24)

Personalized PDF Documents:RTF and PDF certificates. PDFlib.

Web Services with XML and SOAP: XML and SOAP basics. Using XML to communicate with Amazon. Parsing XML. Caching responses. Talking to Amazon with NuSOAP.

Building Web 2.0 Applications with AJAX: XMLHTTPRequest Object. Communicating asynchronously with the server and working with the server response.

Building Select Option lists with AJAX: Putting sequential option lists on a single page. Flow chart for menu (Task 8)

Reading: Chapters 32, 33, 34 (pages 771-884) (notes 32| notes 33| notes 34).

Week 14 (April 28 - 29)

April 29 is the last day of classes.

Wrapping Up: Review and course evaluation.