...returns "RESP=OK" and stops...I need to find a way to display the link from the 1st line of code above, and populate that link from the information entered in my sub postal_login#!/usr/bin/perl # # IPN Perl Script # # This sample script will read iKobo IPN message, parse it and save i +t into /tmp/ipn.txt # /tmp/ directory is available and allows writing on most Unix system +s # 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 se +parator $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", $opti +ons[$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" );
...after the "RESP=OK" is returned...I have tried modifying the iko.pl script to include the sub read_item_filesub 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 ($confi +g{'allowpaypal'} == 1); print <<"EOF"; <CENTER><H2>PayPal Payment.</H2></CENTER> <TABLE ALIGN=CENTER BORDER=1 BORDERCOLOR=$config{'colortablehead'} CEL +LPADDING=8><TD ALIGN=CENTER> <B>This form will allow you to make a PayPal payment to your account a +t $config{'sitename'}</B> <FORM ACTION="https://secure.paypal.com/cgi-bin/webscr" METHOD="POST"> + <INPUT TYPE=HIDDEN NAME=balance VALUE=$form{'balance'}> <INPUT TYPE=HIDDEN NAME=action VALUE=procpaypalpayment> <TABLE WIDTH=600 BORDER=1 BGCOLOR=$config{'colortablebody'}> <TR><TD COLSPAN=2 VALIGN=TOP><A HREF=$ENV{'SCRIPT_NAME'}?action=reg>Re +gistration</A> is required.</TD></TR> <TR><TD><B>Your Username:<BR></B>Required for verification</TD> <TD WIDTH=50\%><INPUT NAME=ALIAS TYPE=TEXT MAXLENGTH=30 VALUE=$form{'A +LIAS'}></TD></TR> <TR><TD WIDTH=50%><B>Your Password:<BR></B>Required for verification</ +TD> <TD><INPUT NAME=PASSWORD TYPE=PASSWORD></TD></TR> <!-- <TR><TD><B>Amount:<BR></B>The amount you wish to pay</TD><TD>$con +fig{'currency'}<INPUT NAME=AMOUNT TYPE=TEXT SIZE=8 VALUE=$payment></T +D></TR> --> <TR><TD><B>Notes:<BR></B>Any additional notes</TD><TD><TEXTAREA NAME=N +OTES></TEXTAREA></TD></TR> <!-- <TR><TD><B>By Pressing Continue You Agree --> <!-- <BR>To Send The Above Stated Amount.</B></TD> --> <!-- <TD><INPUT TYPE=SUBMIT VALUE="Continue"></TD></TR> --> </TABLE> Enter The Amount You Wish To Pay<BR> <B><A HREF=$ENV{'SCRIPT_NAME'}?action=account_login\&ALIAS=$form{'ALIA +S'}>Current Balance</A></B> $currentbalance<BR><BR> $config{'currency'}<INPUT TYPE=TEXT NAME="amount" VALUE=$payment><BR>< +BR> <a href='https://www.ikobo.com/merchant/purchase.php?item_id=119351&po +id=CG080256US'><img border='0' src='https://www.ikobo.com/merchant/bu +ttons/ikobo_pay1.gif'></a> <B><A HREF=$ENV{'SCRIPT_NAME'}?action=paypal__login\&ALIAS=$form{'ALIA +S'}><BR> <input type="hidden" NAME="cmd" VALUE="_ext-enter"> <input type="hidden" NAME="redirect_cmd" VALUE="_xclick"> <input type="hidden" NAME="business" VALUE="$config{'paypalemail'}"> <input type="hidden" NAME="return" VALUE="$config{'ppreturnurl'}"> <input type="hidden" NAME="item_name" VALUE="$config{'sitename'} Accou +nt Payment (For $form{'ALIAS'})"> <input type="hidden" NAME="notify_url" VALUE="$config{'notifyurl'}"> <input type="hidden" NAME="custom" VALUE="$form{'ALIAS'}"> <input type="hidden" name="cancel_return" value="$config{'cancelreturn +'}"> <input type="hidden" name="image_url" value="$config{'imageurl'}"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="cn" value="Leave Us A Message (optional)"> <INPUT TYPE="image" SRC="http://images.paypal.com/images/x-click-but6. +gif" NAME="submit" ALT="Make payments with PayPal - it's fast, free a +nd secure!"> </FORM> <input type="hidden" NAME="notify_url" VALUE="$config{'notifyurl'}"> <input type="hidden" NAME="custom" VALUE="$form{'ALIAS'}"> <input type="hidden" name="cancel_return" value="$config{'cancelreturn +'}"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="cn" value="Leave Us A Message (optional)"> </FORM> </TD></TABLE> EOF } else { &oops ('Postal Payment Not Allowed At Present') unless ($confi +g{'allowpostal'} == 1); print "<H2>Postal Payment</H2>\n"; print "<B><A HREF=$ENV{'SCRIPT_NAME'}?action=account_login\&AL +IAS=$form{'ALIAS'}>Current Balance</A></B> $currentbalance<BR><BR>" i +f ($form{'balance'}); print <<"EOF"; <B>This form will allow you to make a postal payment to your account a +t $config{'sitename'}</B> <BR><B>Your Check or Money Order should be made payable to $config{'po +stal_add1'}</B> <BR><BR>You may include any additional notes in the form field provide +d. <BR>Please allow up to 10 Days for verification, Thank You. <FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST> <INPUT TYPE=HIDDEN NAME=balance VALUE=$form{'balance'}> <INPUT TYPE=HIDDEN NAME=action VALUE=procpostal> <TABLE WIDTH=600 BORDER=1 BGCOLOR=$config{'colortablebody'}> <TR><TD COLSPAN=2 VALIGN=TOP><A HREF=$ENV{'SCRIPT_NAME'}?action=reg>Re +gistration</A> is required.</TD></TR> <TR><TD><B>Your Username:<BR></B>Required for verification</TD> <TD WIDTH=50\%><INPUT NAME=ALIAS TYPE=TEXT MAXLENGTH=30 VALUE=$form{'A +LIAS'}></TD></TR> <TR><TD WIDTH=50%><B>Your Password:<BR></B>Required for verification</ +TD> <TD><INPUT NAME=PASSWORD TYPE=PASSWORD></TD></TR> <TR><TD><B>Amount:<BR></B>The amount you wish to pay</TD><TD>$config{' +currency'}<INPUT NAME=AMOUNT TYPE=TEXT SIZE=8 VALUE=$payment></TD></T +R> <TR><TD><B>Notes:<BR></B>Any additional notes</TD><TD><TEXTAREA NAME=N +OTES></TEXTAREA></TD></TR> <TR><TD><B>By Pressing Continue You Agree <BR>To Send The Above Stated Amount.</B></TD> <TD><INPUT TYPE=SUBMIT VALUE="Continue"></TD></TR> </TABLE> </FORM> EOF } }
...and all my variables, it displays the "Buy Now" link, but when I click the "Buy Now" Link, the values are empty...you can see this at www.efret.com/cgi-bin/test2.pl I have been working with the EA Forum, but still cant figure this out? Can anyone help? THanks#!/usr/bin/perl print "Content-type: text/html\n\n"; print "RESP=OK"; my ($category, $item) = &read_item_file($form{'category'},$form{'item' +}); print "<P><A HREF=http://efret.com/cgi-bin/member215.pl?action=buynow& +category=&item=$form{'item'}>Buy Now</A></FONT>"; use vars qw(%config %category %form); use strict; local %config; $config{'basepath'} = '/home/httpd/vhosts/efret.com/httpdocs/apps/auct +ion/'; $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) = <FILE>; close FILE; chomp ($password,$email,$add1,$add2,$add3,@past_bids); return ($password,$email,$add1,$add2,$add3,@past_bids); } #-############################################# # Sub: Read Item File (cat, item) sub read_item_file { my ($cat, $item) = @_; # verify the category exists return '' unless ($cat) and ($item); &oops('The category may not contain any non-word characters.') if $cat + =~ /\W/; return '' unless $category{$cat}; # verify the item exists &oops('The item number may not contain any non-numeric characters.') i +f $item =~ /\D/; return '' unless (-T "$config{'basepath'}$cat/$item.dat") and (-R "$co +nfig{'basepath'}$cat/$item.dat"); open FILE, "$config{'basepath'}$cat/$item.dat"; my ($title, $reserve, $inc, $desc, $image, @bids) = <FILE>; close FILE; chomp ($title, $reserve, $inc, $desc, $image, @bids); return ($title, $reserve, $inc, $desc, $image, @bids); } #-############################################# # Sub: Read Bid Information (bid_string) sub read_bid { my $bid_string = shift; my ($alias, $email, $bid, $time, $add1, $add2, $add3) = split(/\[\]/,$ +bid_string); return ($alias, $email, $bid, $time, $add1, $add2, $add3); } #-############################################# # Sub: Oops! sub oops { print "<P><HR SIZE=1 NOSHADE><FONT COLOR=#FF0000><B>Error:</B></FONT>< +BR>$_[0]<P>Please hit the back browser on your browser to try again o +r contact <A HREF=\"mailto:$config{'admin_address'}\">the auction adm +inistrator</A> if you belive this to be a server problem.<HR SIZE=1 N +OSHADE>\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; } #-############################################# </readmore>
Edit by castaway - added readmore tags
In reply to ikobo.pl return to script by efret
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |