Bluehost.com Web Hosting $6.95

Randomly missing a function

This is a discussion on Randomly missing a function within the PHP General forums, part of the PHP Programming Forums category; An online signup script is randomly missing part of the task. These scripts are involved: sub_signup.php include/cc_proc.php - ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-17-2008
Miles Thompson
 
Posts: n/a
Default Randomly missing a function

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

Reply With Quote
  #2 (permalink)  
Old 07-17-2008
Micah Gersten
 
Posts: n/a
Default Re: [PHP] Randomly missing a function

Try returning a value from CreateUser and checking it before sending the
E-Mail.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Miles Thompson wrote:
> 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
>
>

Reply With Quote
  #3 (permalink)  
Old 07-17-2008
Shawn McKenzie
 
Posts: n/a
Default Re: [PHP] Randomly missing a function

Micah Gersten wrote:
> Try returning a value from CreateUser and checking it before sending the
> E-Mail.
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com


Exactly! You'll find that CreateUser() is called, however for whatever
reason the user isn't created. Do as Micah suggests and also add so
error checking to CreateUser() to find out why the user isn't created.

-Shawn
Reply With Quote
  #4 (permalink)  
Old 07-18-2008
Miles Thompson
 
Posts: n/a
Default Re: [PHP] Randomly missing a function

MIcah,

Duh!! So damned obvious.

We'll try that.

Thanks - Miles


On Thu, Jul 17, 2008 at 5:42 PM, Micah Gersten <micah@onshore.com> wrote:

> Try returning a value from CreateUser and checking it before sending the
> E-Mail.
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> Miles Thompson wrote:
> > 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
> >
> >

>


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:14 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0