[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> affiliate_details.php (source)

   1  <?php
   2  /*

   3  $Id: affiliate_details.php 14 2006-07-28 17:42:07Z user $

   4  

   5    OSC-Affiliate

   6  

   7    Contribution based on:

   8  

   9    osCMax Power E-Commerce

  10    http://oscdox.com

  11  

  12    Copyright 2006 osCMax

  13  

  14    Released under the GNU General Public License

  15  */
  16  
  17  // Most of this file is changed or moved to BTS - Basic Template System - format.

  18  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  19  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  20  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  21  
  22    require ('includes/application_top.php');
  23    $details == 'true';
  24    if (!tep_session_is_registered('affiliate_id')) {
  25      $navigation->set_snapshot();
  26      tep_redirect(tep_href_link(FILENAME_AFFILIATE, '', 'SSL'));
  27    }
  28    
  29    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_AFFILIATE_DETAILS);
  30  // BOF: MOD - Country-State Selector

  31    $refresh = false;
  32    if (isset($HTTP_POST_VARS['action']) && (($HTTP_POST_VARS['action'] == 'process') || ($HTTP_POST_VARS['action'] == 'refresh'))) {
  33      if ($HTTP_POST_VARS['action'] == 'process')  $process = true;
  34      if ($HTTP_POST_VARS['action'] == 'refresh') $refresh = true;
  35  // EOF: MOD - Country-State Selector

  36  
  37      $a_gender = tep_db_prepare_input($HTTP_POST_VARS['a_gender']);
  38      $a_firstname = tep_db_prepare_input($HTTP_POST_VARS['a_firstname']);
  39      $a_lastname = tep_db_prepare_input($HTTP_POST_VARS['a_lastname']);
  40      $a_dob = tep_db_prepare_input($HTTP_POST_VARS['a_dob']);
  41      $a_email_address = tep_db_prepare_input($HTTP_POST_VARS['a_email_address']);
  42      $a_company = tep_db_prepare_input($HTTP_POST_VARS['a_company']);
  43      $a_company_taxid = tep_db_prepare_input($HTTP_POST_VARS['a_company_taxid']);
  44      $a_payment_check = tep_db_prepare_input($HTTP_POST_VARS['a_payment_check']);
  45      $a_payment_paypal = tep_db_prepare_input($HTTP_POST_VARS['a_payment_paypal']);
  46      $a_payment_bank_name = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_name']);
  47      $a_payment_bank_branch_number = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_branch_number']);
  48      $a_payment_bank_swift_code = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_swift_code']);
  49      $a_payment_bank_account_name = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_account_name']);
  50      $a_payment_bank_account_number = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_account_number']);
  51      $a_street_address = tep_db_prepare_input($HTTP_POST_VARS['a_street_address']);
  52      $a_suburb = tep_db_prepare_input($HTTP_POST_VARS['a_suburb']);
  53      $a_postcode = tep_db_prepare_input($HTTP_POST_VARS['a_postcode']);
  54      $a_city = tep_db_prepare_input($HTTP_POST_VARS['a_city']);
  55      $a_country=tep_db_prepare_input($HTTP_POST_VARS['a_country']);
  56      $a_zone_id = tep_db_prepare_input($HTTP_POST_VARS['a_zone_id']);
  57      $a_state = tep_db_prepare_input($HTTP_POST_VARS['a_state']);
  58      $a_telephone = tep_db_prepare_input($HTTP_POST_VARS['a_telephone']);
  59      $a_fax = tep_db_prepare_input($HTTP_POST_VARS['a_fax']);
  60      $a_homepage = tep_db_prepare_input($HTTP_POST_VARS['a_homepage']);
  61      $a_password = tep_db_prepare_input($HTTP_POST_VARS['a_password']);
  62  
  63  // BOF: MOD - Country-State Selector

  64      if ($process) {
  65  // EOF: MOD - Country-State Selector

  66      $error = false; // reset error flag

  67  
  68      if (ACCOUNT_GENDER == 'true') {
  69        if (($a_gender == 'm') || ($a_gender == 'f')) {
  70          $entry_gender_error = false;
  71        } else {
  72          $error = true;
  73          $entry_gender_error = true;
  74        }
  75      }
  76  
  77      if (strlen($a_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
  78        $error = true;
  79        $entry_firstname_error = true;
  80      } else {
  81        $entry_firstname_error = false;
  82      }
  83  
  84      if (strlen($a_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
  85        $error = true;
  86        $entry_lastname_error = true;
  87      } else {
  88        $entry_lastname_error = false;
  89      }
  90  
  91      if (ACCOUNT_DOB == 'true') {
  92        if (checkdate(substr(tep_date_raw($a_dob), 4, 2), substr(tep_date_raw($a_dob), 6, 2), substr(tep_date_raw($a_dob), 0, 4))) {
  93          $entry_date_of_birth_error = false;
  94        } else {
  95          $error = true;
  96          $entry_date_of_birth_error = true;
  97        }
  98      }
  99    
 100      if (strlen($a_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
 101        $error = true;
 102        $entry_email_address_error = true;
 103      } else {
 104        $entry_email_address_error = false;
 105      }
 106  
 107      if (!tep_validate_email($a_email_address)) {
 108        $error = true;
 109        $entry_email_address_check_error = true;
 110      } else {
 111        $entry_email_address_check_error = false;
 112      }
 113  
 114      if (strlen($a_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
 115        $error = true;
 116        $entry_street_address_error = true;
 117      } else {
 118        $entry_street_address_error = false;
 119      }
 120  
 121      if (strlen($a_postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
 122        $error = true;
 123        $entry_post_code_error = true;
 124      } else {
 125        $entry_post_code_error = false;
 126      }
 127  
 128      if (strlen($a_city) < ENTRY_CITY_MIN_LENGTH) {
 129        $error = true;
 130        $entry_city_error = true;
 131      } else {
 132        $entry_city_error = false;
 133      }
 134  
 135      if (strlen($a_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
 136        $error = true;
 137        $entry_telephone_error = true;
 138      } else {
 139        $entry_telephone_error = false;
 140      }
 141  
 142      $passlen = strlen($a_password);
 143      if ($passlen < ENTRY_PASSWORD_MIN_LENGTH) {
 144        $error = true;
 145        $entry_password_error = true;
 146      } else {
 147        $entry_password_error = false;
 148      }
 149  
 150      if ($a_password != $a_confirmation) {
 151        $error = true;
 152        $entry_password_error = true;
 153      }
 154  
 155      $check_email_query = tep_db_query("select count(*) as total from " . TABLE_AFFILIATE . " where affiliate_email_address = '" .  tep_db_input($a_email_address) . "' and affiliate_id != '" . tep_db_input($affiliate_id) . "'");
 156      $check_email = tep_db_fetch_array($check_email_query);
 157      if ($check_email['total'] > 0) {
 158        $error = true;
 159        $entry_email_address_exists = true;
 160      } else {
 161        $entry_email_address_exists = false;
 162      }
 163  
 164      // Check Suburb

 165      $entry_suburb_error = false;
 166  
 167      // Check Fax

 168      $entry_fax_error = false;
 169  
 170      if (!affiliate_check_url($a_homepage)) {
 171        $error = true;
 172        $entry_homepage_error = true;
 173      } else {
 174        $entry_homepage_error = false;
 175      }
 176  
 177  
 178      // Check Company

 179      $entry_company_error = false;
 180      $entry_company_taxid_error = false;
 181  
 182      // Check Payment

 183      $entry_payment_check_error = false;
 184      $entry_payment_paypal_error = false;
 185      $entry_payment_bank_name_error = false;
 186      $entry_payment_bank_branch_number_error = false;
 187      $entry_payment_bank_swift_code_error = false;
 188      $entry_payment_bank_account_name_error = false;
 189      $entry_payment_bank_account_number_error = false;
 190  
 191      if (!$error) {
 192  
 193        $sql_data_array = array('affiliate_firstname' => $a_firstname,
 194                                'affiliate_lastname' => $a_lastname,
 195                                'affiliate_email_address' => $a_email_address,
 196                                'affiliate_payment_check' => $a_payment_check,
 197                                'affiliate_payment_paypal' => $a_payment_paypal,
 198                                'affiliate_payment_bank_name' => $a_payment_bank_name,
 199                                'affiliate_payment_bank_branch_number' => $a_payment_bank_branch_number,
 200                                'affiliate_payment_bank_swift_code' => $a_payment_bank_swift_code,
 201                                'affiliate_payment_bank_account_name' => $a_payment_bank_account_name,
 202                                'affiliate_payment_bank_account_number' => $a_payment_bank_account_number,
 203                                'affiliate_street_address' => $a_street_address,
 204                                'affiliate_postcode' => $a_postcode,
 205                                'affiliate_city' => $a_city,
 206                                'affiliate_country_id' => $a_country,
 207                                'affiliate_telephone' => $a_telephone,
 208                                'affiliate_fax' => $a_fax,
 209                                'affiliate_homepage' => $a_homepage,
 210                                'affiliate_password' => tep_encrypt_password($a_password));
 211  
 212        if (ACCOUNT_GENDER == 'true') $sql_data_array['affiliate_gender'] = $a_gender;
 213        if (ACCOUNT_DOB == 'true') $sql_data_array['affiliate_dob'] = tep_date_raw($a_dob);
 214        if (ACCOUNT_COMPANY == 'true') {
 215          $sql_data_array['affiliate_company'] = $a_company;
 216          $sql_data_array['affiliate_company_taxid'] = $a_company_taxid;
 217        }
 218        if (ACCOUNT_SUBURB == 'true') $sql_data_array['affiliate_suburb'] = $a_suburb;
 219        if (ACCOUNT_STATE == 'true') {
 220          if ($a_zone_id > 0) {
 221            $sql_data_array['affiliate_zone_id'] = $a_zone_id;
 222            $sql_data_array['affiliate_state'] = '';
 223          } else {
 224            $sql_data_array['affiliate_zone_id'] = '0';
 225            $sql_data_array['affiliate_state'] = $a_state;
 226          }
 227        }
 228  
 229        $sql_data_array['affiliate_date_account_last_modified'] = 'now()';
 230  
 231        tep_db_perform(TABLE_AFFILIATE, $sql_data_array, 'update', "affiliate_id = '" . tep_db_input($affiliate_id) . "'");
 232  
 233        tep_redirect(tep_href_link(FILENAME_AFFILIATE_DETAILS_OK, '', 'SSL'));
 234      }
 235    }
 236  // BOF: MOD - Country-State Selector

 237   }
 238  if ($HTTP_POST_VARS['action'] == 'refresh') {$state = '';}
 239  if (!isset($country)){$country = DEFAULT_COUNTRY;}
 240  // EOF: MOD - Country-State Selector

 241    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_AFFILIATE_DETAILS, '', 'SSL'));
 242    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_AFFILIATE_DETAILS, '', 'SSL'));
 243  
 244    $content = affiliate_details;
 245    include (bts_select('main', $content_template)); // BTSv1.5

 246    require (DIR_WS_INCLUDES . 'application_bottom.php');
 247  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7