Using paypal IPN to send a random string via EMAIL
Ok I'll cut to the chase, I have this code which produces a 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 as $character_set) {
for ($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 my paypal IPN I 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 you for your 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 the email but its "Your CODE is, , it doesn't post the random
string.
I've tried putting in $pin, $pin = random_string(); print $pin nothing works
No comments:
Post a Comment