#======================================================# # EveryAuction Addon # Administration Menuing Add-on v1.2 #------------------------------------------------------# # This version DOES NOT require the Edit Auction Add-on #======================================================# # PiTA - Park In The Alley Software (Auction-Script.com) #======================================================# # Author: Splatt 04/06/00 # justguns.com auction-script.com compalley.com #------------------------------------------------------# # Unauthorized redistribution is prohibited!!! # The latest version of my addons can be found at: # www.auction-script.com/addons #======================================================# #------------------------------------------------------# # !! CHANGES NEEDED TO AUCTION.CGI !! #------------------------------------------------------# # Find this section in the beginning of the main code: # # &get_form_data; # parse arguments from post # @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); # $ARGV[0] =~ s/\W//g; # $ARGV[1] =~ s/\D//g; # #------------------------------------------------------# # # If it's not already, rem out the last line so it looks like this: # # &get_form_data; # parse arguments from post # @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); # $ARGV[0] =~ s/\W//g; # #$ARGV[1] =~ s/\D//g; # #------------------------------------------------------# #------------------------------------------------------# # Administration Menu Add-on #------------------------------------------------------# #------------------------------------------------------# # This add-on is basically just a menuing system for all the admin functions. # It uses mostly the built in features found in EveryAuction. # # SYNTAX: auction.cgi?your-admin-password # # It will allow you to Edit and Delete USERS. # It will allow you to Edit and Delete AUCTIONS. # #------------------------------------------------------# #------------------------------------------------------# # !! CHANGES NEEDED TO AUCTION.CGI !! #------------------------------------------------------# # Add this line: # elsif ($form{'action'} eq 'citm') { &changeitem; } # After this line: # elsif ($form{'action'} eq 'creg') { &proccreg; } # Add this line to the auction script: # elsif ($ARGV[2] eq 'e') { &editem; } # After this line: # elsif ($ARGV[2] eq 'r') { &remitem; } #------------------------------------------------------# # Place this in your elsif section, I have mine above the # elsif ($ARGV[2] eq 'password') { &password; } in auction.cgi(.pl) #------------------------------------------------------# # elsif ($ARGV[0] eq $adminpass) { &admin; } # elsif (($ARGV[0] eq 'admin_auct_edit') && ($ARGV[2] eq $adminpass)) { &admin_auct_edit; } # elsif (($ARGV[0] eq 'admin_auct_rem') && ($ARGV[2] eq $adminpass)) { &admin_auct_rem; } # elsif (($ARGV[0] eq 'admin_user_edit') && ($ARGV[2] eq $adminpass)) { &admin_user_edit; } # elsif (($ARGV[0] eq 'admin_user_proc') && ($ARGV[2] eq $adminpass)) { &admin_user_proc; } # elsif (($ARGV[0] eq 'admin_user_rem') && ($ARGV[2] eq $adminpass)) { &admin_user_rem; } # elsif (($ARGV[0] eq 'moveuser') && ($ARGV[2] eq $adminpass)) { print "

ERROR MOVING FILE

" unless &movefile("$basepath$regdir/$ARGV[3]", "$basepath$oldreg/$ARGV[3]"); } # End Add-on By: Splatt ########################################## #------------------------------------------------------# #------------------------------------------------------# # NOTE: If you experience problems accessing the admin # functions move the elsif statements farther up the # existing elsif statements in auction.cgi #------------------------------------------------------# #------------------------------------------------------# # M A I N P R O G R A M #------------------------------------------------------# #------------------------------------------------------# # Admin Add-on: Directory to place deleted users $oldreg = 'old_users'; #------------------------------------------------------# # MAIN CODE #------------------------------------------------------# #------------------------------------------------------# # Add-on Sub: Administration Utility # Main Sub #------------------------------------------------------# sub admin { print ""; print "

Administration Utility



\n\n"; print "[Display Auctions For Editing]\n\n"; print "[Display Auctions For Deleting]

"; print "[Display Users For Editing]\n\n"; print "[Display Users For Deleting]




"; } #------------------------------------------------------# # Add-on Sub: Administration Utility # Edit Auction Sub #------------------------------------------------------# sub admin_auct_edit { if ($ARGV[2] ne $adminpass) { &badpassword; } print ""; print "

ADMIN: EDIT Auctions



\n"; print "\n"; print "\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"; ($title, $reserve, $inc, $desc, $image, @bids) = ; close THEFILE; chomp($title, $reserve, $inc, $desc, $image, @bids); @lastbid = split(/\[\]/,$bids[$#bids]); $file =~ s/\.dat//; @closetime = localtime($file); $closetime[4]++; @firstbid = split(/\[\]/,$bids[0]); $timediff = ($file - time); print "\n"; } } } print "
ItemClosesNum BidsHigh Bid
$category{$key}\: $title$closetime[4]/$closetime[3]$#bids\$$lastbid[2]
\n"; } #------------------------------------------------------# # Add-on Sub: Administration Utility # Delete Auction Sub # Uses EveryAuction Functions #------------------------------------------------------# sub admin_auct_rem { if ($ARGV[2] ne $adminpass) { &badpassword; } print ""; print "

ADMIN: DELETE Auctions



\n"; print "Caution: Clicking on an item immediately deletes it!


"; print "\n"; print "\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"; ($title, $reserve, $inc, $desc, $image, @bids) = ; close THEFILE; chomp($title, $reserve, $inc, $desc, $image, @bids); @lastbid = split(/\[\]/,$bids[$#bids]); $file =~ s/\.dat//; @closetime = localtime($file); $closetime[4]++; @firstbid = split(/\[\]/,$bids[0]); $timediff = ($file - time); print "\n"; } } } print "
ItemClosesNum BidsHigh Bid
$category{$key}\: $title$closetime[4]/$closetime[3]$#bids\$$lastbid[2]
\n"; } #------------------------------------------------------# # Add-on Sub: Administration Utility # Delete User Sub # Uses EveryAuction Functions #------------------------------------------------------# sub admin_user_rem { if ($ARGV[2] ne $adminpass) { &badpassword; } print ""; print "

ADMIN: DELETE Users



\n"; print "Caution: Clicking on an item immediately deletes it!


"; print "\n"; print "\n"; opendir THEDIR, "$basepath$regdir" || die "Unable to open directory: $!"; @allfiles = readdir THEDIR; closedir THEDIR; foreach $file (sort { int($a) <=> int($b) } @allfiles) { if (-T "$basepath$regdir/$file") { open REGFILE, "$basepath$regdir/$file"; ($password,$email,$add1,$add2,$add3,@junk) = ; chomp($password,$email,$add1,$add2,$add3,@junk); close REGFILE; $newname = substr($file,0,(length($file)-4)); print "\n"; } } print "
User NameReal NameEMailCity ST ZIPPassword
$newname$add1$email$add3$password
\n"; } #------------------------------------------------------# # Add-on Sub: Administration Utility # Edit User Select Sub #------------------------------------------------------# sub admin_user_edit { if ($ARGV[2] ne $adminpass) { &badpassword; } print ""; print "

ADMIN: EDIT Users



\n"; print "\n"; print "\n"; opendir THEDIR, "$basepath$regdir" || die "Unable to open directory: $!"; @allfiles = readdir THEDIR; closedir THEDIR; foreach $file (sort { int($a) <=> int($b) } @allfiles) { if (-T "$basepath$regdir/$file") { open REGFILE, "$basepath$regdir/$file"; ($password,$email,$add1,$add2,$add3,@junk) = ; chomp($password,$email,$add1,$add2,$add3,@junk); close REGFILE; $newname = substr($file,0,(length($file)-4)); print "\n"; } } print "
User NameReal NameEMailCity ST ZIPPassword
$newname$add1$email$add3$password
\n"; } #------------------------------------------------------# # Add-on Sub: Administration Utility # Edit User Form Sub #------------------------------------------------------# sub admin_user_proc { if (-f "$basepath$regdir/$ARGV[3]") { &oops('ALIAS') unless (open(REGFILE, "$basepath$regdir/$ARGV[3]")); ($password,$email,$add1,$add2,$add3,@junk) = ; chomp($password,$email,$add1,$add2,$add3,@junk); close REGFILE; $newname = substr($ARGV[3],0,(length($file)-4)); print "
"; print "

ADMIN: EDIT User

"; print ""; print ""; print ""; print "
This form will allow you to change a users street address and/or password.
"; print "
User Name:
Required for verification
"; print "
Current Password:
Required for verification
"; print "
New Password:
Leave blank if unchanged
"; print "
New Password Again:
Leave blank if unchanged
"; print "
Contact Information:
Leave blank if unchanged
"; print "Full Name:
......$add1
"; print "Street Address:
......$add2
"; print "City, State, ZIP:
......$add3
"; print "
"; } } #------------------------------------------------------# # Add-on Sub: Administration Utility # Bad Password Sub #------------------------------------------------------# sub badpassword { print "

Incorrect Password!!

"; } #------------------------------------------------------# # Add-on Sub: Edit Item # This edits an auction item #------------------------------------------------------# sub editem { if ($ARGV[3] eq $adminpass) { open THEFILE, "$basepath$ARGV[0]/$ARGV[1].dat"; ($title, $reserve, $inc, $desc, $image, @bids) = ; $title =~ s/\"//g; # quotes cause problems for a text input field close THEFILE; chomp($title, $reserve, $inc, $desc, $image, @bids); @firstbid = split(/\[\]/,$bids[0]); @lastbid = split(/\[\]/,$bids[$#bids]); print <<"EOF";
Edit An Item
Title/Item Name:
No HTML
Category:
Select One
Image URL:
Optional, should be no larger than 200x200
Description:
May include HTML - This should include the condition of the item, payment and shipping information, and any other information the buyer should know.
Please note that by placing an item up for bid you are making a contract between you and the buyer. Once you place an item, you may not retract it and you must sell it for the highest bid. In other words, if you don't want to sell it, don't place it up for bid!
Offered By:$firstbid[0]
Current High Bid:\$
Auction Reserve Price:
You are not obligated to sell below this price. Leave blank if none.
\$
Bid Increment:\$
EOF } else { print "Incorrect Administration Password!\n"; } } #------------------------------------------------------# # Add-on Sub: Process Modified Auction # This modifies an auction #------------------------------------------------------# sub changeitem { &opps('NEWCAT') unless ($form{NEWCAT}); &oops('TITLE') unless ($form{'TITLE'} && (length($form{'TITLE'}) < 51)); $form{'TITLE'} =~ s/\/\>\;/g; &oops('ITEM') unless ($form{'ITEM'}); $form{'ITEM'} =~ s/\W//g; &oops('TITLE') unless ($form{'TITLE'}); &oops('RESERVE') unless ($form{'RESERVE'}); &oops('DESC') unless ($form{'DESC'}); &oops('BID') unless ($form{'BID'} =~ /^(\d+\.?\d*|\.\d+)$/); &oops('INC') unless (($form{'INC'} =~ /^(\d+\.?\d*|\.\d+)$/) && ($form{'INC'} >= .01)); &oops('ITEM') unless (open(THEFILE, "$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat")); ($title, $reserve, $inc, $desc, $image, @bids) = ; close THEFILE; chomp($title, $reserve, $inc, $desc, $image, @bids); @firstbid = split(/\[\]/,$bids[0]); @lastbid = split(/\[\]/,$bids[$#bids]); $form{'TITLE'} = $title if !($form{'TITLE'}); $form{'RESERVE'} = $reserve if !($form{'RESERVE'}); $form{'INC'} = $inc if !($form{'INC'}); $form{'DESC'} = $desc if !($form{'DESC'}); $form{'IMAGE'} = $image if !($form{'IMAGE'}); $form{'BID'} = $bid if !($form{'BID'}); &oops('ITEM') unless (open NEWITEM, ">$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat"); print NEWITEM "$form{'TITLE'}\n$form{'RESERVE'}\n$form{'INC'}\n$form{'DESC'}\n$form{'IMAGE'}\n"; if ($#bids eq 0) { print NEWITEM "$firstbid[0]\[\]$firstbid[1]\[\]$form{'BID'}\[\]$firstbid[3]\[\]$firstbid[4]\[\]$firstbid[5]\[\]$firstbid[6]"; $message = "This item had no bidding history all items were updated!"; } else { foreach $bad (@bids) { @thebid = split(/\[\]/,$bad); $bidtime = localtime($thebid[3]); print NEWITEM "$thebid[0]\[\]$thebid[1]\[\]$thebid[2]\[\]$thebid[3]\[\]$thebid[4]\[\]$thebid[5]\[\]$thebid[6]\n"; $message = "This item has a bidding history that was not changed!"; } } close NEWITEM; if ($form{CATEGORY} ne $form{NEWCAT}) { &movefile("$basepath$form{'CATEGORY'}/$form{'ITEM'}.dat", "$basepath$form{'NEWCAT'}/$form{'ITEM'}.dat"); } print "
\n"; print "$form{'TITLE'} has been successfully changed.
\n"; print $message; print "
\n"; } #------------------------------------------------------# # End Admin Add-On #------------------------------------------------------# 1;