php - Using paypal IPN to send a random string via EMAIL -


ok i'll cut chase, have code produces random string:

function random_string() {           $character_set_array = array();      //$character_set_array[] = array('count' => 2, 'characters' => 'aa');     $character_set_array[] = array('count' => 8, 'characters' => '0123456789');     $temp_array = array();     foreach ($character_set_array $character_set) {         ($i = 0; $i < $character_set['count']; $i++) {             $temp_array[] = $character_set['characters'][rand(0, strlen($character_set['characters']) - 1)];         }     }     shuffle($temp_array);     $pinstart = 'aa';     $pinend = implode('', $temp_array);     $pin = $pinstart.$pinend;     echo $pin; } 

then in paypal ipn have this:

if($p->ipn_data["mc_gross"] > 0 && strcmp ($p->ipn_data["business"],$email) == 0 && ($p->ipn_data["item_number"]) == 1)  {          $user = $p->ipn_data["custom"];              $date = $p->ipn_data["payment_date"];              $prodid = $p->ipn_data["item_number"];              $amount = $p->ipn_data["mc_gross"];              $amounttickets = 1;              $email = 'email@hotmail.com';              $subject = '[code] - thank donation';              $message = 'your code is, <? echo random_string(); ?>';              mail("$payer_email", "$subject",              $message.random_string(), "from: $email" );              $user = str_replace("_", " ", $user);              $user = str_replace("-", " ", $user);              $user = mysql_real_escape_string($user);           } 

it sends email "your code is, , doesn't post random string.

i've tried putting in $pin, $pin = random_string(); print $pin nothing works

change echo $pin; return $pin in random_string function because want return string, not print out string on spot, then

$message = 'your code is, ' . random_string(); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -