Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    May 2009
    Posts
    155
    Plugin Contributions
    0

    Default Debug error (create account) - cant find error

    Nothing was changed on my site today but suddenly people cannot create a new account and instead get a blank page. Up until about an hour or two ago everything was fine with new accounts added no problem. I checked the ZC forums and as advised ran a debug which says:

    [18-Nov-2011 16:50:35] PHP Fatal error: Call to a member function on a non-object in /home/otcafxm/public_html/includes/modules/beeunique/create_account.php on line 404


    I have checked the php file and lines 403-405 say:
    //look for an exact match on zone ISO code
    $found_exact_iso_match_shipping = ($zone->RecordCount() == 1);
    if ($zone_shipping->RecordCount() > 1) {

    I cant see how this would cause the error the debug shows - is there a way I can locate it on the php page as reading through trying to find it is like reading another language. I don't usually do php side of things (my ex did before he was my ex) and although I can do basic things I am struggling with this and in the meantime nobody can create a new account on the site.

    Any help appreciated

    ADDED - this is not a new install and has been running for several years without this problem. it is also 1.3.9 if that helps any.
    Last edited by PudzPud; 18 Nov 2011 at 06:04 PM. Reason: Added text

  2. #2
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    What are you trying to locate....... You state you located it.

    try this
    https://www.zen-cart.com/tutorials/index.php?article=69
    Last edited by usernamenone; 18 Nov 2011 at 07:34 PM.

  3. #3
    Join Date
    May 2009
    Posts
    155
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    I have found that the error is in create_account.php and the debug shows it is a non-object on line 404. I opened the create_account.php file and line 404 shows as:

    Code:
    $found_exact_iso_match_shipping = ($zone->RecordCount() == 1);
    But i cannot see what the non-object is and don't know what to change on that line of code. Something in that php file (should be in the line above) is causing my site to show a blank page when someone clicks submit/create on the new account page. I need help in working out what it is so I can change it and get my site working again. PHP is like another language to me so I don't have a clue what to change in the code above.
    Last edited by PudzPud; 18 Nov 2011 at 07:37 PM. Reason: added text

  4. #4
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    log into admin then Tools then Developers Tool Kit Paste this code into the bottom search

    //look for an exact match on zone ISO code

    choose admin and catalog and php and you will find the files that could be causing the issue

    What version?

  5. #5
    Join Date
    May 2009
    Posts
    155
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    Hi, it shows as appearing in 7 different files.

    Also curiously for the create_account.php page it shows as being on line 402, yeat dreamweaver shows this as line 404 - is there a better way I should open php files to make sure I am looking at the correct line?

    I am on version 1.3.9h

    The full text for create_account.php (in case it helps) is:
    Code:
    <?php
    /**
     * create_account header_php.php
     *
     * @package modules
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: create_account.php 6772 2007-08-21 12:33:29Z drbyte $
     */
    // BOF Captcha
    // This should be first line of the script:
    $zco_notifier->notify('NOTIFY_MODULE_START_CREATE_ACCOUNT');
    
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    // BOF Captcha
    if(CAPTCHA_CREATE_ACCOUNT != 'false') {
            require(DIR_WS_CLASSES . 'captcha.php');
            $captcha = new captcha();
    }
    // EOF Captcha
    /**
     * Set some defaults
     */
      $process = false;
      $zone_name = '';
      $entry_state_has_zones = '';
      $error_state_input = false;
      $state = '';
      $zone_id = 0;
      $error = false;
      $email_format = (ACCOUNT_EMAIL_PREFERENCE == '1' ? 'HTML' : 'TEXT');
      $newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '0' ? false : true);
      $process_shipping = false;
      $zone_name_shipping = '';
      $entry_state_has_zones_shipping = '';
      $error_state_input_shipping = false;
      $state_shipping = '';
      $zone_id_shipping = 0;
    
    /**
     * Process form contents
     */
    if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
      $process = true;
    
      if (ACCOUNT_GENDER == 'true') {
        if (isset($_POST['gender'])) {
          $gender = zen_db_prepare_input($_POST['gender']);
        } else {
          $gender = false;
        }
      }
    
      if (isset($_POST['email_format'])) {
        $email_format = zen_db_prepare_input($_POST['email_format']);
      }
    
      if (ACCOUNT_COMPANY == 'true') $company = zen_db_prepare_input($_POST['company']);
      $firstname = zen_db_prepare_input(zen_sanitize_string($_POST['firstname']));
      $lastname = zen_db_prepare_input(zen_sanitize_string($_POST['lastname']));
      $nick = zen_db_prepare_input($_POST['nick']);
      if (ACCOUNT_DOB == 'true') $dob = zen_db_prepare_input($_POST['dob']);
      $email_address = zen_db_prepare_input($_POST['email_address']);
      $street_address = zen_db_prepare_input($_POST['street_address']);
      if (ACCOUNT_SUBURB == 'true') $suburb = zen_db_prepare_input($_POST['suburb']);
      $postcode = zen_db_prepare_input($_POST['postcode']);
      $city = zen_db_prepare_input($_POST['city']);
      if (ACCOUNT_STATE == 'true') {
        $state = zen_db_prepare_input($_POST['state']);
        if (isset($_POST['zone_id'])) {
          $zone_id = zen_db_prepare_input($_POST['zone_id']);
        } else {
          $zone_id = false;
        }
      }
      $country = zen_db_prepare_input($_POST['zone_country_id']);
      if (ACCOUNT_TELEPHONE == 'true') {
      $telephone = zen_db_prepare_input($_POST['telephone']);
      }
      $fax = zen_db_prepare_input($_POST['fax']);
      $customers_authorization = CUSTOMERS_APPROVAL_AUTHORIZATION;
      $customers_referral = zen_db_prepare_input($_POST['customers_referral']);
    
      if (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '2') {
        $newsletter = 0;
        if (isset($_POST['newsletter'])) {
          $newsletter = zen_db_prepare_input($_POST['newsletter']);
        }
      }
    
      $password = zen_db_prepare_input($_POST['password']);
      $confirmation = zen_db_prepare_input($_POST['confirmation']);
    
    //rmh referral start
        $source = zen_db_prepare_input($_POST['source']);
        if (isset($_POST['source_other'])) $source_other = zen_db_prepare_input($_POST['source_other']);
    //rmh referral end
    // BOF Captcha
      if (is_object($captcha) && !$captcha->validateCaptchaCode()) {
        $error = true;
        $messageStack->add('create_account', ERROR_CAPTCHA);
      }
    // EOF Captcha
    
      if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
        if (!isset($_POST['privacy_conditions']) || ($_POST['privacy_conditions'] != '1')) {
          $error = true;
          $messageStack->add('create_account', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error');
        }
      }
    
      if (ACCOUNT_GENDER == 'true') {
        if ( ($gender != 'm') && ($gender != 'f') ) {
          $error = true;
          $messageStack->add('create_account', ENTRY_GENDER_ERROR);
        }
      }
    
      if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
      }
    
      if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
      }
    
      if (ACCOUNT_DOB == 'true') {
        if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
          if (substr_count($dob,'/') > 2 || checkdate((int)substr(zen_date_raw($dob), 4, 2), (int)substr(zen_date_raw($dob), 6, 2), (int)substr(zen_date_raw($dob), 0, 4)) == false) {
            $error = true;
            $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
          }
        }
      }
    
      if (ACCOUNT_COMPANY == 'true') {
        if ((int)ENTRY_COMPANY_MIN_LENGTH > 0 && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
          $error = true;
          $messageStack->add('create_account', ENTRY_COMPANY_ERROR);
        }
      }
    
    
      if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
      } elseif (zen_validate_email($email_address) == false) {
        $error = true;
        $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
      } else {
        $check_email_query = "select count(*) as total
                                from " . TABLE_CUSTOMERS . "
                                where customers_email_address = '" . zen_db_input($email_address) . "'
                                and COWOA_account != 1";
        $check_email = $db->Execute($check_email_query);
    
        if ($check_email->fields['total'] > 0) {
          $error = true;
          $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
        }
      }
    
      if ($phpBB->phpBB['installed'] == true) {
        if (strlen($nick) < ENTRY_NICK_MIN_LENGTH)  {
          $error = true;
          $messageStack->add('create_account', ENTRY_NICK_LENGTH_ERROR);
        } else {
          // check Zen Cart for duplicate nickname
          $sql = "select * from " . TABLE_CUSTOMERS  . "
                               where customers_nick = :nick:";
          $check_nick_query = $db->bindVars($sql, ':nick:', $nick, 'string');
          $check_nick = $db->Execute($check_nick_query);
          if ($check_nick->RecordCount() > 0 ) {
            $error = true;
            $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR);
          }
          // check phpBB for duplicate nickname
          if ($phpBB->phpbb_check_for_duplicate_nick($nick) == 'already_exists' ) {
            $error = true;
            $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR . ' (phpBB)');
          }
        }
      }
    
      if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
      }
      // BEGIN PO Box Ban 1/1
      if (defined('PO_BOX_ERROR')) {
        if ( preg_match('/PO BOX/si', $street_address) ) {
          $error = true;
          $messageStack->add('create_account', PO_BOX_ERROR);
        } else if ( preg_match('/POBOX/si', $street_address) ) {
          $error = true;
          $messageStack->add('create_account', PO_BOX_ERROR);
        } else if ( preg_match('/P\.O\./si', $street_address) ) {
          $error = true;
          $messageStack->add('create_account', PO_BOX_ERROR);
        } else if ( preg_match('/P\.O/si', $street_address) ) {
          $error = true;
          $messageStack->add('create_account', PO_BOX_ERROR);
        } else if ( preg_match('/PO\./si', $street_address) ) {
          $error = true;
          $messageStack->add('create_account', PO_BOX_ERROR);
        }
      }
      // END PO Box Ban 1/1
    
      if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_CITY_ERROR);
      }
    
      if (ACCOUNT_STATE == 'true') {
        $check_query = "SELECT count(*) AS total
                        FROM " . TABLE_ZONES . "
                        WHERE zone_country_id = :zoneCountryID";
        $check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
        $check = $db->Execute($check_query);
        $entry_state_has_zones = ($check->fields['total'] > 0);
        if ($entry_state_has_zones == true) {
          $zone_query = "SELECT distinct zone_id, zone_name, zone_code
                         FROM " . TABLE_ZONES . "
                         WHERE zone_country_id = :zoneCountryID
                         AND " .
                         ((trim($state) != '' && $zone_id == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
                        "zone_id = :zoneID
                         ORDER BY zone_code ASC, zone_name";
    
          $zone_query = $db->bindVars($zone_query, ':zoneCountryID', $country, 'integer');
          $zone_query = $db->bindVars($zone_query, ':zoneState', strtoupper($state), 'noquotestring');
          $zone_query = $db->bindVars($zone_query, ':zoneID', $zone_id, 'integer');
          $zone = $db->Execute($zone_query);
    
          //look for an exact match on zone ISO code
          $found_exact_iso_match = ($zone->RecordCount() == 1);
          if ($zone->RecordCount() > 1) {
            while (!$zone->EOF && !$found_exact_iso_match) {
              if (strtoupper($zone->fields['zone_code']) == strtoupper($state) ) {
                $found_exact_iso_match = true;
                continue;
              }
              $zone->MoveNext();
            }
          }
    
          if ($found_exact_iso_match) {
            $zone_id = $zone->fields['zone_id'];
            $zone_name = $zone->fields['zone_name'];
          } else {
            $error = true;
            $error_state_input = true;
            $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
          }
        } else {
          if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
            $error = true;
            $error_state_input = true;
            $messageStack->add('create_account', ENTRY_STATE_ERROR);
          }
        }
      }
    
      if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
      }
    
      if ( (is_numeric($country) == false) || ($country < 1) ) {
        $error = true;
        $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
      }
    
      if (ACCOUNT_TELEPHONE == 'true') {
      if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
        }
      }
    
      // confirm email address modification
      if (FEC_CONFIRM_EMAIL == 'true') {
        $email_address_confirm = zen_db_prepare_input($_POST['email_address_confirm']);
        if ($email_address != $email_address_confirm) {
          $error = true;
          $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CONFIRM_ERROR);
        }
      }
    //rmh referral start
        if ((REFERRAL_REQUIRED == 'true') && (is_numeric($source) == false)) {
            $error = true;
            $messageStack->add('create_account', ENTRY_SOURCE_ERROR);
        }
        if ((REFERRAL_REQUIRED == 'true') && (DISPLAY_REFERRAL_OTHER == 'true') &&($source == '9999') && (!zen_not_null($source_other)) ) {
            $error = true;
            $messageStack->add('create_account', ENTRY_SOURCE_OTHER_ERROR);
        }
    //rmh referral end
    
      if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {
        $error = true;
        $messageStack->add('create_account', ENTRY_PASSWORD_ERROR);
      } elseif ($password != $confirmation) {
        $error = true;
        $messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
      }
    // begin shipping
        if ($_GET['main_page'] != "create_account" && enable_shippingAddress()) {
          $process_shipping = true;
          if (ACCOUNT_GENDER == 'true') $gender_shipping = zen_db_prepare_input($_POST['gender_shipping']);
          if (ACCOUNT_COMPANY == 'true') $company_shipping = zen_db_prepare_input($_POST['company_shipping']);
          $firstname_shipping = zen_db_prepare_input($_POST['firstname_shipping']);
          $lastname_shipping = zen_db_prepare_input($_POST['lastname_shipping']);
          $street_address_shipping = zen_db_prepare_input($_POST['street_address_shipping']);
          if (ACCOUNT_SUBURB == 'true') $suburb_shipping = zen_db_prepare_input($_POST['suburb_shipping']);
          $postcode_shipping = zen_db_prepare_input($_POST['postcode_shipping']);
          $city_shipping = zen_db_prepare_input($_POST['city_shipping']);
          if (ACCOUNT_STATE == 'true') {
            $state_shipping = zen_db_prepare_input($_POST['state_shipping']);
            if (isset($_POST['zone_id_shipping'])) {
              $zone_id_shipping = zen_db_prepare_input($_POST['zone_id_shipping']);
            } else {
              $zone_id_shipping = false;
            }
          }
          $country_shipping = zen_db_prepare_input($_POST['zone_country_id_shipping']);
      //echo ' I SEE: country=' . $country . '&nbsp;&nbsp;&nbsp;state=' . $state . '&nbsp;&nbsp;&nbsp;zone_id=' . $zone_id;
          if (ACCOUNT_GENDER == 'true') {
            if ( ($gender_shipping != 'm') && ($gender_shipping != 'f') ) {
              $error = true;
              $messageStack->add('create_account', ENTRY_GENDER_ERROR);
            }
          }
    
          if (strlen($firstname_shipping) < ENTRY_FIRST_NAME_MIN_LENGTH) {
            $error = true;
            $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
          }
    
          if (strlen($lastname_shipping) < ENTRY_LAST_NAME_MIN_LENGTH) {
            $error = true;
            $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
          }
    
          if (strlen($street_address_shipping) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
            $error = true;
            $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
          }
    
          if (strlen($city_shipping) < ENTRY_CITY_MIN_LENGTH) {
            $error = true;
            $messageStack->add('create_account', ENTRY_CITY_ERROR);
          }
          
          // BEGIN PO Box Ban 1/1
          if (defined('PO_BOX_ERROR')) {
            if ( preg_match('/PO BOX/si', $street_address_shipping) ) {
              $error = true;
              $messageStack->add('create_account', PO_BOX_ERROR);
            } else if ( preg_match('/POBOX/si', $street_address_shipping) ) {
              $error = true;
              $messageStack->add('create_account', PO_BOX_ERROR);
            } else if ( preg_match('/P\.O\./si', $street_address_shipping) ) {
              $error = true;
              $messageStack->add('create_account', PO_BOX_ERROR);
            } else if ( preg_match('/P\.O/si', $street_address_shipping) ) {
              $error = true;
              $messageStack->add('create_account', PO_BOX_ERROR);
            } else if ( preg_match('/PO\./si', $street_address_shipping) ) {
              $error = true;
              $messageStack->add('create_account', PO_BOX_ERROR);
            }
          }
          // END PO Box Ban 1/1
    
          if (ACCOUNT_STATE == 'true') {
            $check_query = "SELECT count(*) AS total
                            FROM " . TABLE_ZONES . "
                            WHERE zone_country_id = :zoneCountryID";
            $check_query = $db->bindVars($check_query, ':zoneCountryID', $country_shipping, 'integer');
            $check = $db->Execute($check_query);
            $entry_state_has_zones_shipping = ($check->fields['total'] > 0);
            if ($entry_state_has_zones_shipping == true) {
              $zone_query = "SELECT distinct zone_id, zone_name, zone_code
                             FROM " . TABLE_ZONES . "
                             WHERE zone_country_id = :zoneCountryID
                             AND " . 
                           ((trim($state_shipping) != '' && $zone_id_shipping == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
                            "zone_id = :zoneID
                             ORDER BY zone_code ASC, zone_name";
    
              $zone_query = $db->bindVars($zone_query, ':zoneCountryID', $country_shipping, 'integer');
              $zone_query = $db->bindVars($zone_query, ':zoneState', strtoupper($state_shipping), 'noquotestring');
              $zone_query = $db->bindVars($zone_query, ':zoneID', $zone_id_shipping, 'integer');
              $zone_shipping = $db->Execute($zone_query);
    
              //look for an exact match on zone ISO code
              $found_exact_iso_match_shipping = ($zone->RecordCount() == 1);
              if ($zone_shipping->RecordCount() > 1) {
                while (!$zone_shipping->EOF && !$found_exact_iso_match_shipping) {
                  if (strtoupper($zone->fields['zone_code']) == strtoupper($state_shipping) ) {
                    $found_exact_iso_match_shipping = true;
                    continue;
                  }
                  $zone_shipping->MoveNext();
                }

  6. #6
    Join Date
    May 2009
    Posts
    155
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    second part as too large for one post

    Code:
              }
    
              if ($found_exact_iso_match_shipping) {
                $zone_id_shipping = $zone_shipping->fields['zone_id'];
                $zone_name_shipping = $zone_shipping->fields['zone_name'];
              } else {
                $error = true;
                $error_state_input_shipping = true;
                $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
              }
            } else {
              if (strlen($state_shipping) < ENTRY_STATE_MIN_LENGTH) {
                $error = true;
                $error_state_input_shipping = true;
                $messageStack->add('create_account', ENTRY_STATE_ERROR);
              }
            }
          }
    
          if (strlen($postcode_shipping) < ENTRY_POSTCODE_MIN_LENGTH) {
            $error = true;
            $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
          }
    
          if ( (is_numeric($country_shipping) == false) || ($country_shipping < 1) ) {
            $error = true;
            $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
          }
        }
    // end shipping  
    
      if ($error == true) {
        // hook notifier class
        $zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
      } else {
        $sql_data_array = array('customers_firstname' => $firstname,
                                'customers_lastname' => $lastname,
                                'customers_email_address' => $email_address,
                                'customers_nick' => $nick,
                                'customers_telephone' => $telephone,
                                'customers_fax' => $fax,
                                'customers_newsletter' => (int)$newsletter,
                                'customers_email_format' => $email_format,
                                'customers_default_address_id' => 0,
                                'customers_password' => zen_encrypt_password($password),
                                'customers_authorization' => (int)CUSTOMERS_APPROVAL_AUTHORIZATION
        );
    
        if ((CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '')) $sql_data_array['customers_referral'] = $customers_referral;
        if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
        if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = (empty($_POST['dob']) || $dob_entered == '0001-01-01 00:00:00' ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_date_raw($_POST['dob']));
    
        zen_db_perform(TABLE_CUSTOMERS, $sql_data_array);
    
        $_SESSION['customer_id'] = $db->Insert_ID();
    
        $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD', array_merge(array('customer_id' => $_SESSION['customer_id']), $sql_data_array));
    
        $sql_data_array = array('customers_id' => $_SESSION['customer_id'],
                                'entry_firstname' => $firstname,
                                'entry_lastname' => $lastname,
                                'entry_street_address' => $street_address,
                                'entry_postcode' => $postcode,
                                'entry_city' => $city,
                                'entry_country_id' => $country);
    
        if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
        if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
        if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
        if (ACCOUNT_STATE == 'true') {
          if ($zone_id > 0) {
            $sql_data_array['entry_zone_id'] = $zone_id;
            $sql_data_array['entry_state'] = '';
          } else {
            $sql_data_array['entry_zone_id'] = '0';
            $sql_data_array['entry_state'] = $state;
          }
        }
    
        zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
    
        $address_id = $db->Insert_ID();
    
        $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD', array_merge(array('address_id' => $address_id), $sql_data_array));
    
        $sql = "update " . TABLE_CUSTOMERS . "
                  set customers_default_address_id = '" . (int)$address_id . "'
                  where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
    
        $db->Execute($sql);
        // shipping address
        if ($_GET['main_page'] != "create_account" && enable_shippingAddress()) {
          // create shipping address
          $sql_data_array = array(array('fieldName'=>'customers_id', 'value'=>$_SESSION['customer_id'], 'type'=>'integer'),
                                  array('fieldName'=>'entry_firstname', 'value'=>$firstname_shipping, 'type'=>'string'),
                                  array('fieldName'=>'entry_lastname','value'=>$lastname_shipping, 'type'=>'string'),
                                  array('fieldName'=>'entry_street_address','value'=>$street_address_shipping, 'type'=>'string'),
                                  array('fieldName'=>'entry_postcode', 'value'=>$postcode_shipping, 'type'=>'string'),
                                  array('fieldName'=>'entry_city', 'value'=>$city_shipping, 'type'=>'string'),
                                  array('fieldName'=>'entry_country_id', 'value'=>$country_shipping, 'type'=>'integer')
          );
    
          if (ACCOUNT_GENDER == 'true') $sql_data_array[] = array('fieldName'=>'entry_gender', 'value'=>$gender_shipping, 'type'=>'enum:m|f');
          if (ACCOUNT_COMPANY == 'true') $sql_data_array[] = array('fieldName'=>'entry_company', 'value'=>$company_shipping, 'type'=>'string');
          if (ACCOUNT_SUBURB == 'true') $sql_data_array[] = array('fieldName'=>'entry_suburb', 'value'=>$suburb_shipping, 'type'=>'string');
          if (ACCOUNT_STATE == 'true') {
            if ($zone_id_shipping > 0) {
              $sql_data_array[] = array('fieldName'=>'entry_zone_id', 'value'=>$zone_id_shipping, 'type'=>'integer');
              $sql_data_array[] = array('fieldName'=>'entry_state', 'value'=>'', 'type'=>'string');
            } else {
              $sql_data_array[] = array('fieldName'=>'entry_zone_id', 'value'=>0, 'type'=>'integer');
              $sql_data_array[] = array('fieldName'=>'entry_state', 'value'=>$state_shipping, 'type'=>'string');
            }
          }
          $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array);
          $_SESSION['sendto'] = $db->Insert_ID();
        } else {
          // FEC MODIFICATION
          $_SESSION['sendto'] = (int)$address_id;
        }
        $_SESSION['shipping'] = ''; 
    //rmh referral start
        $sql = "insert into " . TABLE_CUSTOMERS_INFO . "
          (customers_info_id, customers_info_number_of_logons, 
          customers_info_date_account_created, customers_info_source_id) 
          values ('" . (int)$_SESSION['customer_id'] . "', '0', now(), '". (int)$source . "')";
    
    
        $db->Execute($sql);
    	  if ($source == '9999') {
            zen_db_perform(TABLE_SOURCES_OTHER, array('customers_id' => $_SESSION['customer_id'], 'sources_other_name' => $source_other));
          }
    //      $sql = "insert into " . TABLE_CUSTOMERS_INFO . "
    //                          (customers_info_id, customers_info_number_of_logons,
    //                           customers_info_date_account_created)
    //              values ('" . (int)$_SESSION['customer_id'] . "', '0', now())";
    //
    //      $db->Execute($sql);
    //rmh referral end
    // BEGIN newsletter_subscribe mod 1/1
    // If a newsletter only account exists we update the info,
    // but keep the subscription active, and give them a message that to
    // change they should do so on their account page (after creation).
        if(defined('NEWSONLY_SUBSCRIPTION_ENABLED') && (NEWSONLY_SUBSCRIPTION_ENABLED=='true')) {
          $check_subscribers_query = "select count(*) as total from " . TABLE_SUBSCRIBERS . "
                        where email_address = '" . zen_db_input($email_address) . "' ";
          $check_subscribers = $db->Execute($check_subscribers_query);
          if ($check_subscribers->fields['total'] > 0) {
            $sql = "UPDATE " . TABLE_SUBSCRIBERS . " SET
                    customers_id = '" . (int)$_SESSION['customer_id'] . "',
                    email_format = '" . zen_db_input($email_format) . "',
                    confirmed = '1' 
                    WHERE email_address = '" . zen_db_input($email_address) . "' ";
            $db->Execute($sql);
            $messageStack->add('create_account', SUBSCRIBE_MERGED_NEWSONLY_ACCT);
          } else {
            if (!empty($newsletter)) {
              $sql = "INSERT INTO " . TABLE_SUBSCRIBERS . " 
                      (customers_id, email_address, email_format, confirmed, subscribed_date)
                      VALUES ('" . (int)$_SESSION['customer_id'] . "', '" . zen_db_input($email_address) . "', '" . zen_db_input($email_format) . "', '1', now())";
              $db->Execute($sql);
            }
          }
        }
    // END newsletter_subscribe mod 1/1
    
        // phpBB create account
        if ($phpBB->phpBB['installed'] == true) {
          $phpBB->phpbb_create_account($nick, $password, $email_address);
        }
        // End phppBB create account
    
        if (SESSION_RECREATE == 'True') {
          zen_session_recreate();
        }
    
        $_SESSION['customer_first_name'] = $firstname;
        $_SESSION['customer_default_address_id'] = $address_id;
        $_SESSION['customer_country_id'] = $country;
        $_SESSION['customer_zone_id'] = $zone_id;
        $_SESSION['customers_authorization'] = $customers_authorization;
    
        // restore cart contents
        $_SESSION['cart']->restore_contents();
    
        // hook notifier class
        $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT');
    
        // build the message content
        $name = $firstname . ' ' . $lastname;
    
        if (ACCOUNT_GENDER == 'true') {
          if ($gender == 'm') {
            $email_text = sprintf(EMAIL_GREET_MR, $lastname);
          } else {
            $email_text = sprintf(EMAIL_GREET_MS, $lastname);
          }
        } else {
          $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
        }
        $html_msg['EMAIL_GREETING'] = str_replace('\n','',$email_text);
        $html_msg['EMAIL_FIRST_NAME'] = $firstname;
        $html_msg['EMAIL_LAST_NAME']  = $lastname;
    
        // initial welcome
        $email_text .=  EMAIL_WELCOME;
        $html_msg['EMAIL_WELCOME'] = str_replace('\n','',EMAIL_WELCOME);
    
        if (NEW_SIGNUP_DISCOUNT_COUPON != '' and NEW_SIGNUP_DISCOUNT_COUPON != '0') {
          $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON;
          $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
          $coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
          $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id ."', '0', 'Admin', '" . $email_address . "', now() )");
    
          $text_coupon_help = sprintf(TEXT_COUPON_HELP_DATE, zen_date_short($coupon->fields['coupon_start_date']),zen_date_short($coupon->fields['coupon_expire_date']));
    
          // if on, add in Discount Coupon explanation
          //        $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .
          $email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER .
          (!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') . $text_coupon_help  . "\n\n" .
          strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR;
    
          $html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER ;
          $html_msg['COUPON_DESCRIPTION']     = (!empty($coupon_desc->fields['coupon_description']) ? '<strong>' . $coupon_desc->fields['coupon_description'] . '</strong>' : '');
          $html_msg['COUPON_TEXT_TO_REDEEM']  = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
          $html_msg['COUPON_CODE']  = $coupon->fields['coupon_code'] . $text_coupon_help;
        } //endif coupon
    
        if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
          $coupon_code = zen_create_coupon_code();
          $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
          $insert_id = $db->Insert_ID();
          $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $email_address . "', now() )");
    
          // if on, add in GV explanation
          $email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) .
          sprintf(EMAIL_GV_REDEEM, $coupon_code) .
          EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" .
          EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
          $html_msg['GV_WORTH'] = str_replace('\n','',sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) );
          $html_msg['GV_REDEEM'] = str_replace('\n','',str_replace('\n\n','<br />',sprintf(EMAIL_GV_REDEEM, '<strong>' . $coupon_code . '</strong>')));
          $html_msg['GV_CODE_NUM'] = $coupon_code;
          $html_msg['GV_CODE_URL'] = str_replace('\n','',EMAIL_GV_LINK . '<a href="' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . '">' . TEXT_GV_NAME . ': ' . $coupon_code . '</a>');
          $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
        } // endif voucher
    
        // add in regular email welcome text
        $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
    
        $html_msg['EMAIL_MESSAGE_HTML']  = str_replace('\n','',EMAIL_TEXT);
        $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\n','',EMAIL_CONTACT);
        $html_msg['EMAIL_CLOSURE']       = nl2br(EMAIL_GV_CLOSURE);
    
        // include create-account-specific disclaimer
        $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS). "\n\n";
        $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
    
        // send welcome email
        if (trim(EMAIL_SUBJECT) != 'n/a') zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');
    
        // send additional emails
        if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {
          if ($_SESSION['customer_id']) {
            $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax
                                from " . TABLE_CUSTOMERS . "
                                where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
    
            $account = $db->Execute($account_query);
          }
    
          $extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
          $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
          if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,
          $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
        } //endif send extra emails
    
        zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
    
      } //endif !error
    }
    
    
    /*
     * Set flags for template use:
     */
      $selected_country = (isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '') ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
      $selected_country_shipping = (isset($_POST['zone_country_id_shipping']) && $_POST['zone_country_id_shipping'] != '') ? $country_shipping : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;  
      $flag_show_pulldown_states = ((($process == true || $entry_state_has_zones == true) && $zone_name == '') || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input) ? true : false;
      $flag_show_pulldown_states_shipping = ((($process_shipping == true || $entry_state_has_zones_shipping == true) && $zone_name_shipping == '') || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input_shipping) ? true : false;
      $state = ($flag_show_pulldown_states) ? ($state == '' ? '&nbsp;' : $state) : $zone_name;
      $state_shipping = ($flag_show_pulldown_states_shipping) ? ($state_shipping == '' ? '&nbsp;' : $state_shipping) : $zone_name_shipping;
      $state_field_label = ($flag_show_pulldown_states) ? '' : ENTRY_STATE;
      $state_field_label_shipping = ($flag_show_pulldown_states_shipping) ? '' : ENTRY_STATE;
    
    // This should be last line of the script:
    $zco_notifier->notify('NOTIFY_MODULE_END_CREATE_ACCOUNT');

  7. #7
    Join Date
    Sep 2006
    Posts
    542
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    You should not be editing your files in DreamWeaver. this will cause php code to break.

    http://www.zen-cart.com/wiki/index.p...d_Text_Editors

  8. #8
    Join Date
    May 2009
    Posts
    155
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    Thanks - have got that now and double checked - problem line 404 is def

    $found_exact_iso_match_shipping = ($zone->RecordCount() == 1);

    I ahev 8 matches showing up from developers kit search and no idea which one to change - am scared to even try as I have no idea what i'm changing as looks like a mass of symbols and numbers and makes no sense to me at all
    Last edited by PudzPud; 18 Nov 2011 at 08:08 PM. Reason: changed text

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Debug error (create account) - cant find error

    Are you sure which one you want to check?

    You are using:
    Code:
        $found_exact_iso_match_shipping = ($zone->RecordCount() == 1);
    Should you be using:
    Code:
        $found_exact_iso_match_shipping = ($zone_shipping->RecordCount() == 1);
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  10. #10
    Join Date
    May 2009
    Posts
    155
    Plugin Contributions
    0

    Default Re: Debug error (create account) - cant find error

    I use Advanced Shipping module which was installed for me back in Feb and has worked fine all this time until today. The shipping part still works fine for existing customers and I can create orders no problem - the only issue is when someone is trying to create a new account they get a blank page instead of the 'congratulations you have created an account' page. I am still unsure why a line about shipping would be causing this problem but the debug check showed this was the php page and line with the error.

    If you think this is the solution let me know and I will change the text
    FROM - $found_exact_iso_match_shipping = ($zone->RecordCount() == 1);
    TO - $found_exact_iso_match_shipping = ($zone_shipping->RecordCount() == 1);

    ( i just want to double check with you first as I am afraid in case it messes up my shipping module)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 13 Aug 2008, 10:57 AM
  2. error cant find anywhere
    By jonothetigger in forum General Questions
    Replies: 0
    Last Post: 2 Oct 2007, 09:05 PM
  3. Create Account Password Error
    By Shelia in forum Managing Customers and Orders
    Replies: 10
    Last Post: 28 Nov 2006, 03:21 AM
  4. Error in create an account Link
    By marie893 in forum General Questions
    Replies: 1
    Last Post: 6 Jun 2006, 08:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg