An online signup script is randomly missing part of the task. These scripts
are involved:
sub_signup.php
include/cc_proc.php - does the CC (credit card) processing
include/user_maint.php - inserts the new subscriber into the database
When the CC processing finishes, with the success flag, user_maint.php is
included, and a few lines later the createUser($params) function therein is
called to create the user. Every mysql_ function in user_maint.php is
backstopped with a die() if it fails. But sometimes it appears that the call
to this script, or the createUser() function just isn't made.
What seems to happen, randomly, is that the script "charges on" so to speak,
sending an advisory email to the office manager that there is a new
subscriber, and calling sub_signup_thanks.php, which displays a completion
message, etc.
In all of these cases the credit card processing has succeeded. Sometimes
people have tried to sign up two or three times, the card processes, but no
addition is made to the database. It's driving us nuts! Any thoughts?
Regards - Miles
Infrastructure: Apache 2.2, PHP 5.x, MySQL 5
Code:
switch ($ret) {
case CC_SUCCESS:
require 'include/user_maint.php';
$cctype = cc_getCardType($cc);
if ($cctype == 'Visa') $cctype = 'VISA';
elseif ($cctype == 'MasterCard') $cctype = 'M-C';
//Shouldn't happen in case CC_SUCCESS, but better safe than sorry
else die('We don\'t support this credit card');
$params = array(
'firstname' => $first,
// various fields
'postal_code' => $postal_code,
'pay_method' => $cctype
);
// createUser is a function in user_maint
createUser($params);
// sendEmail is func in user_maint, advises office manager
sendEmail('New subscriber!!!', "Already paid $amount by credit
card", $fields);
require 'sub_signup_thanks.php'; //Grabs authCode from $result
return;
} //other situations dealt with, and properly closed