03: Perl

Assignment 3

Introduction
You need to create a simple password protected content management system coupled with a cookie
editor.

Environment
Assignment will be tested on a computer with installed Apache and mod_perl. Your files will be put in a
directory which is mapped to the server path /comp2405/assgn3. The following configuration options
will be enabled for this directory:

•  Files *.pl and *.cgi will be handled by mod_perl
•  AllowOverride All
•  Options All
•  AccessFileName .htaccess
•  RewriteEngine On
•  DirectoryIndex index.html index.pl
Mod_rewrite will be loaded.

The following perl modules will be installed:
File::Spec::Functions, File::Basename,  CGI.pm, File::CSV.

Please note that all these modules except File::CSV are included in the standard IndigoPerl installation.
Assignment will be tested using the Firefox browser.

Assignment

ii.  .htaccess file that shall make sure that passwd.csv is not accessible through the
web
iii.  index.pl – if authorization cookie is not set, or set incorrectly, shall display a form to input user name a password; if combination user name and password is correct, set  cookie named auth_cookie with values of username and password (for example, you can use ability of CGI.pm to  put a reference to list to cookie value).In this case, or  if  cookie already is set correctly, shall redirect to main.pl.
iv.  main.pl 
    1.  if authorization cookie is not set, or set incorrectly, shall redirect to index.pl
    2.  Shall list .txt files in the cont/ subdirectory and display links to cont/<filename>.html
    3.  Shall have a form to upload .txt file into cont/ subdirectory
    4.  Shall have a link to cookie editor
    5.  Shall have logout button
v.  /cont subdirectory
    1.  Shall have .htaccess file redirecting all requests to this directory (/comp2405/assgn3/cont/….) to contenthandler.pl (/comp2405/assgn3/contenthandler.pl)
vi.  contenthandler.pl 
    1.  if authorization cookie is not set, or set incorrectly, shall redirect to index.pl
    2.  When invoked after redirection from  cont/<filename>.html shall display 
        a.  content of cont/filename.txt with <> and & escaped
        b.  Link to main.pl
vii.  Cookieeditor.pl
    1.  if authorization cookie is not set, or set incorrectly, shall redirect to index.pl
    2.  Shall display a list of cookies set
    3.  Shall provide functionality to delete a cookie
    4.  Shall provide functionality to set
    5.  No javascript usage is allowed for this assignment
Č
ċ
ď
Rakhim Davletkaliyev,
13.04.2009, 12:23