#!/usr/bin/perl use File::Path; use lib "."; require 'cgi-lib.pl'; #morph.cgi #Copyright 1997 Werner G. Krebs. All Rights Reserved. #Unpubished Work. Contact author for permission to use or modify. #Last Revision Werner Krebs 97/8/4 #required because we are running setuid. $ENV{PATH} = "/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin"; $ENV{IFS}=""; $top = "/web/mbb452a/projects/"; $home = $top; $cgi = "$home/cgi-bin"; $uploads = "/web/mbb452a/projects/"; $BINDIR = $home; use lib "/u5/htdocs/align"; require "werner2.pl"; if (&MethPost) { umask 000; $cgi_lib::writefiles = "$uploads/"; # Limit upload size to avoid using too much memory $cgi_lib::maxdata = 3000000; } # Read and parse the data. # Retreive the data, the filenames, and the content-type $ret = &ReadParse(\%cgi_data,\%cgi_cfn,\%cgi_ct,\%cgi_sfn); #$| = 1; #required for cgidie. #if ((&MethPost and !$cgi_data{submit}) or (&MethGet and !$cgi_data{ulfile}) #or (!&MethPost and !&MethGet)) { if (!&MethPost) { do_form(); exit(0); } # if (!(-s $cgi_data{"ulfile"})) { # {&CgiDie("Please specify a filename."); do_form();exit 0;}} #$|=1; chdir($top) or die "Can't chdir $top\n"; while (-e "lockfile") {}; system("touch lockfile"); $root="$cgi_data{fn}-$cgi_data{mi}-$cgi_data{ln}"; $root =~ s/[^\w\d\-\.]//g; $filename="$root.$cgi_data{ftype}"; while (-e $filename) { $root="$cgi_data{fn}-$cgi_data{mi}-$cgi_data{ln}$i"; $root =~ s/[^\w\d\-\.]//g; $i++; $filename="$root.$cgi_data{ftype}"; } link(untaint2($cgi_sfn{"ulfile"}),$filename); unlink($cgi_sfn{"ulfile"}); open (P1,"projects.htm"); open (P2,">projects.htm.tmp"); while () { if (/\/table/) { print P2 "$cgi_data{fn} $cgi_data{mi} $cgi_data{ln}". "$cgi_data{title}$filename". "\n\n"; } else {print P2}; } close P1; close P2; unlink("projects.htm"); system("cp projects.htm.tmp projects.htm"); unlink("projects.htm.tmp"); unlink("lockfile"); #WGK 20001204 #latest News: US Supreme Court remands decision to Florida court. #BUG FIX: Do not send confirmation message until file has actually #been successfully processed. (Otherwise, we may well be lying #to users. print "Content-type: text/html", "\n\n"; print "\n\nMBB452a Project Submitted\n"; print "

Project Received


"; print "Click here for the projects page.\n"; print ""; exit 0; sub do_form{ print "Content-type: text/html", "\n\n"; print < MBB452a Project Upload Page

MBB452a Project Upload Page

First Name: Middle Initial: Last Name:

Project Title:
File to Upload:

NB:

  1. Please test that you can correctly DOWNLOAD what you've uploaded.
  2. Please do NOT upload links to your web pages. If you have created a web page with graphics on pantheon, turn it into a PDF or a PS (postscript) and then upload or at least upload the HTML without the graphics.
  3. Please do NOT upload Word "DOC" files. If you've created a DOC file in Word, use save as HTML or print to a PDF or a PS.
  4. If you've done a programming assignment, it is YOUR responsibility to upload two things: (i) a simple TXT or HTML file of description and (ii) a TAR archive of everything, which includes (i). See my note on this.
  5. Please do NOT upload Word "DOC" files. If you've created a DOC file in Word, use save as HTML or print to a PDF or a PS.

EOF } #sub mkrbox { # my $i; # my $option; # my $checked; # for($i=0;$i $option\n"; # } #} #