#! /usr/local/perl5/bin/perl # #!/usr/bin/perl use vars qw(%config %category %form %globals); use strict; ##use lib "../pl"; use lib "/usr/local/www/rainbow/html/clickit/auction/pl"; require "/usr/local/www/rainbow/html/clickit/auction/pl/config.pl"; eval { &main; }; # Trap any fatal errors so the program hopefully if ($@) { &cgierr("fatal error: $@"); } # never produces those nasty blank pages. exit; #-########################################################################### # # OpenAuction Release Version 2.01 # Copyright (C) 2000, 2001 OpenScripts.com # http://www.openscripts.com # # # Original Copyright (C) 2000 EverySoft # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # #-############################################# # Main Program # # #-############################################# sub main { if (@ARGV[0] ne "nocontentheader"){ print "Content-type: text/html\n\n"; } else { print "

TEMPORARY AUCTION INSTALLATION SITE

"; } my $metadesc = "Auction at CLICKIT. Simple, Fast, and Easy Auction"; my $metakeywords = "Auction, Direct, Auction-Direct Art, Barter Avails, Cameras, Cars & Other Vehicles, Computer Hardware, Computer Software, Construction Equipment, Consumer Electronics, CrazyArthur Items, Distribution, Domain Names, Factory Equipment, Government Surplus, Jewelry, Law Enforcement, Manufacturing Equipment, Media Avails, Medical Equipment, Miscellaneous, Office Equipment, Office Furniture, PDA, Professional Services, Real Estate, Restaurant Equipment & Supplies, Security, Sports, Telecommunications Equipment, Textiles, Transportation, Travel, Warehouse Equipment, Web Hosting"; %form = &get_form_data; @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); $ARGV[0] =~ s/\W//g; if ($form{'action'} eq 'new') { require "/usr/local/www/rainbow/html/clickit/auction/pl/newitem.pl"; } elsif ($ARGV[0] eq 'accountlogin') { print "$config{'header'}"; require "/usr/local/www/rainbow/html/clickit/auction/pl/account.pl"; &accountlogin;; print "$config{'footer'}"; } elsif ($form{'action'} eq 'repost') { require "/usr/local/www/rainbow/html/clickit/auction/pl/newitem.pl"; } elsif ($form{'action'} eq 'procnew') { require "/usr/local/www/rainbow/html/clickit/auction/pl/procnew.pl"; } elsif ($form{'action'} eq 'procbid') { require "/usr/local/www/rainbow/html/clickit/auction/pl/procbid.pl"; } elsif ($form{'action'} eq 'help') { require "/usr/local/www/rainbow/html/clickit/auction/pl/help.pl"; } elsif ($form{'action'} eq 'reg') { require "/usr/local/www/rainbow/html/clickit/auction/pl/newreg.pl"; } elsif ($form{'action'} eq 'procreg') { require "/usr/local/www/rainbow/html/clickit/auction/pl/procreg.pl"; } elsif ($form{'action'} eq 'creg') { require "/usr/local/www/rainbow/html/clickit/auction/pl/chreg.pl"; } elsif ($form{'action'} eq 'proccreg') { require "/usr/local/www/rainbow/html/clickit/auction/pl/proccreg.pl"; } elsif ($form{'action'} eq 'admin') { require "/usr/local/www/rainbow/html/clickit/auction/pl/admin.pl"; } elsif ($form{'action'} eq 'feed') { require "/usr/local/www/rainbow/html/clickit/auction/pl/feed.pl"; } elsif ($form{'action'} eq 'viewseller') { require "/usr/local/www/rainbow/html/clickit/auction/pl/viewsellers.pl"; } elsif ($form{'action'} eq 'feed') { require "/usr/local/www/rainbow/html/clickit/auction/pl/feed.pl"; } elsif ($form{'action'} eq 'askseller') { require "/usr/local/www/rainbow/html/clickit/auction/pl/askseller.pl"; } elsif ($form{'action'} eq 'sellersend') { require "/usr/local/www/rainbow/html/clickit/auction/pl/sellersend.pl"; } elsif ($form{'action'} eq 'lostpass') { require "/usr/local/www/rainbow/html/clickit/auction/pl/lostpass.pl"; } elsif ($form{'action'} eq 'mailto') { require "/usr/local/www/rainbow/html/clickit/auction/pl/mailto.pl"; } elsif ($form{'action'} eq 'mailtosend') { require "/usr/local/www/rainbow/html/clickit/auction/pl/mailtosend.pl"; } elsif ($form{'action'} eq 'procadmin') { require "/usr/local/www/rainbow/html/clickit/auction/pl/procadmin.pl"; } elsif ($form{'action'} eq 'search') { require "/usr/local/www/rainbow/html/clickit/auction/pl/procsearch.pl"; } elsif ($form{'action'} eq 'dispcloseditem') { require "/usr/local/www/rainbow/html/clickit/auction/pl/dispitemclosed.pl"; } elsif ($form{'item'} eq int($form{'item'}) and $category{$form{'category'}}) { require "/usr/local/www/rainbow/html/clickit/auction/pl/dispitem.pl"; } elsif ($form{'category'} and ($form{'listtype'} eq 'new')) { require "/usr/local/www/rainbow/html/clickit/auction/pl/displistnew.pl"; } elsif ($form{'category'} and ($form{'listtype'} eq 'closingtoday')) { require "/usr/local/www/rainbow/html/clickit/auction/pl/displistclosingtoday.pl"; } elsif ($form{'category'} and ($form{'listtype'} eq 'hot')) { require "/usr/local/www/rainbow/html/clickit/auction/pl/displisthot.pl"; } elsif ($form{'category'} and ($form{'listtype'} eq 'going')) { require "/usr/local/www/rainbow/html/clickit/auction/pl/displistgoing.pl"; } elsif ($form{'category'} and ($form{'listtype'} eq 'closed')) { require "/usr/local/www/rainbow/html/clickit/auction/pl/displistclosed.pl"; } elsif ($form{'category'} and ($form{'listtype'} eq 'current')) { require "/usr/local/www/rainbow/html/clickit/auction/pl/displist.pl"; } else { require "/usr/local/www/rainbow/html/clickit/auction/pl/dispcat.pl"; } } #-###################################################################### #- We always have to do this so we leave it here, as a general call # Sub: Get Form Data # This gets data from a post. sub get_form_data { my $temp; my $buffer; my @data; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); foreach $temp (split(/&|=/,$buffer)) { $temp =~ tr/+/ /; $temp =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $temp =~ s/[\r\n]/ /g; push @data, $temp; } foreach $temp (split(/&|=/,$ENV{'QUERY_STRING'})) { $temp =~ tr/+/ /; $temp =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $temp =~ s/[\r\n]/ /g; push @data, $temp; } return @data; } ################################################################ sub load_template { # -------------------------------------------------------- # Loads and parses a template. Expects to find as input a # template file name, and a hash ref. # my $content; my ($template, $VARIABLES) = @_; open (FILE, "<$config{'templatepath'}/$template") or &oops("Couldn't open $config{'templatepath'}/$template: $!\n"); while () { s/<%(.*?)%>/$VARIABLES->{$1}/g; $content .= $_; } close FILE; return $content; } #-############################################# # Sub: parse bid # This formats a bid amount to look good... # ie. $###.## sub parsebid { $_[0] =~ s/\,//g; my @bidamt = split(/\./, $_[0]); $bidamt[0] = "0" if (!($bidamt[0])); $bidamt[0] = int($bidamt[0]); $bidamt[1] = substr($bidamt[1], 0, 2); $bidamt[1] = "00" if (length($bidamt[1]) == 0); $bidamt[1] = "$bidamt[1]0" if (length($bidamt[1]) == 1); return "$bidamt[0].$bidamt[1]"; } #-############################################# # Sub: Oops! # This generates an error message and dies. sub oops { print &load_template ('oops.html', { OOPS => $_[0], %globals }); die "Error: $_[0]\n"; } #-############################################# # Sub: Read Reg File (alias) # Reads a registration file sub read_reg_file { my $alias = shift; return '' unless $alias; # verify the user exists &oops('Your alias may not contain any non-word characters.') if $alias =~ /\W/; $alias = ucfirst(lc($alias)); return '' unless -r "$config{'basepath'}$config{'regdir'}/$alias.dat" and -T "$config{'basepath'}$config{'regdir'}/$alias.dat"; print "Could not open user file $alias" unless (open FILE, "$config{'basepath'}$config{'regdir'}/$alias.dat"); my ($password, $email, $firstname, $lastname, $jobtitle, $company, $addr1, $addr2, $city, $state, $country, $postalzip, $telephone, $fax, $correctioncode, $id, $ezsite, $individualid, $logo, $banner, $siorganization, @past_bids) = ; close FILE; chomp ($password, $email, $firstname, $lastname, $jobtitle, $company, $addr1, $addr2, $city, $state, $country, $postalzip, $telephone, $fax, $correctioncode, $id, $ezsite, $individualid, $logo, $banner, $siorganization, @past_bids); return ($password, $email, $firstname, $lastname, $jobtitle, $company, $addr1, $addr2, $city, $state, $country, $postalzip, $telephone, $fax, $correctioncode, $id, $ezsite, $individualid, $logo, $banner, $siorganization, @past_bids); } #-############################################# # Sub: Read Item File (cat, item) # Reads an item file sub read_item_file { my ($cat, $item) = @_; return '' unless $cat and $item; return '' unless -T "$config{'basepath'}$cat/$item.dat" and -R "$config{'basepath'}$cat/$item.dat"; open FILE, "$config{'basepath'}$cat/$item.dat"; my ($title, $reserve, $inc, $desc, $image, @bids) = ; close FILE; chomp ($title, $reserve, $inc, $desc, $image, @bids); return ($title, $reserve, $inc, $desc, $image, @bids); } #-############################################# # Sub: Read Bid Information (bid_string) # Reads an item file sub read_bid { my $bid_string = shift; my ($alias, $email, $bid, $time, $add1, $add2, $add3) = split(/\[\]/,$bid_string); return ($alias, $email, $bid, $time, $add1, $add2, $add3); } # -------------------------------------------------------- # Displays any errors and prints out FORM and ENVIRONMENT # information. Useful for debugging. # sub cgierr { my ($key, $env, $space); print "
\n\nCGI ERROR\n==========================================\n";
    $_[0]      and print "Error Message       : $_[0]\n";
    $0         and print "Script Location     : $0\n";
    $]         and print "Perl Version        : $]\n";

    print "\nForm Variables\n-------------------------------------------\n";
    foreach $key (sort keys %form) {
        my $space = " " x (20 - length($key));
        print "$key$space: $form{$key}\n";
    }
    print "\nEnvironment Variables\n-------------------------------------------\n";
    foreach $env (sort keys %ENV) {
        my $space = " " x (20 - length($env));
        print "$env$space: $ENV{$env}\n";
    }
    print "\n
"; exit -1; }