Here is a portion of a work in progress, I tested by sending the script with
a payment status of incomplete yet it still executed other portions of the
code. Should it not have jumped out.  Or is my nested if invalid for some
reason?

if ($payment_status = "Completed")
{
echo "1st if is passed<br>";
// check that txn_id has not been previously processed

$db_conn = mysql_connect("localhost:/var/lib/mysql/mysql.sock", "apache",
"xxx");
  mysql_select_db("telnetlabs", $db_conn);
  $query = "select pp_txn_id from orders "
           ."where pp_txn_id ='.$txn_id.' ";
  $result = mysql_query($query, $db_conn);
  echo "This is the result of 1st query<br>";
  echo $result;
  echo "<br>";
  $num_results = mysql_num_rows($result);
  echo $num_results;

if ($num_results)
{
}
else {

  echo "2nd if is passed<br>";
  $query = "select cust_email from customers "
           ."where cust_email = '$payer_mail' ";
  $result = mysql_query($query, $db_conn);
  $num_results = mysql_num_rows($result);

if ($num_results)
{
}
else
{
echo "3rd if is passed<br>";
$item_name=addslashes($item_name);
$receiver_email=addslashes($receiver_email);
$item_number=addslashes($item_number);
$invoice=addslashes($invoice);
$payment_status=addslashes($payment_status);
$payment_gross=addslashes($payment_gross);
$txn_id=addslashes($txn_id);
$payer_email=addslashes($payer_email);
$payer_status=addslashes($payer_status);
$first_name=addslashes($first_name);
$last_name=addslashes($last_name);
$address_status=addslashes($address_status);
$address_street=addslashes($address_street);
$address_city=addslashes($address_city);
$address_state=addslashes($address_state);
$address_country=addslashes($address_country);
echo $first_name;
echo $last_name;
echo $address_street;
echo $address_city;
echo $address_state;
echo $address_status;
echo $address_zip;
echo $payer_status;
echo $item_name;
echo $receiver_email;
echo $item_number;
echo $invoice;
echo $payment_status;
echo $address_country;

//$query = "insert into customers values ('"null"', '".$first_name."',
'".$last_name."', '".$address_street."', '".$address_city."' ,
'".$address_state."', '".$address_status."', '".$payer_email."' ,
'".$payer_status."', '".$payer_email."' , '".$txn_id."', '"1"')";
// check that receiver_email is an email address in your PayPal account
// check that payer_email doesn't already exist in customer database
// if exist, increment customer.balanace by 1
// if not exist, create user and increment balance by 1
// then send schedule email with userid and password
// process payment
// first stab does none of the processes above, just emails the customer and
us for testing
mail ("[EMAIL PROTECTED]", "order info", trim($mailcontent), "From:
[EMAIL PROTECTED]", "[EMAIL PROTECTED]");
mail ($payer_email, "Your Order", $custconfirmation, "From:
[EMAIL PROTECTED]", "[EMAIL PROTECTED]");
}
}
}
?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to