#!/usr/local/bin/perl # Views, enters and deletes entries in a simple directory keyed data base. # Version 1.0 # # A.C. Saulys # Brookhaven National Lab # # read(STDIN,$input,$ENV{'CONTENT_LENGTH'}); # $unline = `/usr/local/etc/httpd/support/unescape "$input"`; # # split appart the fields ($in2year,$in2month,$in2day,$in2action,$in2name,$in2shift) = split(/&/,$unline); ($lyear,$inyear) = split(/=/,$in2year); ($lmonth,$inmonth) = split(/=/,$in2month); ($lday,$inday) = split(/=/,$in2day); ($laction,$inaction) = split(/=/,$in2action); ($lname,$inname) = split(/=/,$in2name); ($lshift,$inshift) = split(/=/,$in2shift); # $basedir = "/star/u2/saulys/WWW/signup/"; $slash ="/"; print "Content-type: text/html\n\n"; print "\n"; print "Shift List \n"; print "\n"; #DEBUG #print $input ; print "

Shift List

\n"; print "

The people on shift for:

\n"; print $inyear," ",$inmonth," ",$inday," for shift ",$inshift," are:

\n"; # print $inaction,"name= .",$inname,".
\n"; if($inaction =~ m!add!) { $sdir = $inyear.$slash.$inmonth.$slash.$inday.$slash.$inshift; $dir = $basedir.$sdir; if($inname eq '') {print "The name field cannot be blank to add/remove
\n";} unless($inname eq '') { # system("cd $dir") || print "Cannot cd to $dir
\n"; # system("touch $inname") || print "Cannot enter $inname
\n"; $newent = $dir.$slash.$inname; system touch, $newent || print "Cannot enter $inname
\n"; # system("cd /star/u2/saulys/WWW/signup/1998/Sep/2/2") || die "Cannot cd to $dir
\n"; # system("touch mmm") || die "Cannot enter $inname
\n"; print "I am here\n"; } } if($inaction =~ m!view!) { $sdir = $inyear.$slash.$inmonth.$slash.$inday.$slash.$inshift; $dir = $basedir.$sdir; opendir(DIR,$dir) || print "Does not exist
\n"; local(@filenames) = readdir(DIR); closedir(DIR); for(@filenames) { next if $_ eq '.'; next if $_ eq '..'; print "$_
\n"; } } print "\n";