#! /perl5/bin ###################################################################### # Program : Sample Receipt.cgi # Subject : This program will parse all the GET method data. ###################################################################### push (@INC, "perl5/lib"); print "Content-type: text/HTML \n\n";
$FORM_DATA = $ENV{'QUERY_STRING'}; foreach (split(/&/, $FORM_DATA)) { ($NAME, $VALUE) = split(/=/, $_); $NAME =~ s/\+/ /g; $NAME =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg; $VALUE =~ s/\+/ /g; $VALUE =~ s/%([0-9|A-F]{2})/pack(C,hex($1))/eg;
# Find unique Variable Name for every variable coming in from the form input
$NUM = 0; while ($MYVARS{$NAME} ne "") { $NUM++; $NAME =~ s/\.([0-9]+$)|$/\.$NUM/; }
# Store Variable NAME=Variable VALUE pair
$MYVARS{$NAME} = $VALUE; }
$Success = "$MYVARS{'Status'}"; $OrderID = "$MYVARS{'OrderID'}"; ## You can receive the rest of the documented key=value pairs by following the code above. #
print <<"HTML"; <HTML><HEAD><TITLE>SAMPLE RECEIPT.CGI</TITLE></HEAD> <BODY> HTML
if ($Success == 1) { print "Transaction was a success!<br>\n"; # Do your order fulfillment here. Any emails to customer, merchant and database processing. # } elsif ($Success == 0) { print "Transaction was not successful!<br>\n"; # Remove the current order information from your database based on the OrderID. # }
print <<"HTML_END"; </BODY> </HTML> HTML_END |