print "
Buy Now" if (($buyit ne "") & ($bid < $buyit));
## Buy
Now";
use vars qw(%config %category %form);
use strict;
local %config;
$config{'basepath'} = '/home/httpd/vhosts/efret.com/httpdocs/apps/auction/';
$config{'closedir'} = 'closed';
$config{'regdir'} = 'reg';
%category = (
computer => 'Computer Hardware and Software',
elec => 'Consumer Electronics',
other => 'Other Junk',
);
$config{'adminpass'} = 'auction';
$config{'scripturl'} = 'www.efret.com';
config{'colortablehead'} = '#BBBBBB';
$config{'colortablebody'} = '#EEEEEE';
$config{'sitename'} = 'Your Site Name Here';
$config{'aftermin'} = 5;
$config{'flock'} = 1;
$config{'newokay'} = 1;
local %form = &get_form_data;
if ($form{'action'} eq 'hello') { &hello; }
elsif ($form{'action'} eq 'whatever1') { &whatever1; }
elsif ($form{'action'} eq 'whatever2') { &whatever2; }
else { &hello; }
print $config{'footer'};
#-#############################################
sub hello {
print qq|
My Test Script
|;
}
#-#############################################
sub whatever1 {
print qq|
Put a sub here
|;
}
#-#############################################
sub whatever2 {
print qq|
Put a sub here
|;
}
#-#############################################
# Sub: Read Reg File (alias)
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";
open FILE, "$config{'basepath'}$config{'regdir'}/$alias.dat";
my ($password,$email,$add1,$add2,$add3,@past_bids) = 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.##
print " - PayPal " if ($config{'allowpaypal'} != 0);
####
#!/usr/bin/perl
#
# IPN Perl Script
#
# This sample script will read iKobo IPN message, parse it and save it into /tmp/ipn.txt
# /tmp/ directory is available and allows writing on most Unix systems
#
printf "Content-type: text/plain\n\n";
#read(STDIN,$buffer,$ENV{CONTENT_LENGTH});
$buffer = $ENV{'QUERY_STRING'};
@in = split(/&/,$buffer);
open F, ">/tmp/ipn.txt";
printf( F "buffer=%s\n", buffer );
foreach $i (0 .. $#in)
{
# Convert plus's to spaces
$in[$i] =~ s/\+/ /g;
# Split into key and value.
($key, $val) = split(/=/,$in[$i],2); # splits on the first =.
# Convert %XX from hex numbers to alphanumeric
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
# Associate key and value
$in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator
$in{$key} .= $val;
printf( F "%s=%s\n", $key, $val );
if ( lc($key) eq "option_list" ) # parse option list
{
@options = split(/,/,$val);
foreach $j (0 .. $#options)
{
# printf( F "parsing option_list for item $j: %s\n", $options[$j] );
@item_options = split( /:/, $options[$j] );
foreach $k (0 .. $#item_options)
{
# Split into key and value.
($opt_group, $opt_name, $opt_price) = split( /[=+]/, $item_options[$k] );
print( F "item $j, option group=$opt_group, name=$opt_name, price=$opt_price\n" );
}
}
}
}
close F;
print( "RESP=OK\r\n" );
####
sub postal_login {
my ($paymentmethod) = $_[0];
my $currentbalance = &priceformat($form{'balance'},"html");
my $payment;
$payment = &parsebid($form{'balance'} * -1) if ($form{'balance'} < 0);
if ($paymentmethod eq "paypal") {
&oops ('PayPal Payment Not Allowed At Present') unless ($config{'allowpaypal'} == 1);
print <<"EOF";
PayPal Payment.
EOF
}
else {
&oops ('Postal Payment Not Allowed At Present') unless ($config{'allowpostal'} == 1);
print "
This form will allow you to make a PayPal payment to your account at $config{'sitename'}
Postal Payment
\n";
print "Current Balance $currentbalance
" if ($form{'balance'});
print <<"EOF";
This form will allow you to make a postal payment to your account at $config{'sitename'}
Your Check or Money Order should be made payable to $config{'postal_add1'}
You may include any additional notes in the form field provided.
Please allow up to 10 Days for verification, Thank You.
EOF
}
}
####
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "RESP=OK";
my ($category, $item) = &read_item_file($form{'category'},$form{'item'});
print "
Error:
$_[0]
\n";
print $config{'footer'};
die "Error: $_[0]\n";
}
#-#############################################
# Sub: parse bid
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: Get Form Data
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;
}
#-#############################################