#!/usr/local/bin/perl ########################################################################### # frontpage.pl # # # # This script was written by Selena Sol (selena@eff.org # # http://www.eff.org/~erict) having been inspired by countless other # # perl authors. Feel free to copy, cite, reference, sample, borrow or # # plagiarize the contents. However, please let me know where it goes so # # that I can at least watch and take part in the development of the # # memes. Information wants to be free, support public domain freware. # # # ########################################################################### # Define some server specific variables and gather the incoming form data require "./define_variables.pl"; require "./Library/process_get_form_data.pl"; # Rename the cart_id number for ease of use $cart_id = "$MYDATA{'cart_id'}"; # Output the HTMl header print "Content-type: text/html\n\n"; print "$title\n"; # print "\n"; # Grab a listing of all of the client created shoppping carts in the # Client_carts directory. system ("ls ./Client_carts > $filelist"); # For every file in the list, check to see how old it is. If it is older # than 2 days, delete the file so that our Client_carts directory does not # get too large. open (FILELIST, "$filelist") || &open_error($filelist); while () { $file = "$client_cart_directory/$_"; open (FILE, "$file"); if (-M FILE >1) { chop $file; unlink($file); } close (FILE); } close (FILELIST); # Now check to see if the client is new or already has a userid # assigned. If the client is new, assign them a unique shopping cart id # that they can use for this session. if ($MYDATA{'cart_id'} eq "") { &counter; $cart = "$client_cart_directory/$cart_id.cart"; open (CART, ">$cart"); close (CART); chmod 0777, $cart; } # print out some more HTML print ""; print "
"; print ""; print ""; print "


\n"; require "./Library/output_frontpage.pl"; # Print out the HTMl footer for clients who have already been in the store. if ($MYDATA{'cart_id'} ne "") { print ""; print ""; print ""; } print "

"; ########################################################################## # SUBROUTINES # ########################################################################## # This subroutine assigns to the client a unique cart id by assigning # them an id equal to the process id of the script they spawned. sub counter { $cart_id = getppid; } # This subroutine handles file open errors in a way that is useful for # the adminitrator when trying to bug fix. sub open_error { # Assign the filename variable that we were sent to $filename local ($filename) = @_; print "I am really sorry, but for some reason I was unable to open

$filename

Would you please make sure that the filename is correctly defined, actually exists, and has the right permissions relative to the web browser. Thanks!"; die; }


Full Moon Productions

$title