By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,730 Members | 1,156 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,730 IT Pros & Developers. It's quick & easy.

Errors using php and Perl

P: n/a
I'm trying to intergrate a cgi affiliate tracking system into a php
website. When someone pays using PayPal it's supposed to direct them to one
page if the payment is a success or another if payment failed. This is the
code:

if($action == order && $order_n != "")
{

include "engine/card_process.pml";

if($payment_status == success)
{
$page = payment_success;
}
else
{
$page = payment_failed;
}
}
I'm trying to insert code into this process that will credit the affiliate
the correct amount if the process is a success. This is the code that's
supposed to be inserted to credit affiliates:

<img src="http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment=
$amount" border=0>

I tried inserting this before the line "$page = payment_success;" in
various forms, but I either get errors, or the affiliate isn't credited, or
both. I managed to get the code to credit affiliates correctly, by
inserting this:

include "<img src='http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?
payment=$amount' border=0>";
but it also gives me errors:

Warning: main(): failed to open stream: No such file or directory in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 18

Warning: main(): Failed opening '<img src='http://www.yoursite.com/cgi-
bin/affiliates/sale.cgi?payment=0.01' border=0>' for inclusion
(include_path='.:/usr/share/pear') in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 18

Warning: session_start(): Cannot send session cookie - headers already sent
by (output started at
/home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 29

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 29

Warning: Cannot modify header information - headers already sent by (output
started at /home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 69

Line 18 is the inserted code, line 29 is:

session_start();

Line 69 is:

setcookie("current_page"' $page);

If you can help me I would appreciate it. I really don't have a clue about
what I'm doing. I'm just guessing. Also, the email address is valid.
Address harvesters are programmed to ignore email addresses that contain
the word "fake".
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
R. Gregg Reed wrote:
I'm trying to intergrate a cgi affiliate tracking system into a php
website. When someone pays using PayPal it's supposed to direct them to
one page if the payment is a success or another if payment failed. This is
the code:

if($action == order && $order_n != "")
{

include "engine/card_process.pml";

if($payment_status == success)
{
$page = payment_success;
}
else
{
$page = payment_failed;
}
}
I'm trying to insert code into this process that will credit the affiliate
the correct amount if the process is a success. This is the code that's
supposed to be inserted to credit affiliates:

<img src="http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment=
$amount" border=0>

$amount must be interpreted as php:
<?=$amount?> or
print "<img
src=\"http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment=$amount\"
border=0>";
I tried inserting this before the line "$page = payment_success;" in
various forms, but I either get errors, or the affiliate isn't credited,
or both. I managed to get the code to credit affiliates correctly, by
inserting this:

include "<img src='http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?
payment=$amount' border=0>";
but it also gives me errors:

Warning: main(): failed to open stream: No such file or directory in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 18

Warning: main(): Failed opening '<img src='http://www.yoursite.com/cgi-
bin/affiliates/sale.cgi?payment=0.01' border=0>' for inclusion
(include_path='.:/usr/share/pear') in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 18

Well, it doesn't make much sense, 'include' is used for including php files.
Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
/home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 29

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/httpd/vhosts/yoursite.com/httpdocs/index.php:18) in
/home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 29

Warning: Cannot modify header information - headers already sent by
(output started at /home/httpd/vhosts/yoursite.com/httpdocs/index.php:18)
in /home/httpd/vhosts/yoursite.com/httpdocs/index.php on line 69

This is normal... no cookies after errors.
Line 18 is the inserted code, line 29 is:

session_start();

Line 69 is:

setcookie("current_page"' $page);

If you can help me I would appreciate it. I really don't have a clue about
what I'm doing. I'm just guessing. Also, the email address is valid.
Address harvesters are programmed to ignore email addresses that contain
the word "fake".


Well, I don't think that's quite enough to detect a fake address...
Take it easy,
Ivan

Jul 17 '05 #2

P: n/a
"R. Gregg Reed" <fa*******@blazon1.com> wrote in message news:<Kr********************@comcast.com>...
I'm trying to intergrate a cgi affiliate tracking system into a php
website. When someone pays using PayPal it's supposed to direct them to one
page if the payment is a success or another if payment failed. This is the
code:

if($action == order && $order_n != "")
{

include "engine/card_process.pml";

if($payment_status == success)
{
$page = payment_success;
}
else
{
$page = payment_failed;
}
}
I'm trying to insert code into this process that will credit the affiliate
the correct amount if the process is a success. This is the code that's
supposed to be inserted to credit affiliates:

<img src="http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment=
$amount" border=0>

I tried inserting this before the line "$page = payment_success;" in
various forms, but I either get errors, or the affiliate isn't credited, or
both. I managed to get the code to credit affiliates correctly, by
inserting this:


<snip>

Few things to point out:

1. include syntax is wrong. It should be include "filename.php" or
include "http://someurl.foo" (see <www.php.net/include>)
2. In PHP, single quote is different from double quotes. See the
manual to findout the differences.
3. I could see some security issues in your PayPal system. Google for
PayPal IPN
4. http://in.php.net/outcontrol

This can be achieved in two ways:
1. Web bug thing:
<p>something else</p> <img
src="http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment=<?=$amount?>"
border=0>

2. PHP with include:
ob_start(); //not really necessary. just for safe..
include( 'http://www.yoursite.com/cgi-bin/affiliates/sale.cgi?payment='.$amount
);
ob_end_clean(); //see ob_start() above

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.