- ;
close ITEM;
chomp ($alias, $conam, $costreet, $cocity, $costate, $cozip, $telno, $email, $cobanner, $ptell, $url, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids);
@lastbid = split(/\[\]/,$bids[$#bids]);
################## max bidding ##################
if ($lastbid[7] eq ""){$lastbid[7] = $lastbid[2]}; #ongoing auctions OK
$newmin = $form{'BID'} + $inc;
$newmin = &parsebid($newmin);
if ((((time <= $form{'ITEM'}) || (time <= (60 * $aftermin + $lastbid[3]))) && ($form{'BID'} >= $lastbid[2] + $inc) && ($form{'BID'} <= $lastbid[7])) ||
($newbidflag == 1)) {
&oops('ITEM') unless (open NEWITEM, ">>$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat");
&filelock if ($flock);
$bid = $lastbid[2] + $inc;
print NEWITEM "\n$lastbid[0]\[\]$lastbid[1]\[\]$form{'BID'}\[\]$timenum\[\]$lastbid[4]\[\]$lastbid[5]\[\]$lastbid[6]\[\]$lastbid[7]";
close NEWITEM;
print "
$form{'ALIAS'}, your bid for $title has been beaten by a proxy bid.
The minimum bid is now
\$$newmin |
\n";
}
elsif ((((time <= $form{'ITEM'}) || (time <= (60 * $aftermin + $lastbid[3]))) && ($form{'BID'} >= $lastbid[2] + $inc) && ($form{'BID'} >= $lastbid[6])) ||
($newbidflag == 1)) {
&oops('ITEM') unless (open NEWITEM, ">>$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat");
&filelock if ($flock);
$bid = $lastbid[2] + $inc;
if (($form{'BID'} >= $reserve) && ($reserve > $lastbid[7])){
$bidmax = $reserve;
}
elsif (($form{'BID'} < $reserve) && ($form{'BID'} < $lastbid[7])){
$bidmax = $lastbid[2]+$inc;
}
elsif (($form{'BID'} < $reserve) && ($form{'BID'} >= ($lastbid[7] + $inc))){
$bidmax = $lastbid[7]+$inc;
}
elsif (($form{'BID'} < $reserve) && ($form{'BID'} > ($lastbid[7]))){
$bidmax = $form{'BID'};
}
elsif (($form{'BID'} > $reserve) && ($form{'BID'} > ($lastbid[7] + $inc))){
$bidmax = $lastbid[7]+$inc;
}
else { $bidmax = $form{'BID'};
}
$bidmax = &parsebid($bidmax);
################## max bidding ##################
print NEWITEM
"\n$form{'ALIAS'}\[\]$form{'EMAIL'}\[\]$bidmax\[\]$timenum\[\]$form{'ADDRESS1'}\[\]$form{'ADDRESS2'}\[\]$form{'ADDRESS3'}\[\]$form{'BID'}";
close NEWITEM;
print "$form{'ALIAS'}, your bid has been placed on $title(item number $form{'ITEM'}) for \$$bidmax with a maximum bid of \$$form{'BID'} on
$thetime.
You may want to print this notice as confirmation of your bid.Go back to the item\n";
$flag=0;
foreach $userbid(@userbids) {
$flag=1 if ("$form{'CATEGORY'}$form{'ITEM'}" eq $userbid);
}
if ($flag==0 && $regdir ne "") {
&oops('ALIAS') unless (open(REGFILE, ">>$basepath$regdir/$form{'ALIAS'}.dat"));
print REGFILE "\n$form{'CATEGORY'}$form{'ITEM'}";
close REGFILE;
}
&sendemail($lastbid[1], 'You\'ve been outbid!', 'nobody', $mailserver, "You have been outbid on $title\! If you want to place a higher bid, please
visit\:\n\n\thttp://$scripturl$ENV{'SCRIPT_NAME'}\?$form{'CATEGORY'}\&$form{'ITEM'}\n\nThe current high bid is \$$form{'BID'}.") if (($newbidflag
!= 1) && $scripturl);
}
else {
print "Either the auction is closed or your bid is too low.
Hit the back button and reload to get the latest auction stats, then try again!\n";
}
&count_bid
}
##########################################################################
# Sub: Process Bid
# This processes new bids from a posted form
sub procbid1 {
if (($regdir ne "") && !($newbidflag)) {
$form{'ALIAS'} =~ s/\W//g;
$form{'ALIAS'} = lc($form{'ALIAS'});
$form{'ALIAS'} = ucfirst($form{'ALIAS'});
&oops('ALIAS') unless (open(REGFILE, "$basepath$regdir/$form{'ALIAS'}.dat"));
($password, $form{'EMAIL'}, $form{'ADDRESS1'}, $form{'ADDRESS2'}, $form{'ADDRESS3'}, @userbids) = ;
close REGFILE;
chomp($password, $form{'EMAIL'}, $form{'ADDRESS1'}, $form{'ADDRESS2'}, $form{'ADDRESS3'}, @userbids);
&oops('PASSWORD') unless ((lc $password) eq (lc $form{'PASSWORD'}));
}
&oops('ALIAS') unless ($form{'ALIAS'});
&oops('EMAIL') unless ($form{'EMAIL'} =~ /.+\@.+/);
&oops('BID') unless ($form{'BID'} =~ /^(\d+\.?\d*|\.\d+)$/);
$form{'BID'} = &parsebid($form{'BID'});
&oops('ADDRESS1') unless ($form{'ADDRESS1'});
&oops('ADDRESS2') unless ($form{'ADDRESS2'});
&oops('ADDRESS3') unless ($form{'ADDRESS3'});
$timenum = time;
$thetime = localtime(time);
&oops('ITEM') unless (open ITEM, "$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat");
($title, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids) = - ;
close ITEM;
chomp($title, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids);
@lastbid = split(/\[\]/,$bids[$#bids]);
if ((((time <= $form{'ITEM'}) || (time <= (60 * $aftermin + $lastbid[3]))) && ($form{'BID'} >= $lastbid[2] + $inc)) || ($newbidflag == 1)) {
&oops('ITEM') unless (open NEWITEM, ">>$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat");
&filelock if ($flock);
print NEWITEM
"\n$form{'ALIAS'}\[\]$form{'EMAIL'}\[\]$form{'BID'}\[\]$timenum\[\]$form{'COSTREET'}\[\]$form{'COCITY'}\[\]$form{'COSTATE'}\[\]$form{'COZIP'}";close NEWITEM;
print "$form{'ALIAS'}, your bid has been placed on item number $form{'ITEM'} for \$$form{'BID'} on $thetime.
You may want to print this
notice as confirmation of your bid.Go back to the item\n";
$flag=0;
foreach $userbid(@userbids) {
$flag=1 if ("$form{'CATEGORY'}$form{'ITEM'}" eq $userbid);
}
if ($flag==0 && $regdir ne "") {
&oops('ALIAS') unless (open(REGFILE, ">>$basepath$regdir/$form{'ALIAS'}.dat"));
print REGFILE "\n$form{'CATEGORY'}$form{'ITEM'}";
close REGFILE;
}
&sendemail($lastbid[1], 'You\'ve been outbid!', 'nobody', $mailserver, "You have been outbid on $title\! If you want to place a higher bid, please
visit\:\n\n\thttp://$scripturl$ENV{'SCRIPT_NAME'}\?$form{'CATEGORY'}\&$form{'ITEM'}\n\nThe current high bid is \$$form{'BID'}.") if (($newbidflag
!= 1) && $scripturl);
}
else {
print "Either the auction is closed or your bid is too low.
Hit the back button and reload to get the latest auction stats, then try again!\n";
}
&count_bid
}
######################################
# Sub: Close Auction
# This sets an item's status to closed.
sub closeit {
if ($ARGV[0] ne $closedir) {
# We'll use the @firstbid and @lastbid info defined in &dispitem
if ($closedir) {
umask(000); # UNIX file permission junk
mkdir("$basepath$closedir", 0777) unless (-d "$basepath$closedir");
print "Please notify the site admin that this item cannot be copied to the closed directory even though it is closed.\n" unless &movefile("$basepath$ARGV[0]/$ARGV[1].dat", "$basepath$closedir/$ARGV[0]$ARGV[1].dat");
}
else {
print "Please notify the site admin that this item cannot be removed even though it is closed.\n" unless unlink("$basepath$ARGV[0]/$ARGV[1].dat");
}
if ($lastbid[2] >= $reserve) {
&sendemail($lastbid[1], "Auction Close: $title", $firstbid[1], $mailserver, "Congratulations! You are the winner of auction number $ARGV[1].\nYour winning bid was \$$lastbid[2].\n\nPlease contact the seller to make arrangements for payment and shipping:\n\n$firstbid[4]\n$firstbid[5]\n$firstbid[6]\n$firstbid[1]\n\nThanks for using $sitename!");
}
else {
&sendemail($lastbid[1], "Auction Close: $title", $firstbid[1], $mailserver, "Congratulations! You were the high bidder on auction number $ARGV[1].\nYour bid was \$$lastbid[2].\n\nUnfortunately, your bid did not meet the seller\'s reserve price...\n\nYou may still wish to contact the seller to negotiate a fair price:\n\n$firstbid[4]\n$firstbid[5]\n$firstbid[6]\n$firstbid[1]\n\nThanks for using $sitename!");
}
&sendemail($firstbid[1], "Auction Close: $title", $lastbid[1], $mailserver, "Auction Number $ARGV[1] Is Now Closed.\nThe high bid was \$$lastbid[2] (Your reserve was: \$$reserve).\n\nPlease contact the high bidder to make any necessary arrangements:\n\n$lastbid[4]\n$lastbid[5]\n$lastbid[6]\n$lastbid[1]\n\nThanks for using $sitename!");
}
}
###################################################3
# Sub: Process Bid on a New Auction Posting
# This processes new posting bid from a posted form
sub procbid3 {
if (($regdir ne "") && !($newbidflag)) {
$form{'ALIAS'} =~ s/\W//g;
$form{'ALIAS'} = lc($form{'ALIAS'});
$form{'ALIAS'} = ucfirst($form{'ALIAS'});
&oops('ALIAS') unless (open(REGFILE, "$basepath$regdir/$form{'ALIAS'}.dat"));
($password, $form{'EMAIL'}, $form{'ADDRESS1'}, $form{'ADDRESS2'}, $form{'ADDRESS3'}, @userbids) = ;
close REGFILE;
chomp($password, $form{'EMAIL'}, $form{'ADDRESS1'}, $form{'ADDRESS2'}, $form{'ADDRESS3'}, @userbids);
&oops('PASSWORD') unless ((lc $password) eq (lc $form{'PASSWORD'}));
}
&oops('ALIAS') unless ($form{'ALIAS'});
&oops('EMAIL') unless ($form{'EMAIL'} =~ /.+\@.+/);
&oops('BID') unless ($form{'BID'} =~ /^(\d+\.?\d*|\.\d+)$/);
$form{'BID'} = &parsebid($form{'BID'});
$form{'BIDON'} =($form{'BIDON'});
&oops('ADDRESS1') unless ($form{'ADDRESS1'});
&oops('ADDRESS2') unless ($form{'ADDRESS2'});
&oops('ADDRESS3') unless ($form{'ADDRESS3'});
$timenum = time;
$thetime = localtime(time);
&oops('ITEM') unless (open ITEM, "$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat");
($title, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids) = - ;
close ITEM;
chomp($title, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids);
@firstbid = split(/\[\]/,$bids[0]);
@lastbid = split(/\[\]/,$bids[$#bids]);
if ((((time <= $form{'ITEM'}) || (time <= (60 * $aftermin + $lastbid[3]))) && ($form{'BID'} >= $lastbid[2] + $inc)) || ($newbidflag == 1)) {
&oops('ITEM') unless (open NEWITEM, ">>$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat");
&filelock if ($flock);
print NEWITEM "\n$form{'ALIAS'}\[\]$form{'EMAIL'}\[\]$form{'BID'}\[\]$timenum\[\]$form{'ADDRESS1'}\[\]$form{'ADDRESS2'}\[\]$form{'ADDRESS3'}\[\]$form{'BIDON'}\[\]";
close NEWITEM;
print <
confirmation # $form{'ITEM'}
$form{'ALIAS'}, your item has been listed and is now live!
For confirmation, an email has been sent to you for your personal use.
Click here to
go to Your Auction.
|
|
endofconfirm
####################### Send confirm message
$m1 = "
Hello $form{'ALIAS'},
Thank you for placing your item for auction at $sitename!
We take great pride in providing our community with the
best possible online auctioning experience.
Your item has been listed to the site, and is already available to
be bid upon.
The item information posted is as follows :
Item number : $form{'ITEM'}
Category : $form{'CATEGORY'}
Thank you for using $sitename!
Sincerely,
$sitename
";
&sendemail($form{'EMAIL'},'Auction #' . $form{'ITEM'}, 'nobody', $mailserver, $m1);
###################### end send confirm message
$flag=0;
foreach $userbid(@userbids) {$flag=1 if ("$form{'CATEGORY'}$form{'ITEM'}" eq $userbid);}
if ($flag==0 && $regdir ne "") {
&oops('incorrect username') unless (open(REGFILE, ">>$basepath$regdir/$form{'ALIAS'}.dat"));
print REGFILE "\n$form{'CATEGORY'}$form{'ITEM'}";
close REGFILE;
}
else {
print <
$tdfont
An error has occured in processing. Most likely this error is due to the auction already ending or your bid was
too low.
Click here to
return to the auction to remedy the problem.
|
|
|
endofconfirm
}
}
}
##############################################
# Sub: Remove Item
# This removes an item from the auction
# database.
sub remitem {
if ($ARGV[3] eq $adminpass) {
if (unlink("$basepath$ARGV[0]/$ARGV[1].dat")) {
print "File Successfully Removed!\n";
}
else {
print "File Could Not Be Removed!\n";
}
}
else {
print "Sorry... Incorrect administrator password for delete!\n";
}
}
##############################################
##############################################
# Sub: Process Search
sub procsearch {
print "Search Results - $form{'searchstring'}
";
print "\n";
print "
Dealership |
City |
State / Region |
\n";
foreach $key (sort keys %category) {
opendir THEDIR, "$basepath$key" || die "Unable to open directory: $!";
@allfiles = readdir THEDIR;
closedir THEDIR;
foreach $file (sort { int($a) <=> int($b) } @allfiles) {
if (-T "$basepath$key/$file") {
open THEFILE, "$basepath$key/$file";
($alias, $conam, $costreet, $cocity, $costate, $cozip, $telno, $email, $cobanner, $ptell, $url, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids) = ;
close THEFILE;
chomp($alias, $conam, $costreet, $cocity, $costate, $cozip, $telno, $email, $cobanner, $ptell, $url, $inventory, $region, $desc, $shipping, $used, $feat, $bold, $grabber, $dutch, $qty, $gallery, @bids);
@lastbid = split(/\[\]/,$bids[$#bids]);
$file =~ s/\.dat//;
@closetime = localtime($file);
$closetime[4]++;
print "$conam | $cocity | $costate | \n" if ((((($inventory =~ /$form{'searchstring'}/i) || ($desc =~ /$form{'searchstring'}/i) || ($alias =~ /$form{'searchstring'}/i) || ($conam =~ /$form{'searchstring'}/i) || ($file =~ /$form{'searchstring'}/i)))));
#print "
$conam | $cocity | $costate | \n" if ($basepath$key\/$file =~ /$form{'searchstring'}/i);
$flag = 0;
}
}
}
print "
\n";
}
##############################################
# Sub: Change Registration
# This allows a user to change information
sub changereg {
print <<"EOF";