#!/usr/bin/perl use vars qw(%config %category %form); use strict; #-########################################################################### # # In accordance with the GPL, this copyright notice MUST remain intact: # # EveryAuction Release Version 1.53 (2/17/02) # Copyright (C) 2000-2002 EverySoft # Registered with the United States Copyright Office, TX5-186-526 # http://www.everysoft.com/ # #-########################################################################### # # 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. # #-########################################################################### # # Modification Log (please add new entries to bottom): # # * 02/2000 # Matt Hahnfeld (matth@everysoft.com) - Original Concept and Design # Version available from http://www.everysoft.com/ # # * MM/YYYY # Name (email) - Modification # Availability # #-########################################################################### #-############################################# # Configuration Section # Edit these variables! local %config; # The Base Directory. We need an # absolute path for the base directory. # Include the trailing slash. THIS SHOULD # NOT BE WEB-ACCESSIBLE! $config{'basepath'} = '/home2/andytruc/www/auctiondata/'; # Closed Auction Directory # This is where closed auction items are stored. # Leave this blank if you don't want to store # closed auctions. It can potentially take # up quite a bit of disk space. $config{'closedir'} = 'closed'; # User Registration Directory # This is where user registrations are stored. # Leave this blank if you don't want to # require registration. It can potentially # take up quite a bit of disk space. $config{'regdir'} = 'reg'; # List each directory and its associated # category name. These directories should # be subdirectories of the base directory. %category = (forklifts => 'Forklift Trucks and Pallet Trucks'); # This is the password for deleting auction # items. $config{'adminpass'} = 'spurs'; # You need to assign either a mail program or # a mail host so confirmation e-mails can # be sent out. # Leave one commented and one uncommented. # # YOU NEED EITHER A MAIL PROGRAM # $config{'mailprog'} = '/usr/sbin/sendmail -t'; # # OR YOU NEED A MAIL HOST (SMTP) $config{'mailhost'} = 'localhost'; # This line should be your e-mail address $config{'admin_address'} = 'sales@andytruc.com'; # This line should point to the URL of # your server. It will be used for sending # "you have been outbid" e-mail. The script # name and auction will be appended to the # end automatically, so DO NOT use a trailing # slash. If you do not want to send outbid # e-mail, leave this blank. $config{'scripturl'} = 'www.andytruc.com'; # This will let you define colors for the # tables that are generated and the # other page colors. The default colors # create a nice "professional" look. Must # be in hex format. $config{'colortablehead'} = '#BBBBBB'; $config{'colortablebody'} = '#EEEEEE'; # Site Name (will appear at the top of each page) $config{'sitename'} = 'Andytruc On-Line Auction'; # You can configure your own header which will # be appended to the top of each page. $config{'header'} =<<"EOF";
Welcome to our on-line auction. This auction contains forklifts and pallet trucks from our fleet which have been out on hire, or used as part of a contract and are now available for sale to the highest bidder. To view items in the auction please choose from the categories below. To place a bid you must first register, so that we can contact you should your bid be successful. Please click on the 'register' button below to access the registration screen. If you forget your password, re-register and use a new password. Please note that although it may be possible to arrange delivery at an extra charge, transportation of any forklift will be the purchaser's responsibility. EOF # You can configure your own footer which will # be appended to the bottom of each page. # Although not required, a link back to # everysoft.com will help to support future # development. $config{'footer'} =<<"EOF";
[Category List]"; print " [Post New Item]" if ($config{'newokay'}); print " [New Registration] [Change Registration]" if ($config{'regdir'}); print " [Closed Auctions]" if ($config{'regdir'}) and ($config{'closedir'}); print " \n"; print $config{'footer'}; # #-############################################# #-############################################# # Sub: Display List Of Categories # This creates a "nice" list of categories. sub dispcat { print "Auction Categories
$category{$form{'category'}}\n"; print "
$titleInformation \n"; print "
Description $html_description"; print " Bid History \n"; my $lowest_new_bid; if ($#bids) { for (my $i=1; $i "; } $lowest_new_bid = &parsebid($bid+$inc); } else { print "No bids yet... "; $lowest_new_bid = (&read_bid($bids[0]))[2]; } # either the item is closed or we will display a bid form my ($alias, $email, $bid, $time, $add1, $add2, $add3) = &read_bid($bids[$#bids]); # read the last bid if ((time > int($form{'item'})) && (time > (60 * $config{'aftermin'} + $time))) { print "BIDDING IS NOW CLOSED "; &closeit($form{'category'},$form{'item'}); } else { print <<"EOF"; | |||||||||||||||||||||||
| Your Handle/Alias: Used to track your post | |||||||||||||||||||||||
| Your E-Mail Address: Must be valid | |||||||||||||||||||||||
| Your Starting Bid: | \£ | ||||||||||||||||||||||
| Your Reserve Price: You are not obligated to sell below this price. Leave blank if none. | \£ | ||||||||||||||||||||||
| Bid Increment: | \£ | ||||||||||||||||||||||
| Contact Information: Will be given out only to the buyer |
Full Name: Street Address: City, State, ZIP: |
|
Go back to the item\n";
my $flag=0;
my $userbid;
foreach $userbid (@userbids) {
$flag=1 if ("$form{'CATEGORY'}$form{'ITEM'}" eq $userbid);
}
if ($flag==0 && $config{'regdir'} ne "") {
&oops('We could not open the registration file. This could be a server write issue.') unless (open(REGFILE, ">>$config{'basepath'}$config{'regdir'}/$form{'ALIAS'}.dat"));
print REGFILE "\n$form{'CATEGORY'}$form{'ITEM'}";
close REGFILE;
}
&sendemail($email, $config{'admin_address'}, 'You\'ve been outbid!', "You have been outbid on $title\! If you want to place a higher bid, please visit\:\r\n\r\n\thttp://$config{'scripturl'}$ENV{'SCRIPT_NAME'}\?category=$form{'CATEGORY'}\&item=$form{'ITEM'}\r\n\r\nThe current high bid is \£$form{'BID'}.") if ($config{'scripturl'} and $#bids);
}
else {
print "Item number $form{'ITEM'} in category $form{'CATEGORY'} is now closed!
Sorry...\n";
}
}
#-#############################################
# Sub: Process Search
# This displays search results
sub procsearch {
print "
| Item | Closes | Num Bids | High Bid |
| $title"; print " [PIC]" if ($image); print " | $closetime[4]/$closetime[3] | $#bids | \£$bid |
| $title"; print " [PIC]" if ($image); print " | $closetime[4]/$closetime[3] | $#bids | \£$bid |
| This form will allow you to change your street address and/or password. | |
| Your Handle/Alias: Required for verification | |
| Your Current Password: Required for verification | |
| Your New Password: Leave blank if unchanged | |
| Your New Password Again: Leave blank if unchanged | |
| Contact Information: Leave blank if unchanged |
Full Name: Street Address: City, State, ZIP: |
| This form will allow you to register to buy or sell auction items. You must enter accurate data, and your new password will be e-mailed to you. Please be patient after hitting the submit button. Registration may take a few seconds. | |
| Your Handle/Alias: Used to track your post | |
| Your E-Mail Address: Must be valid | |
| Contact Information: Will be given out only to the buyer or seller |
Full Name: Street Address: City, State, ZIP: |
| This form will allow you to view the status and contact information for closed auction items you bid on or listed for auction. | |
| Your Username: Required for verification | |
| Your Password: Required for verification | |
Reserve was: \£$reserve
\n";
print "
\n";
if ($#bids) {
my ($alias, $email, $bid, $time, $add1, $add2, $add3) = &read_bid($bids[$#bids]);
print "Buyer Information:
Alias: $alias
E-Mail: $email
Address: ".&strip_html($add1)."
".&strip_html($add2)."
".&strip_html($add3)."
High Bid: \£$bid\n"; print "
Bidder Contact Info: \n";
my ($alias, $email, $bid, $time, $add1, $add2, $add3) = &read_bid($bids[0]);
print "Seller Information: ";
my ($alias, $email, $bid, $time, $add1, $add2, $add3) = &read_bid($bids[$#bids]);
print "Your High Bid: \£$bid \n";
print "Remember, the seller is not required to sell unless your bid price was above the reserve price...";
}
else {
print "You were not a winner... No further contact information is available.\n";
}
}
#-#############################################
# Sub: Admin
# Allows the administrator to delete items.
sub admin {
print <<"EOF";
Please hit the back browser on your browser to try again or contact the auction administrator if you belive this to be a server problem.
\n";
for (my $i=1; $i
\n";
}
}
print "
Alias: $alias
E-Mail: $email
Address: ".&strip_html($add1)."
".&strip_html($add2)."
".&strip_html($add3)."Delete Items
This form will allow you to delete an item. You will need the
administrator password that should be configured in the script.
Category:
Select OneItem Number:
Administrator Password:
Required for verification
Error:
$_[0]
\n";
print $config{'footer'};
die "Error: $_[0]\n";
}
#-#############################################
# Sub: Movefile(file1, file2)
# This moves a file. Quick and dirty!
sub movefile {
my ($firstfile, $secondfile) = @_;
return 0 unless open(FIRSTFILE,$firstfile);
my @lines=