[ Index ] |
PHP Cross Reference of osCMax 2.0.4 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 $Id: affiliate_signup.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 23 require ('includes/application_top.php'); 24 25 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_AFFILIATE_SIGNUP); 26 27 if (isset($HTTP_POST_VARS['action'])) { 28 $a_gender = tep_db_prepare_input($HTTP_POST_VARS['a_gender']); 29 $a_firstname = tep_db_prepare_input($HTTP_POST_VARS['a_firstname']); 30 $a_lastname = tep_db_prepare_input($HTTP_POST_VARS['a_lastname']); 31 $a_dob = tep_db_prepare_input($HTTP_POST_VARS['a_dob']); 32 $a_email_address = tep_db_prepare_input($HTTP_POST_VARS['a_email_address']); 33 $a_company = tep_db_prepare_input($HTTP_POST_VARS['a_company']); 34 $a_company_taxid = tep_db_prepare_input($HTTP_POST_VARS['a_company_taxid']); 35 $a_payment_check = tep_db_prepare_input($HTTP_POST_VARS['a_payment_check']); 36 $a_payment_paypal = tep_db_prepare_input($HTTP_POST_VARS['a_payment_paypal']); 37 $a_payment_bank_name = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_name']); 38 $a_payment_bank_branch_number = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_branch_number']); 39 $a_payment_bank_swift_code = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_swift_code']); 40 $a_payment_bank_account_name = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_account_name']); 41 $a_payment_bank_account_number = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_account_number']); 42 $a_street_address = tep_db_prepare_input($HTTP_POST_VARS['a_street_address']); 43 $a_suburb = tep_db_prepare_input($HTTP_POST_VARS['a_suburb']); 44 $a_postcode = tep_db_prepare_input($HTTP_POST_VARS['a_postcode']); 45 $a_city = tep_db_prepare_input($HTTP_POST_VARS['a_city']); 46 $a_country=tep_db_prepare_input($HTTP_POST_VARS['a_country']); 47 $a_zone_id = tep_db_prepare_input($HTTP_POST_VARS['a_zone_id']); 48 $a_state = tep_db_prepare_input($HTTP_POST_VARS['a_state']); 49 $a_telephone = tep_db_prepare_input($HTTP_POST_VARS['a_telephone']); 50 $a_fax = tep_db_prepare_input($HTTP_POST_VARS['a_fax']); 51 $a_homepage = tep_db_prepare_input($HTTP_POST_VARS['a_homepage']); 52 $a_password = tep_db_prepare_input($HTTP_POST_VARS['a_password']); 53 $a_newsletter = tep_db_prepare_input($HTTP_POST_VARS['a_newsletter']); 54 $a_confirmation = tep_db_prepare_input($HTTP_POST_VARS['a_confirmation']); 55 $a_agb = tep_db_prepare_input($HTTP_POST_VARS['a_agb']); 56 57 $error = false; // reset error flag 58 59 if (ACCOUNT_GENDER == 'true') { 60 if (($a_gender == 'm') || ($a_gender == 'f')) { 61 $entry_gender_error = false; 62 } else { 63 $error = true; 64 $entry_gender_error = true; 65 } 66 } 67 68 if (strlen($a_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { 69 $error = true; 70 $entry_firstname_error = true; 71 } else { 72 $entry_firstname_error = false; 73 } 74 75 if (strlen($a_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { 76 $error = true; 77 $entry_lastname_error = true; 78 } else { 79 $entry_lastname_error = false; 80 } 81 82 if (ACCOUNT_DOB == 'true') { 83 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))) { 84 $entry_date_of_birth_error = false; 85 } else { 86 $error = true; 87 $entry_date_of_birth_error = true; 88 } 89 } 90 91 if (strlen($a_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { 92 $error = true; 93 $entry_email_address_error = true; 94 } else { 95 $entry_email_address_error = false; 96 } 97 98 if (!tep_validate_email($a_email_address)) { 99 $error = true; 100 $entry_email_address_check_error = true; 101 } else { 102 $entry_email_address_check_error = false; 103 } 104 105 if (strlen($a_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { 106 $error = true; 107 $entry_street_address_error = true; 108 } else { 109 $entry_street_address_error = false; 110 } 111 112 if (strlen($a_postcode) < ENTRY_POSTCODE_MIN_LENGTH) { 113 $error = true; 114 $entry_post_code_error = true; 115 } else { 116 $entry_post_code_error = false; 117 } 118 119 if (strlen($a_city) < ENTRY_CITY_MIN_LENGTH) { 120 $error = true; 121 $entry_city_error = true; 122 } else { 123 $entry_city_error = false; 124 } 125 126 if (!$a_country) { 127 $error = true; 128 $entry_country_error = true; 129 } else { 130 $entry_country_error = false; 131 } 132 133 if (ACCOUNT_STATE == 'true') { 134 if ($entry_country_error) { 135 $entry_state_error = true; 136 } else { 137 $a_zone_id = 0; 138 $entry_state_error = false; 139 $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($a_country) . "'"); 140 $check_value = tep_db_fetch_array($check_query); 141 $entry_state_has_zones = ($check_value['total'] > 0); 142 if ($entry_state_has_zones) { 143 $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($a_country) . "' and zone_name = '" . tep_db_input($a_state) . "'"); 144 if (tep_db_num_rows($zone_query) == 1) { 145 $zone_values = tep_db_fetch_array($zone_query); 146 $a_zone_id = $zone_values['zone_id']; 147 } else { 148 $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($a_country) . "' and zone_code = '" . tep_db_input($a_state) . "'"); 149 if (tep_db_num_rows($zone_query) == 1) { 150 $zone_values = tep_db_fetch_array($zone_query); 151 $a_zone_id = $zone_values['zone_id']; 152 } else { 153 $error = true; 154 $entry_state_error = true; 155 } 156 } 157 } else { 158 if (!$a_state) { 159 $error = true; 160 $entry_state_error = true; 161 } 162 } 163 } 164 } 165 166 if (strlen($a_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) { 167 $error = true; 168 $entry_telephone_error = true; 169 } else { 170 $entry_telephone_error = false; 171 } 172 173 $passlen = strlen($a_password); 174 if ($passlen < ENTRY_PASSWORD_MIN_LENGTH) { 175 $error = true; 176 $entry_password_error = true; 177 } else { 178 $entry_password_error = false; 179 } 180 181 if ($a_password != $a_confirmation) { 182 $error = true; 183 $entry_password_error = true; 184 } 185 186 $check_email = tep_db_query("select affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_email_address = '" . tep_db_input($a_email_address) . "'"); 187 if (tep_db_num_rows($check_email)) { 188 $error = true; 189 $entry_email_address_exists = true; 190 } else { 191 $entry_email_address_exists = false; 192 } 193 194 // Check Suburb 195 $entry_suburb_error = false; 196 197 // Check Fax 198 $entry_fax_error = false; 199 200 if (!affiliate_check_url($a_homepage)) { 201 $error = true; 202 $entry_homepage_error = true; 203 } else { 204 $entry_homepage_error = false; 205 } 206 207 if (!$a_agb) { 208 $error=true; 209 $entry_agb_error=true; 210 } 211 212 // Check Company 213 $entry_company_error = false; 214 $entry_company_taxid_error = false; 215 // Check Newsletter 216 $entry_newsletter_error = false; 217 218 // Check Payment 219 $entry_payment_check_error = false; 220 $entry_payment_paypal_error = false; 221 $entry_payment_bank_name_error = false; 222 $entry_payment_bank_branch_number_error = false; 223 $entry_payment_bank_swift_code_error = false; 224 $entry_payment_bank_account_name_error = false; 225 $entry_payment_bank_account_number_error = false; 226 227 if (!$error) { 228 229 $sql_data_array = array('affiliate_firstname' => $a_firstname, 230 'affiliate_lastname' => $a_lastname, 231 'affiliate_email_address' => $a_email_address, 232 'affiliate_payment_check' => $a_payment_check, 233 'affiliate_payment_paypal' => $a_payment_paypal, 234 'affiliate_payment_bank_name' => $a_payment_bank_name, 235 'affiliate_payment_bank_branch_number' => $a_payment_bank_branch_number, 236 'affiliate_payment_bank_swift_code' => $a_payment_bank_swift_code, 237 'affiliate_payment_bank_account_name' => $a_payment_bank_account_name, 238 'affiliate_payment_bank_account_number' => $a_payment_bank_account_number, 239 'affiliate_street_address' => $a_street_address, 240 'affiliate_postcode' => $a_postcode, 241 'affiliate_city' => $a_city, 242 'affiliate_country_id' => $a_country, 243 'affiliate_telephone' => $a_telephone, 244 'affiliate_fax' => $a_fax, 245 'affiliate_homepage' => $a_homepage, 246 'affiliate_password' => tep_encrypt_password($a_password), 247 'affiliate_agb' => '1', 248 'affiliate_newsletter' => $a_newsletter); 249 250 if (ACCOUNT_GENDER == 'true') $sql_data_array['affiliate_gender'] = $a_gender; 251 if (ACCOUNT_DOB == 'true') $sql_data_array['affiliate_dob'] = tep_date_raw($a_dob); 252 if (ACCOUNT_COMPANY == 'true') { 253 $sql_data_array['affiliate_company'] = $a_company; 254 $sql_data_array['affiliate_company_taxid'] = $a_company_taxid; 255 } 256 if (ACCOUNT_SUBURB == 'true') $sql_data_array['affiliate_suburb'] = $a_suburb; 257 258 if (ACCOUNT_STATE == 'true') { 259 if ($a_zone_id > 0) { 260 $sql_data_array['affiliate_zone_id'] = $a_zone_id; 261 $sql_data_array['affiliate_state'] = ''; 262 } else { 263 $sql_data_array['affiliate_zone_id'] = '0'; 264 $sql_data_array['affiliate_state'] = $a_state; 265 } 266 } 267 268 $sql_data_array['affiliate_date_account_created'] = 'now()'; 269 270 $affiliate_id = affiliate_insert ($sql_data_array, $HTTP_SESSION_VARS['affiliate_ref'] ); 271 272 // build the message content 273 $name = $a_firstname . ' ' . $a_lastname; 274 $email_text = sprintf(MAIL_GREET_NONE, $a_firstname); 275 $email_text .= MAIL_AFFILIATE_HEADER; 276 $email_text .= sprintf(MAIL_AFFILIATE_ID, $affiliate_id); 277 $email_text .= sprintf(MAIL_AFFILIATE_USERNAME, $a_email_address); 278 $email_text .= sprintf(MAIL_AFFILIATE_PASSWORD, $a_password); 279 $email_text .= sprintf(MAIL_AFFILIATE_LINK, HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE) . "\n\n"; 280 $email_text .= MAIL_AFFILIATE_FOOTER; 281 282 tep_mail($name, $a_email_address, MAIL_AFFILIATE_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); 283 284 tep_session_register('affiliate_id'); 285 $affiliate_email = $a_email_address; 286 $affiliate_name = $a_firstname . ' ' . $a_lastname; 287 tep_session_register('affiliate_email'); 288 tep_session_register('affiliate_name'); 289 tep_redirect(tep_href_link(FILENAME_AFFILIATE_SIGNUP_OK, '', 'SSL')); 290 } 291 } 292 293 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_AFFILIATE_SIGNUP, '', 'SSL')); 294 295 $content = affiliate_signup; 296 297 include (bts_select('main', $content_template)); // BTSv1.5 298 299 require (DIR_WS_INCLUDES . 'application_bottom.php'); 300 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Jan 1 13:43:16 2010 | Cross-referenced by PHPXref 0.7 |