www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > PHP

    PHP Discussion and technical support for using and deploying PHP based websites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 03-18-2008, 12:19 AM
    RyanL RyanL is offline
    Registered User
     
    Join Date: Mar 2008
    Posts: 1
    Parse error: syntax error, unexpected T_EXIT

    I'm getting the following error:

    Parse error: syntax error, unexpected T_EXIT in /home/snh/public_html/AHYRadio/amember/plugins/payment/1shoppingcart/1shoppingcart.inc.php on line 1

    Here is what I have - the copying and pasting messed up the formatting - sorry!

    It was working fine, but I was told I could edit the line var $title = "1ShoppingCart" to whatever I wanted. I changed it to "Pay with Credit Card" and then I started getting this error.

    Any help would be greately appreciated!!

    <?phpif (!defined('INCLUDED_AMEMBER_CONFIG')) die("Direct access to this location is not allowed");/**** Author: Alex Scott* Email: alex@cgi-central.net* Web: http://www.cgi-central.net* Details: 1ShoppingCart Payment Plugin* FileName $RCSfile: paypal_r.inc.php,v $* Release: 3.0.9PRO ($Revision: 1.8 $)** Please direct bug reports,suggestions or feedback to the cgi-central forums.* http://www.cgi-central.net/forum/** aMember PRO is a commercial software. Any distribution is strictly prohibited.*/class payment_1shoppingcart extends amember_payment { var $title = "1ShoppingCart"; var $description = "All major credit cards accepted"; var $fixed_price=1; var $recurring=1; var $built_in_trials=1; function do_bill($amount, $title, $products, $u, $invoice){ global $config; $_SESSION['_amember_payment_id'] = $invoice; $vars = array( 'MerchantID' => $this->config['merchant_id'], 'ProductID' => $products[0]['1shoppingcart_id'], 'AMemberID' => $invoice, 'PostBackURL' => $config['root_url'] . "/plugins/payment/1shoppingcart/ipn.php", );
    Reply With Quote
      #2  
    Old 03-18-2008, 02:55 AM
    NogDog's Avatar
    NogDog NogDog is offline
    High Energy Magic Dept.
     
    Join Date: Aug 2004
    Location: Ankh-Morpork
    Posts: 14,009
    If you use this forum's PHP bbcode tags around your code sample, it will save everyone a lot of grief.

    Anyway, you're missing the closing curly braces for the class method (function) as well as the class itself. Also, you have a comma at the end of the last element in the $vars array declaration, which is a no-no.
    PHP Code:
    <?php
    if (!defined('INCLUDED_AMEMBER_CONFIG'))
    die(
    "Direct access to this location is not allowed");

    /**
    *
    *     Author: Alex Scott
    *      Email: alex@cgi-central.net
    *        Web: http://www.cgi-central.net
    *    Details: 1ShoppingCart Payment Plugin
    *    FileName $RCSfile: paypal_r.inc.php,v $
    *    Release: 3.0.9PRO ($Revision: 1.8 $)
    *
    * Please direct bug reports,suggestions or feedback to the cgi-central forums.
    * http://www.cgi-central.net/forum/
    *
    * aMember PRO is a commercial software. Any distribution is strictly prohibited.
    */
    class payment_1shoppingcart extends amember_payment {
       var
    $title = "1ShoppingCart";
       var
    $description = "All major credit cards accepted";
       var
    $fixed_price=1;
       var
    $recurring=1;
       var
    $built_in_trials=1;
       function
    do_bill($amount, $title, $products, $u, $invoice){
          global
    $config;
          
    $_SESSION['_amember_payment_id'] = $invoice;
          
    $vars = array(
             
    'MerchantID' => $this->config['merchant_id'],
             
    'ProductID'  => $products[0]['1shoppingcart_id'],
             
    'AMemberID'  => $invoice,
             
    'PostBackURL' => $config['root_url'] . "/plugins/payment/1shoppingcart/ipn.php"
          
    );
       }
    }
    __________________
    "That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett
    freelancer.internet.com
    Email me
    Reply With Quote
      #3  
    Old 03-18-2008, 08:36 AM
    RyanL RyanL is offline
    Registered User
     
    Join Date: Mar 2008
    Posts: 1
    Fatal error: No parent class available

    Thanks for your help and being understanding - this is really new to me! I'm sure this was completely my fault since I didn't copy and paste the entire code over, but now I am getting:

    Fatal error: No parent class available in /home/snh/public_html/AHYRadio/amember/plugins/payment/1shoppingcart/1shoppingcart.inc.php on line 133

    Here is the code - again, any help is greately appreciated!

    By the way - I tried to format it better this time - I hit enter every time there was a break, so hopefully this is set up right- thanks again.

    PHP Code:
    <?php
    if (!defined('INCLUDED_AMEMBER_CONFIG'))
    die(
    "Direct access to this location is not allowed");

    /**
    *
    *     Author: Alex Scott
    *      Email: alex@cgi-central.net
    *        Web: http://www.cgi-central.net
    *    Details: 1ShoppingCart Payment Plugin
    *    FileName $RCSfile: paypal_r.inc.php,v $
    *    Release: 3.0.9PRO ($Revision: 1.8 $)
    *
    * Please direct bug reports,suggestions or feedback to the cgi-central forums.
    * http://www.cgi-central.net/forum/
    *
    * aMember PRO is a commercial software. Any distribution is strictly prohibited.
    */
    class payment_1shoppingcart extends amember_payment {
       var
    $title = "1ShoppingCart";
       var
    $description = "All major credit cards accepted";
       var
    $fixed_price=1;
       var
    $recurring=1;
       var
    $built_in_trials=1;
       function
    do_bill($amount, $title, $products, $u, $invoice){
          global
    $config;
          
    $_SESSION['_amember_payment_id'] = $invoice;
          
    $vars = array(
             
    'MerchantID' => $this->config['merchant_id'],
             
    'ProductID'  => $products[0]['1shoppingcart_id'],
             
    'AMemberID'  => $invoice,
             
    'PostBackURL' => $config['root_url'] . "/plugins/payment/1shoppingcart/ipn.php"
          
    );
       }
    }
            return
    $this->encode_and_redirect("http://www.marketerschoice.com/app/netcart.asp", $vars);
        
            function
    validate_ipn($vars){
            
    //print_rr($vars, "POST we received from you");
                    
    $sign = $vars['VerifySign'];
            unset(
    $vars['VerifySign']);
            
    $vars['PostbackPassword'] = $this->config['postback_password'];
            
    $str = join('', array_values($vars));
            
    $md5 = md5($str);
                    if (
    $md5 != $sign){
                global
    $db;
                
    $db->log_error( "DEBUG: Validation error: verifysign incorrect. Make sure you set the same password in both 1ShoppingCart and aMember Pro CP<br>
                [md5($str)] != [$sign] <Br>
                "
    );
                return
    "Validation error: verifysign incorrect. Make sure you set the same password in both 1ShoppingCart and aMember Pro CP";
            }
                    
    //print_rr($vars, "vars to contactenate");
            //print_rr($str, "str");
            //print_rr($md5, "md5(str) (should be the same as sign)");
            //print_rr($sign, "sign (we received from you), it is anything but MD5 hash of str");
            //exit();    }    function process_postback($vars){
            
    global $db, $config;
            
    // validate if it is true PayPal IPN
            
    if (($err = $this->validate_ipn($vars)) != '')
                
    $this->postback_error($err);
                    
    $invoice = intval($vars['AMemberID']);
            
    $next_rebill = date('Y-m-d', strtotime($vars['NextRebillDate']));
            switch (
    $vars['Status']){
                case
    'start_recurring':
                case
    'payment':
                     
    $err = $db->finish_waiting_payment(
                        
    $invoice, $this->get_plugin_name(),
                        
    $vars['OrderID'], '', $vars);
                    if (
    $err)
                        
    $this->postback_error("finish_waiting_payment error: $err");
                                    if (
    $vars['Status'] != 'start_recurring') break;
                                    
    $p = $db->get_payment($invoice);
                    
    $p['expire_date'] = $next_rebill;
                    
    $db->update_payment($p['payment_id'], $p);
                    break;
               case
    'rebill':
                    
    $p = $db->get_payment($invoice);
                    if (!
    $p['payment_id'])
                        
    $this->postback_error("Cannot find original payment for [$invoice]");
                    
    $begin_date = $this->get_next_begin_date($invoice);
                    
    $newp = array();
                    
    $newp['member_id']   = $p['member_id'];
                    
    $newp['product_id']  = $p['product_id'];
                    
    $newp['paysys_id']   = $this->get_plugin_name();
                    
    $newp['receipt_id']  = $vars['OrderID'];
                    
    $newp['begin_date']  = $begin_date;
                    
    $newp['expire_date'] = $next_rebill;
                    
    $newp['amount']
          =
    $vars['Amount'];
                    
    $newp['completed']
       =
    $p['completed'];
                    
    $newp['data']
            = array(
    'RENEWAL_ORIG' => "RENEWAL ORIG: $invoice");
                    
    $newp['data'][]      = $vars;
                    
    $db->add_payment($newp);
                    break;
               case
    'recurring_eot':
                    
    $yesterday = date('Y-m-d', time()-3600*24);
                    
    $orig_p = $db->get_payment($invoice);
                    if (!
    $orig_p['payment_id'])
                        
    $this->postback_error("Cannot find original payment for [$invoice]");
                    foreach (
    $db->get_user_payments($orig_p['member_id'], 1) as $p){
                        if ((
    $p['product_id'] == $orig_p['product_id'])
                             && ((
    $p['data']['RENEWAL_ORIG'] == "RENEWAL ORIG: $invoice")
                                || (
    $p['payment_id'] == $invoice))
                            && (
    $p['expire_date'] >= $yesterday)){
                            
    $p['expire_date'] = $yesterday;
                            
    $p['data'][] = $vars;
                            
    $db->update_payment($p['payment_id'], $p);
                        }
                    }
                    break;
               default:
    $this->postback_error("Unknown status: [$vars[Status]]");
                            }
        }
            function
    get_next_begin_date($invoice){
            global
    $db;        $orig_p = $db->get_payment($invoice);
            
    $ret = $orig_p['expire_date'];
            foreach (
    $db->get_user_payments($orig_p['member_id'], 1) as $p){
                if ((
    $p['product_id'] == $orig_p['product_id'])
                     && (
    $p['data']['RENEWAL_ORIG'] == "RENEWAL ORIG: $invoice")
                    && (
    $p['expire_date'] > $ret))
                    
    $ret = $p['expire_date'];
            }
            return
    $ret;
        }
        
    /*
        function get_cancel_link($payment_id){
            return "http://www.1shoppingcart.com/cancel_payment.php";
        }
        */
        
    function init(){
            
    parent::init();
            
    add_product_field('1shoppingcart_id',
                
    '1ShoppingCart Product ID#',
                
    'text',
                
    "please take product ID# from 1ShoppingCart control panel<br>
                 and enter here. To avoid confusion, product must have the same<br>
                 price and duration settings"
                
    );
        }}
    $pl = & instantiate_plugin('payment', '1shoppingcart');?>
    Reply With Quote
      #4  
    Old 03-18-2008, 04:48 PM
    NogDog's Avatar
    NogDog NogDog is offline
    High Energy Magic Dept.
     
    Join Date: Aug 2004
    Location: Ankh-Morpork
    Posts: 14,009
    This line...
    PHP Code:
    class payment_1shoppingcart extends amember_payment {
    ...can only work if the class amember_payment has already been defined. You may need to require_once() the file that defines that class at the start of this script before you attempt to define this payment_1shoppingcart class.
    __________________
    "That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett
    freelancer.internet.com
    Email me
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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 Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:08 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.