Home > Archive > PHP Programming > May 2004 > Errors using php and Perl
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Errors using php and Perl
|
|
| R. Gregg Reed 2004-05-20, 6:30 pm |
| 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".
| |
|
| 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
| |
| R. Rajesh Jeba Anbiah 2004-05-21, 9:30 am |
| "R. Gregg Reed" <fakeemail@blazon1.com> wrote in message news:<KrOdnRaufPFiujDdRVn-sA@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
|
|
|
|
|