Course: ITSE6079 CGI Programming Techniques
Instructor:
Ashley Rosilier cgi@iteachu.com

Dates: Aug. 4 - Sept. 12, 2003

Class Quick Links
Syllabus Roster Grades Schedule Forums Chat Lessons Projects
[an error occurred while processing this directive]
 
On-line Tutorials College Credit Continuing Ed. Certifications

Home > Continuing Education > CGI Programming > Projects > Project 5

 

Project 5 - Cookies & Databases

Due Date - Fri., Sept. 5

Overview

We will be modifying the script from project 4 to make use of more advanced CGI techniques. Have you ever been to a site that remembered you on return visits? It's all the rage, so let's see how it's done...

Preparation

Objectives

  • Learn how to use cookies
  • Work with a database

Script Details

Make the following changes to the script from project 4:

  • After all information has been submitted, set a cookie assigning a unique identifier to the user.
  • In addition to emailing the final results, save them to a database.
  • If the user tries to access the script again, print a message telling them that they have already submitted the form and display the information they originally submitted. (hint: use the cookie!)

Demo script

Notes

  • You can use any type of database for this project (flat file, DBM, SQL)
  • You may use a CGI library to simplify the cookie setting (cookie-lib.pl or CGI.pm, for example)

For those of you wanting to use MySQL on the ACC servers, it is indeed functional but you will need to include this line in your Perl script (prior to use DBI;):

use lib "/usr/lib/perl5/site_perl/5.005/i386-linux";

Keep in mind that this server is not quite what you'd get if you were working on a real ISP. All of us have essentially root access to the MySQL installation and we can create our own databases. However, all of them are stored in a single place, so there can't be more than one with the same name. (That place is /var/lib/mysql if you want to see which names are already taken.)

Also, if you don't set a login name and password for your database, anyone on the system can edit it (or delete it!). On most ISPs you would request a database from your tech support and they would set it up for you with the appropriate login and password.

A good book on MySQL is MySQL & mSQL by O'Reilly, and I also recommend the Perl DBI book from O'Reilly if you plan to use Perl to interface to your databases. (yes, I like O'Reilly!)

Finally, here is a good article illustrating how to set up a MySQL database

Project Submission

You should have a link to the functional script from your main project website. Email the text of the script and the working URL to cgi@iteachu.com by the deadline date in the schedule.

Jump to Forums [Project 5]

 
About iTeachU
Programs Offerred
Library
Book Store
Other Resources

Course Access

 

 

 

Home > Continuing Education > CGI Programming > Projects > Project 5

On-line Tutorials College Credit Continuing Ed. Certifications

 

info@iteachu.com

© Copyright 2001-2002 iTeachU All Rights Reserved