Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-26-2020, 01:20 AM
Dr.CustUmz's Avatar
Dr.CustUmz Dr.CustUmz is offline
 
Join Date: Aug 2013
Location: USA
Posts: 647
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default DESPERATLY NEED HELP

I am trying to update and complete the members area modification, I know this product was released here under a false author and was never complete although it was never removed from here, and there are like 6 different threads for it which all have not been active in quite some time, and the author and co-authors (or anyone who has worked on it) has not been on in years.

I have managed to get the basics working, I have updated a lot of the code, added features, and everything seems to be functional.

What I am having problems with is getting the data to insert in the right places once the payment goes through.

The following code snippets are where the purchases take place:

members.php (Line 164) Says if the product is free, insert the data (Funstions as it should)
PHP Code:
if ($price == 0)
            {
                if (
$product['pur_group'] == '0')
                {
                    
$product['pur_group'] = $vbulletin->userinfo['usergroupid'];
                }
                
                
$vbma->setCustomerNumber($information$product['pur_group']);
                
$vbma->sendOutNewSaleEmail();
                
$rand rand($vbulletin->options['memarea_numstart'], $vbulletin->options['memarea_numend']);
                
$licnum substr(md5($prodid rand(020000) . $rand $rand), 0rand(10$vbulletin->
                    
options['memarea_custnumleng']));
                
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
                
$licensedm->setr('userid'$vbulletin->userinfo['userid']);
                
$licensedm->setr('productid'$id);
                
$licensedm->setr('licensenum'$licnum);
                
$licensedm->set('dateline'TIMENOW);
                
$licensedm->set('status'2);
                
$licensedm->pre_save();
                if (!empty(
$licensedm->errors))
                {
                    
var_dump($licensedm->errors);
                }
                else
                {
                    
$licensedm->save();
                }
            } 
ELSE IF NOT FREE (right after the above) does not want to work.
PHP Code:
else
            {
                
$ids = array($paypal$id);
                
$itemnumber $vbma->insertPurchaseInfo($ids$information);
                
$itemname $product['title'];
            } 
mem_payment.php (line 100) this is where the successful payment process starts, the payment goes through ok, but the data is never inserted into the license tables. Without this process I have to manually approve EVERY single transaction, I really need this to function.

PHP Code:
if ($result == 'VERIFIED')
{
    
$purchase $vbulletin->db->query_first("SELECT * FROM " TABLE_PREFIX .
        
"ma_purchases WHERE id = '" $id "'");
    
$order unserialize($purchase['order']);
    if (
$order[0] !== $vbulletin->GPC['business'])
    {
        
$status_code '503 Service Unavailable';
        
// Paypal likes to get told its message has been received
        
if (SAPI_NAME == 'cgi' or SAPI_NAME == 'cgi-fcgi')
        {
            
header('Status: ' $status_code);
        }
        else
        {
            
header('HTTP/1.1 ' $status_code);
        }
    }
    unset(
$order[0]);
    if (
$purchase and !in_array($order[1], array('renew''upgrade')))
    {
        
$product $vbulletin->db->query_read("SELECT pur_group FROM " TABLE_PREFIX .
            
"ma_products WHERE id = '" $order[1] . "'");
        
$userinfo fetch_userinfo($purchase['userid']);
        
$vbma->setCustomerNumber(unserialize($purchase['info']), $product['pur_group'], false,
            
$userinfo);
        
$rand rand($vbulletin->options['memarea_numstart'], $vbulletin->options['memarea_numend']);
        
$licnum substr(md5($prodid rand(020000) . $rand $rand), 0rand(10$vbulletin->
            
options['memarea_custnumleng']));
        
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
        
$licensedm->setr('userid'$userinfo['userid']);
        
$licensedm->setr('productid'$order[1]);
        
$licensedm->setr('licensenum'$licnum);
        
$licensedm->set('dateline'TIMENOW);
        
$licensedm->set('status'2);
        
$licensedm->pre_save();
        if (!empty(
$licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        }
    } elseif (
$purchase and $order[1] == 'renew')
    {
        
$licenseinfo $vbma->getLicense($order[2], falsefalse''falsefalse);
        
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
        
$licensedm->set_existing($licenseinfo);
        
$licensedm->set('dateline'TIMENOW);
        
$licensedm->set('status'2);
        
$licensedm->pre_save();
        if (!empty(
$licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        }
    } elseif (
$purchase and $order[1] == 'upgrade')
    {
        
$licenseinfo $vbma->getLicense($order[2], falsefalse''falsefalse);
        
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
        
$licensedm->set_existing($licenseinfo);
        
$licensedm->set('upgrades'serialize($order[3]));
        
$licensedm->pre_save();
        if (!empty(
$licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        }
    }
    
$vbma->sendOutNewSaleEmail();
    
$vbulletin->db->query_write("DELETE FROM " TABLE_PREFIX .
        
"ma_purchases WHERE id = '" $id "'");
    
$status_code '200 OK';
    
// Paypal likes to get told its message has been received
    
if (SAPI_NAME == 'cgi' or SAPI_NAME == 'cgi-fcgi')
    {
        
header('Status: ' $status_code);
    }
    else
    {
        
header('HTTP/1.1 ' $status_code);
    }
    exit;

SOME of the things I have attempted to debug

I have tried removing the if condition verified, and even the condition
PHP Code:
if ($purchase and !in_array($order[1], array('renew''upgrade'))) 
So it reads the following not contained in any condition:
PHP Code:
$purchase $vbulletin->db->query_first("SELECT * FROM " TABLE_PREFIX .
        
"ma_purchases WHERE id = '" $id "'");
    
$order unserialize($purchase['order']);
    if (
$order[0] !== $vbulletin->GPC['business'])
    {
        
$status_code '503 Service Unavailable';
        
// Paypal likes to get told its message has been received
        
if (SAPI_NAME == 'cgi' or SAPI_NAME == 'cgi-fcgi')
        {
            
header('Status: ' $status_code);
        }
        else
        {
            
header('HTTP/1.1 ' $status_code);
        }
    }
    unset(
$order[0]);
    
        
$product $vbulletin->db->query_read("SELECT pur_group FROM " TABLE_PREFIX .
            
"ma_products WHERE id = '" $order[1] . "'");
        
$userinfo fetch_userinfo($purchase['userid']);
        
$vbma->setCustomerNumber(unserialize($purchase['info']), $product['pur_group'], false,
            
$userinfo);
        
$rand rand($vbulletin->options['memarea_numstart'], $vbulletin->options['memarea_numend']);
        
$licnum substr(md5($prodid rand(020000) . $rand $rand), 0rand(10$vbulletin->
            
options['memarea_custnumleng']));
        
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
        
$licensedm->setr('userid'$userinfo['userid']);
        
$licensedm->setr('productid'$order[1]);
        
$licensedm->setr('licensenum'$licnum);
        
$licensedm->set('dateline'TIMENOW);
        
$licensedm->set('status'2);
        
$licensedm->pre_save();
        if (!empty(
$licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        }
    if (
$purchase and $order[1] == 'renew')
    {
        
$licenseinfo $vbma->getLicense($order[2], falsefalse''falsefalse);
        
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
        
$licensedm->set_existing($licenseinfo);
        
$licensedm->set('dateline'TIMENOW);
        
$licensedm->set('status'2);
        
$licensedm->pre_save();
        if (!empty(
$licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        }
    } elseif (
$purchase and $order[1] == 'upgrade')
    {
        
$licenseinfo $vbma->getLicense($order[2], falsefalse''falsefalse);
        
$licensedm datamanager_init('License'$vbulletinERRTYPE_ARRAY);
        
$licensedm->set_existing($licenseinfo);
        
$licensedm->set('upgrades'serialize($order[3]));
        
$licensedm->pre_save();
        if (!empty(
$licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        }
    } 
That still didnt insert the data into the license table, so I begun to break it down, I created a test page, included what needed to be included and echoed every variable and array and they all returned the proper results. So maybe the script is breaking somewhere else?

I post the mem_payment.php on StackOverflow and a suggestion I got was to use $script = 'ipnpb.paypal.com'; rather than www.paypal
that still did nothing, the payment works. its just this data not being inserted and the rest of the script on the page. They also suggested to upgrade the payment method to the new paypal api, but I have no idea where to begin with that, and this works for the payment, so I'm not too concerned with that right away.

If anyone can help me get this functioning I will split the profit of my first 5 sales once this is complete. And I have ALOT of products to be sold.
Reply With Quote
  #2  
Old 10-28-2020, 02:47 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
if (!empty($licensedm->errors))
        {
            
var_dump($licensedm->errors);
        }
        else
        {
            
$licensedm->save();
        } 
If I had to guess, I'd guess your problem is here.

I suspect you're encountering an error in save, dumping the messages to PayPal, and you're not saving.
Reply With Quote
Благодарность от:
Panzer Max
Reply


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 On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09971 seconds
  • Memory Usage 2,287KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (1)post_thanks_box_bit
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete