#!/usr/local/bin/perl # Dilip Barman, http://www.cs.unc.edu/Courses/wwwp-f97/members/barman # Sep 20 1997 # # dbAddRecord2.pl.cgi: As part of my perl programming project, described # at www.cs.unc.edu/Courses/wwwp-f97/members/barman/perlProjectProposal.html, # this perl cgi-bin script is called from the HTML form perlDatabase2.html # to add a new record. We have all the field values (title, artist, etc.) # as STDIN values. # We start off by including a nice library file by Steven Brenner which does # lots of things for us require "/afs/cs.unc.edu/project/courses/190-25f97/programs/perl/lib/cgi-lib.pl"; # GLOBAL VARIABLES $FALSE = 0; $TRUE = 1; # $DBFILENAME = "../musicDatabase/musicDB2"; # name of DBM database file $DBFILENAME = "/afs/cs.unc.edu/project/courses/190-25f97/members/barman/musicDatabase/musicDB2"; $ROACCESS = "0555"; # Read-Only open: RWX, so U=101, G=101, O=101 $RWACCESS = "0777"; # Read-Write open: 111 111 111 # Remember to set AFS directory permissions so system:anyuser (a web # client, for example) has write privilege to this directory -- # fs setat ../musicDatabase system:anyuser write # $RECDELIMSTART = "\*\$\["; # delimit record entries: *$[ ... ]$* # $RECDELIMEND = "\]\$\*"; # Sep 21: to simplify this, I'm going to use the tilde character $NOTITLESTRING = "*Required Name of Recording*"; # Take this from the main HTML file - so if title has this value, that # means user hasn't typed a title in # * * * P R O C E S S U S E R I N P U T * * * &ReadParse(*input); # Store input as attrib-value keys in variable input $title = $input{"title"}; $artist = $input{"artist"}; $genre = $input{"genre"}; $format = $input{"format"}; $time = $input{"time"}; $comments = $input{"comments"}; # If any field has a tilde (~) in it, remove all the tildes $title =~ s/\~//ge; $artist =~ s/\~//ge; $time =~ s/\~//ge; $comments =~ s/\~//ge; # * * * T O P L E V E L H T M L S T U F F * * * # Okay, since this is run from the web, we have to first send back # http header information - and there is a library function to do it print &PrintHeader; print "
"; print "\nYou did not specify a title. The title is";
print "\n(the only field that is)