1<?php 2include('includes/DefineCartItemClass.php'); //must be before header.php 3include('includes/config.php'); 4include('includes/session.php'); 5include($PathPrefix .'includes/CountriesArray.php'); 6include($PathPrefix .'includes/LanguagesArray.php'); 7 8 9 10if (mb_strlen($_SESSION['ItemDescriptionLanguages'])>0){ 11 $LanguagesAvailable = explode(',',$_SESSION['ItemDescriptionLanguages']); 12 $LanguagesAvailable[] = $_SESSION['CustomerDetails']['language_id']; 13 unset($LanguagesAvailable[array_search('',$LanguagesAvailable)]); 14} else { 15 $LanguagesAvailable =array(); 16 $LanguagesAvailable[] = $_SESSION['CustomerDetails']['language_id']; 17} 18 19$Title = _('Account Details'); 20 21if (isset($_POST['DeliveryAsPerBilling'])){ 22 $_POST['DeliveryAddress1']=$_POST['Address1']; 23 $_POST['DeliveryAddress2']=$_POST['Address2']; 24 $_POST['DeliveryAddress3']=$_POST['Address3']; 25 $_POST['DeliveryAddress4']=$_POST['Address4']; 26 $_POST['DeliveryAddress5']=$_POST['Address5']; 27 $_POST['DeliveryAddress6']=$_POST['Address6']; 28} 29 30if (isset($_POST['Register'])){ 31 //Validation 32 $InputError=0; // always hope/assume the best 33 $i=0; //error counter 34 $CheckEmailResult = DB_query("SELECT email FROM www_users WHERE email='" . $_POST['UserEmail'] ."' AND customerid<>''"); 35 if (DB_num_rows($CheckEmailResult)>0 AND (!isset($_SESSION['LoggedIn']) OR $_SESSION['LoggedIn']==false)){ 36 $InputError = 1; 37 message_log( _('You have already registered this email address on the system please login to use your existing account'),'error'); 38 $Errors[$i] = 'UserEmail'; 39 $i++; 40 //include('includes/Login.php'); 41 header('Location: http://' . $_SERVER['HTTP_HOST'] . $RootPath . '/index.php'); 42 } elseif (mb_strlen($_POST['UserEmail']) < 5 OR !IsEmailAddress($_POST['UserEmail'])) { 43 $InputError = 1; 44 message_log( _('The email address does not appear to be in a valid email address format'),'error'); 45 $Errors[$i] = 'UserEmail'; 46 $i++; 47 } elseif (mb_strlen($_POST['Password']) < 5) { 48 $InputError = 1; 49 message_log( _('The password must contain at least five characters'),'error'); 50 $Errors[$i] = 'Password'; 51 $i++; 52 } elseif ($_POST['Password']!= $_POST['ConfirmPassword']) { 53 $InputError = 1; 54 message_log( _('The password and the confirmation do not match'),'error'); 55 $Errors[$i] = 'Password'; 56 $i++; 57 $Errors[$i] = 'ConfirmPassword'; 58 $i++; 59 } elseif (mb_strlen($_POST['ContactName']) < 3) { 60 $InputError = 1; 61 message_log( _('The contact name must be entered'),'error'); 62 $Errors[$i] = 'ContactName'; 63 $i++; 64 } elseif (mb_strlen($_POST['Address1']) <2) { 65 $InputError = 1; 66 message_log( _('The building/street address entered is too short to be valid. At least 2 characters are required'),'error'); 67 $Errors[$i] = 'Address1'; 68 $i++; 69 } elseif (mb_strlen($_POST['Address2']) <4) { 70 $InputError = 1; 71 message_log( _('The street address entered is too short to be valid'),'error'); 72 $Errors[$i] = 'Address1'; 73 $i++; 74 } elseif (mb_strlen($_POST['Address4']) <4) { 75 $InputError = 1; 76 message_log( _('The city entered is too short to be valid'),'error'); 77 $Errors[$i] = 'Address4'; 78 $i++; 79 } elseif (mb_strlen($_POST['Phone']) <5) { 80 $InputError = 1; 81 message_log( _('The phone number for the billing address is too short to be valid'),'error'); 82 $Errors[$i] = 'Phone'; 83 $i++; 84 } elseif (mb_strlen($_POST['DeliveryAddress1']) <3) { 85 $InputError = 1; 86 message_log( _('The delivery street address is too short to be valid'),'error'); 87 $Errors[$i] = 'DeliveryAddress1'; 88 $i++; 89 } elseif (mb_strlen($_POST['DeliveryAddress4']) <3) { 90 $InputError = 1; 91 message_log( _('The delivery city address is too short to be valid'),'error'); 92 $Errors[$i] = 'DeliveryAddress4'; 93 $i++; 94 } 95 96 if ($InputError==0){ //no errors identified 97 if (mb_strlen($_POST['CompanyName']) <3) { 98 $CustomerName = $_POST['ContactName']; 99 } else { 100 $CustomerName = $_POST['CompanyName']; 101 } 102 if (!isset($_SESSION['LoggedIn']) OR $_SESSION['LoggedIn']==false){ //customer is not logged in so setting up a new customer 103 do { 104 $CustomerCode = CreateWebCustomerCode(GetNextSequenceNo(500)); 105 $CheckDoesntExistResult = DB_query("SELECT count(*) FROM debtorsmaster WHERE debtorno='" . $CustomerCode . "'"); 106 $CheckDoesntExistRow = DB_fetch_row($CheckDoesntExistResult); 107 } while ($CheckDoesntExistRow[0]==1); 108 109 $SQL = "INSERT INTO debtorsmaster (debtorno, 110 name, 111 address1, 112 address2, 113 address3, 114 address4, 115 address5, 116 address6, 117 currcode, 118 clientsince, 119 holdreason, 120 paymentterms, 121 salestype, 122 typeid, 123 creditlimit, 124 language_id, 125 taxref) 126 VALUES ('" . $CustomerCode ."', 127 '" . $CustomerName ."', 128 '" . $_POST['Address1'] ."', 129 '" . $_POST['Address2'] ."', 130 '" . $_POST['Address3'] . "', 131 '" . $_POST['Address4'] . "', 132 '" . $_POST['Address5'] . "', 133 '" . $_POST['Address6'] . "', 134 '" . $_SESSION['CustomerDetails']['currcode'] . "', 135 '" . Date('Y-m-d H-i-s') . "', 136 '" . $_SESSION['CustomerDetails']['holdreason'] . "', 137 '" . $_SESSION['CustomerDetails']['paymentterms'] . "', 138 '" . $_SESSION['CustomerDetails']['salestype'] . "', 139 '" . $_SESSION['CustomerDetails']['typeid'] . "', 140 '" . $_SESSION['CustomerDetails']['creditlimit'] . "', 141 '" . $_POST['Language'] . "', 142 '" . $_POST['TaxRef'] . "')"; 143 144 $ErrMsg = _('This customer could not be added because'); 145 $result = DB_query($SQL,$ErrMsg); 146 //Now add the customer branch record 147 $SQL = "INSERT INTO custbranch (branchcode, 148 debtorno, 149 brname, 150 braddress1, 151 braddress2, 152 braddress3, 153 braddress4, 154 braddress5, 155 braddress6, 156 brpostaddr1, 157 brpostaddr2, 158 brpostaddr3, 159 brpostaddr4, 160 brpostaddr5, 161 brpostaddr6, 162 salesman, 163 phoneno, 164 contactname, 165 area, 166 email, 167 taxgroupid, 168 defaultlocation, 169 defaultshipvia) 170 VALUES ('" . $CustomerCode . "', 171 '" . $CustomerCode . "', 172 '" . $CustomerName . "', 173 '" . $_POST['DeliveryAddress1'] . "', 174 '" . $_POST['DeliveryAddress2'] . "', 175 '" . $_POST['DeliveryAddress3'] . "', 176 '" . $_POST['DeliveryAddress4'] . "', 177 '" . $_POST['DeliveryAddress5'] . "', 178 '" . $_POST['DeliveryAddress6'] . "', 179 '" . $_POST['DeliveryAddress1'] . "', 180 '" . $_POST['DeliveryAddress2'] . "', 181 '" . $_POST['DeliveryAddress3'] . "', 182 '" . $_POST['DeliveryAddress4'] . "', 183 '" . $_POST['DeliveryAddress5'] . "', 184 '" . $_POST['DeliveryAddress6'] . "', 185 '" . $_SESSION['CustomerDetails']['salesman'] . "', 186 '" . $_POST['Phone'] . "', 187 '" . $_POST['ContactName'] . "', 188 '" . $_SESSION['CustomerDetails']['area'] . "', 189 '" . $_POST['UserEmail'] . "', 190 '" . $_SESSION['CustomerDetails']['taxgroupid'] . "', 191 '" . $_SESSION['CustomerDetails']['defaultlocation'] . "', 192 '" . $_SESSION['CustomerDetails']['defaultshipvia'] . "' )"; 193 $ErrMsg = _('This customer branch could not be added because'); 194 $result = DB_query($SQL,$ErrMsg); 195 196 $SQL = "INSERT INTO www_users (userid, 197 realname, 198 customerid, 199 branchcode, 200 password, 201 phone, 202 email, 203 pagesize, 204 fullaccess, 205 defaultlocation, 206 modulesallowed, 207 displayrecordsmax, 208 theme, 209 language) 210 VALUES ('" . $CustomerCode . "', 211 '" . $_POST['ContactName'] ."', 212 '" . $CustomerCode ."', 213 '" . $CustomerCode ."', 214 '" . password_hash($_POST['Password'],PASSWORD_DEFAULT) ."', 215 '" . $_POST['Phone'] . "', 216 '" . $_POST['UserEmail'] ."', 217 'A4', 218 '7', 219 '" . $_SESSION['CustomerDetails']['defaultlocation'] ."', 220 '1,0,0,0,0,0,0,0,0,0,0', 221 '30', 222 '" . $_SESSION['DefaultTheme'] ."', 223 '" . $_POST['Language'] ."')"; 224 225 $ErrMsg = _('The user could not be added because'); 226 $DbgMsg = _('The SQL that was used to insert the new user and failed was'); 227 $result = DB_query($SQL,$ErrMsg,$DbgMsg); 228 message_log( _('Successfully registered'),'success'); 229 230 $MailTo = $_POST['UserEmail'] . ', ' . $_SESSION['ShopManagerEmail']; 231 232 $headers = 'From: ' . $_SESSION['ShopName'] . " <" . strip_tags($_SESSION['ShopManagerEmail']) . ">\r\n"; 233 $headers .= "Reply-To: " . $_SESSION['ShopName'] . " <". strip_tags($_SESSION['ShopManagerEmail']) . ">\r\n"; 234 $headers .= "MIME-Version: 1.0\r\n"; 235 $headers .= "Content-Type: text/html; charset=utf-8\r\n"; 236 237 $MailSubject = $_SESSION['ShopName'] . ' ' . _('Confirmation of Registration'); 238 239 $MailMessage = ' 240 <html> 241 <head> 242 <title>' . $MailSubject . '</title> 243 </head> 244 <body> 245 <br /> 246 <h2>' . $MailSubject . '</h2> 247 <p>' . _('Thanks for registering as a') . ' ' . $_SESSION['ShopName'] . ' ' . _('customer') . '.</p> 248 <br /> 249 <p>' . _('The details that we have on record for you are as follows') . ':</p> 250 <table> 251 <tr> 252 <td> <b>' . _('Login Email') . ':</b></td> 253 <td>' . DB_escape_string($_POST['UserEmail']) . '</td> 254 </tr> 255 <tr> 256 <td> <b>' . _('Primary Contact') . ':</b></td> 257 <td>' . DB_escape_string($_POST['ContactName']) . '</td> 258 </tr> 259 <tr> 260 <td> <b>' . _('Phone') . ':</b></td> 261 <td>' . DB_escape_string($_POST['Phone']) . '</td> 262 </tr> 263 <tr> 264 <td> <b>' . _('Delivery Building') . ':</b></td> 265 <td>' . DB_escape_string($_POST['DeliveryAddress1']) . '</td> 266 </tr> 267 <tr> 268 <td> <b>' . _('Delivery Street') . ':</b></td> 269 <td>' . DB_escape_string($_POST['DeliveryAddress2']) . '</td> 270 </tr> 271 <tr> 272 <td> <b>' . _('Delivery Suburb') . ':</b></td> 273 <td>' . DB_escape_string($_POST['DeliveryAddress3']) . '</td> 274 </tr> 275 <tr> 276 <td> <b>' . _('Delivery City') . ':</b></td> 277 <td>' . DB_escape_string($_POST['DeliveryAddress4']) . '</td> 278 </tr> 279 <tr> 280 <td> <b>' . _('Delivery ZIP') . ':</b></td> 281 <td>' . DB_escape_string($_POST['DeliveryAddress5']) . '</td> 282 </tr> 283 <tr> 284 <td> <b>' . _('Delivery Country') . ':</b></td> 285 <td>' . DB_escape_string($_POST['DeliveryAddress6']) . '</td> 286 </tr> 287 <tr> 288 <td> <b>' . _('Postal Address 1 ') . ':</b></td> 289 <td>' . DB_escape_string($_POST['Address1']) . '</td> 290 </tr> 291 <tr> 292 <td> <b>' . _('Postal Address 2 ') . ':</b></td> 293 <td>' . DB_escape_string($_POST['Address2']) . '</td> 294 </tr> 295 <tr> 296 <td> <b>' . _('Postal Address 3 ') . ':</b></td> 297 <td>' . DB_escape_string($_POST['Address3']) . '</td> 298 </tr> 299 <tr> 300 <td> <b>' . _('Postal Address 4 ') . ':</b></td> 301 <td>' . DB_escape_string($_POST['Address4']) . '</td> 302 </tr> 303 <tr> 304 <td> <b>' . _('Postal Address 5 ') . ':</b></td> 305 <td>' . DB_escape_string($_POST['Address5']) . '</td> 306 </tr> 307 <tr> 308 <td> <b>' . _('Postal Address Country') . ':</b></td> 309 <td>' . DB_escape_string($_POST['Address6']) . '</td> 310 </tr> 311 </table> 312 <br/> 313 <br/> 314 <p>' . _('We look forward to doing business with you') . ' 315 </p> 316 <br/> 317 <p><i>' . $_SESSION['ShopName'] . '</i></p> 318 <p><a href="' . 'http://' . $_SERVER['HTTP_HOST'] . $RootPath . '">' . _('Click to go to') . ' ' . $_SESSION['ShopName'] . '</a></p> 319 </body> 320 </html>'; 321 322 $result = mail( $MailTo, $MailSubject, $MailMessage, $headers ); 323 324 } //end of adding new customer 325 else { //modifying an existing customer 326 327 $SQL = "UPDATE debtorsmaster SET name = '" . $CustomerName ."', 328 address1='" . $_POST['Address1'] ."', 329 address2='" . $_POST['Address2'] ."', 330 address3='" . $_POST['Address3'] . "', 331 address4='" . $_POST['Address4'] . "', 332 address5='" . $_POST['Address5'] . "', 333 address6='" . $_POST['Address6'] . "', 334 currcode='" . $_POST['CurrCode'] . "', 335 language_id='" . $_POST['Language'] . "', 336 taxref='" . $_POST['TaxRef'] . "' 337 WHERE debtorno='" . $_SESSION['ShopDebtorNo'] ."'"; 338 339 340 $ErrMsg = _('This customer could not be updated because'); 341 $result = DB_query($SQL,$ErrMsg); 342 //Now add the customer branch record 343 $SQL = "UPDATE custbranch SET brname = '" . $CustomerName ."', 344 braddress1='" . $_POST['DeliveryAddress1'] . "', 345 braddress2='" . $_POST['DeliveryAddress2'] . "', 346 braddress3='" . $_POST['DeliveryAddress3'] . "', 347 braddress4='" . $_POST['DeliveryAddress4'] . "', 348 braddress5='" . $_POST['DeliveryAddress5'] . "', 349 braddress6='" . $_POST['DeliveryAddress6'] . "', 350 brpostaddr1='" . $_POST['DeliveryAddress1'] . "', 351 brpostaddr2='" . $_POST['DeliveryAddress2'] . "', 352 brpostaddr3='" . $_POST['DeliveryAddress3'] . "', 353 brpostaddr4='" . $_POST['DeliveryAddress4'] . "', 354 brpostaddr5='" . $_POST['DeliveryAddress5'] . "', 355 brpostaddr6='" . $_POST['DeliveryAddress6'] . "', 356 phoneno ='" . $_POST['Phone'] . "', 357 contactname='" . $_POST['ContactName'] . "', 358 email ='" . $_POST['UserEmail'] ."' 359 WHERE debtorno='" . $_SESSION['ShopDebtorNo'] ."' 360 AND branchcode='" . $_SESSION['ShopBranchCode'] . "'"; 361 362 $ErrMsg = _('This customer branch could not be updated because'); 363 $result = DB_query($SQL,$ErrMsg); 364 365 $SQL = "UPDATE www_users SET realname = '" . $_POST['ContactName'] . "', 366 password = '" . password_hash($_POST['Password'],PASSWORD_DEFAULT) . "', 367 phone ='" . $_POST['Phone'] . "', 368 email='" . $_POST['UserEmail'] . "', 369 language='" . $_POST['Language'] . "' 370 WHERE email='" . $_SESSION['UsersEmail'] . "' 371 AND customerid='" . $_SESSION['ShopDebtorNo'] . "' 372 AND branchcode='" . $_SESSION['ShopBranchCode'] . "'"; 373 374 $ErrMsg = _('The user could not be updated because'); 375 $DbgMsg = _('The SQL that was used to update the user and failed was'); 376 $result = DB_query($SQL,$ErrMsg,$DbgMsg); 377 message_log( _('Successfully updated your details'),'success'); 378 } 379 380 include('includes/Login.php'); 381 if (count($_SESSION['ShoppingCart'])>0) { //then head directly to checkout 382 header('Location: http://' . $_SERVER['HTTP_HOST'] . $RootPath . '/Checkout.php'); 383 } else { //go back to browsing 384 header('Location: http://' . $_SERVER['HTTP_HOST'] . $RootPath . '/index.php'); 385 } 386 exit(); 387 } // end if there were no input errors 388} //end if registering new customer details 389 390include('includes/header.php'); 391 392?> 393<script> 394 jQuery(document).ready(function() { 395 /* Focus on user name input field*/ 396 jQuery('#RegistrationForm').validate({ 397 rules: { 398 UserEmail: { 399 email:true, 400 minlength: 7 401 }, 402 Password: { 403 minlength: 5 404 }, 405 ConfirmPassword: { 406 equalTo: '#Password', 407 minlength: 5 408 }, 409 ContactName: { 410 minlength: 3 411 }, 412 Address1: { 413 minlength: 2 414 }, 415 Address2: { 416 minlength: 4 417 }, 418 Address4: { 419 minlength: 4 420 }, 421 Address5: { 422 minlength: 3 423 }, 424 Phone: { 425 minlength: 6 426 }, 427 DeliveryAddress1: { 428 minlength: 4 429 }, 430 DeliveryAddress5: { 431 minlength: 3 432 } 433 }, //end rules 434 messages : { 435 UserEmail: { 436 required: "<?php echo _('An email address is required') ?>", 437 email: "<?php echo _('The email address must be a valid email address') ?>", 438 minlength: "<?php echo _('The email address is expected to 5 characters or more long') ?>" 439 }, 440 Password: { 441 required: "<?php echo _('A password is required') ?>", 442 minlength: "<?php echo _('The password is expected to 5 characters or more long') ?>" 443 }, 444 ConfirmPassword: { 445 required: "<?php echo _('The confirmation password must be entered') ?>", 446 equalTo: "<?php echo _('The confrimation password and the password fields must be identical') ?>", 447 minlength: "<?php echo _('The confirmation password is expected to 5 characters or more long') ?>" 448 }, 449 ContactName: { 450 required: "<?php echo _('The contact name must be entered') ?>", 451 minlength: "<?php echo _('The contact name is expected to 3 characters or more long') ?>" 452 }, 453 Address1: { 454 required: "<?php echo _('The billing building address or number must be entered') ?>", 455 minlength: "<?php echo _('The billing building address or number is expected to 2 characters or more long') ?>" 456 }, 457 Address2: { 458 required: "<?php echo _('The billing street address must be entered') ?>", 459 minlength: "<?php echo _('The billing street address is expected to 4 characters or more long') ?>" 460 }, 461 Address4: { 462 required: "<?php echo _('The billing address city must be entered') ?>", 463 minlength: "<?php echo _('The billing address city is expected to 4 characters or more long') ?>" 464 }, 465 Address5: { 466 required: "<?php echo _('The billing address zip code must be entered') ?>", 467 minlength: "<?php echo _('The billing address zip code is expected to 3 characters or more long') ?>" 468 }, 469 Phone: { 470 required: "<?php echo _('The phone number must be entered') ?>", 471 minlength: "<?php echo _('The phone must be at least 5 digits long') ?>", 472 digits: "<?php echo _('The phone number can only contain digits') ?>", 473 }, 474 DeliveryAddress1: { 475 required: "<?php echo _('The delivery street address must be entered') ?>", 476 minlength: "<?php echo _('The delivery street address is expected to 4 characters or more long') ?>" 477 }, 478 DeliveryAddress4: { 479 required: "<?php echo _('The delivery city must be entered') ?>", 480 minlength: "<?php echo _('The delivery city is expected to 3 characters or more long') ?>" 481 }, 482 DeliveryAddress5: { 483 required: "<?php echo _('The delivery zip code must be entered') ?>", 484 minlength: "<?php echo _('The delivery zip code is expected to 3 characters or more long') ?>" 485 } 486 }, //end messages 487 errorPlacement: function(error, element) { 488 error.insertAfter(element); 489 error.wrap('<p>'); 490 } // end errorPlacement 491 }); //end validation 492 493 jQuery('#TermsAndConditions').click(function() { 494 jQuery('#content_block').html('<?php echo '<h1>' . _('Terms and Conditions') . '</h1>' . html_entity_decode($_SESSION['ShopTermsConditions']) ?>'); 495 return false; 496 }); 497 jQuery('#AboutUs').click(function(){ 498 jQuery('#content_block').html('<?php echo '<h1>' . _('About Us') . '</h1>' . html_entity_decode($_SESSION['ShopAboutUs']) ?>'); 499 return false; 500 }); 501 jQuery('#PrivacyPolicy').click(function(){ 502 jQuery('#content_block').html('<?php echo '<h1>' . _('Privacy Policy') . '</h1>' . html_entity_decode($_SESSION['ShopPrivacyStatement']) ?>'); 503 return false; 504 }); 505 jQuery('#ContactUs').click(function(){ 506 jQuery('#content_block').html('<?php echo '<h1>' . _('Contact Details') . '</h1>' . html_entity_decode($_SESSION['ShopContactUs']) ?>'); 507 return false; 508 }); 509 jQuery('#FreightPolicy').click(function(){ 510 jQuery('#content_block').html('<?php echo '<h1>' . _('Freight Policy') . '</h1>' . html_entity_decode($_SESSION['ShopFreightPolicy']) ?>'); 511 return false; 512 }); 513 jQuery('#cart_summary').click(function(){ 514 jQuery('#content_block').load('index.php?Page=ShoppingCart' + ' #content_block'); 515 return false; 516 }); 517 jQuery('#DeliveryAsPerBilling').click(function(){ 518 jQuery('#DeliveryAddress1').val(jQuery('#Address1').val()); 519 jQuery('#DeliveryAddress2').val(jQuery('#Address2').val()); 520 jQuery('#DeliveryAddress3').val(jQuery('#Address3').val()); 521 jQuery('#DeliveryAddress4').val(jQuery('#Address4').val()); 522 jQuery('#DeliveryAddress5').val(jQuery('#Address5').val()); 523 jQuery('#DeliveryAddress6').val(jQuery('#Address6').val()); 524 return false; 525 }); 526 jQuery('#Phone').bind('input', function() { 527 jQuery(this).val($(this).val().replace(/[^+()\-\s0-9]/gi, '')); 528 }); 529 jQuery('#Currency').change(function(){ 530 var QueryString = 'FormID=' + jQuery('#SearchForm :hidden').val() + '&CurrCode=' + jQuery('#Currency').val(); 531 jQuery.post('index.php',QueryString,function(data) { 532 var content_block = jQuery(data).filter( '#content_block' ); 533 var cart_summary = jQuery(data).filter( '#cart_summary' ); 534 jQuery('#content_block').html(content_block.html()); 535 jQuery('#cart_summary').html(cart_summary.html()); 536 }); 537 }); 538 }); 539</script> 540 541<?php 542 543ShowSalesCategoriesMenu(); 544 545include('includes/InfoLinks.php'); 546 547echo'<div class="column_main">'; 548if (!isset($_SESSION['LoggedIn']) OR $_SESSION['LoggedIn']==false){ //customer is not logged in so setting up a new customer 549 echo '<h1>' . _('Register') . '</h1>'; 550} else { //updating an existing customer 551 echo '<h1>' . _('Update Your Account Details') . '</h1>'; 552} 553echo'<div id="register"> 554 <form id="RegistrationForm" method="post" action="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '"> 555 <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; 556 557if (isset($_SESSION['LoggedIn']) AND $_SESSION['LoggedIn']==true){ // need to get the user details for modification 558 $_POST['UserEmail'] = $_SESSION['UsersEmail'] ; 559 $_POST['ContactName'] = $_SESSION['UsersRealName']; 560 $_POST['CompanyName'] = $_SESSION['CustomerDetails']['name']; 561 $_POST['Address1'] = $_SESSION['CustomerDetails']['address1']; 562 $_POST['Address2'] = $_SESSION['CustomerDetails']['address2']; 563 $_POST['Address3'] = $_SESSION['CustomerDetails']['address3']; 564 $_POST['Address4'] = $_SESSION['CustomerDetails']['address4']; 565 $_POST['Address5'] = $_SESSION['CustomerDetails']['address5']; 566 $_POST['Address6'] = $_SESSION['CustomerDetails']['address6']; 567 $_POST['Phone'] = $_SESSION['CustomerDetails']['phoneno']; 568 $_POST['DeliveryAddress1'] = $_SESSION['CustomerDetails']['braddress1']; 569 $_POST['DeliveryAddress2'] = $_SESSION['CustomerDetails']['braddress2']; 570 $_POST['DeliveryAddress3'] = $_SESSION['CustomerDetails']['braddress3']; 571 $_POST['DeliveryAddress4'] = $_SESSION['CustomerDetails']['braddress4']; 572 $_POST['DeliveryAddress5'] = $_SESSION['CustomerDetails']['braddress5']; 573 $_POST['DeliveryAddress6'] = $_SESSION['CustomerDetails']['braddress6']; 574 $_POST['Language'] = $_SESSION['CustomerDetails']['language_id']; 575 $_POST['CurrCode'] = $_SESSION['CustomerDetails']['currcode']; 576 $_POST['TaxRef'] = $_SESSION['CustomerDetails']['taxref']; 577 $_POST['ConfirmPassword'] = ''; 578 $_POST['Password'] = ''; 579} else { 580 if (!isset($_POST['UserEmail'])){ //user is not logged in so default all entries to blanks 581 $_POST['Password'] = ''; 582 $_POST['ConfirmPassword'] = ''; 583 $_POST['UserEmail'] = ''; 584 $_POST['ContactName'] = ''; 585 $_POST['CompanyName'] = ''; 586 $_POST['Address1'] = ''; 587 $_POST['Address2'] = ''; 588 $_POST['Address3'] = ''; 589 $_POST['Address4'] = ''; 590 $_POST['Address5'] = ''; 591 $_POST['Address6'] = $CountriesArray[$_SESSION['CountryOfOperation']]; 592 $_POST['Phone'] = ''; 593 $_POST['DeliveryAddress1'] = ''; 594 $_POST['DeliveryAddress2'] = ''; 595 $_POST['DeliveryAddress3'] = ''; 596 $_POST['DeliveryAddress4'] = ''; 597 $_POST['DeliveryAddress5'] = ''; 598 $_POST['DeliveryAddress6'] = $CountriesArray[$_SESSION['CountryOfOperation']];; 599 $_POST['Language'] = $_SESSION['CustomerDetails']['language_id']; 600 $_POST['CurrCode'] = $_SESSION['CustomerDetails']['currcode']; 601 $_POST['TaxRef'] = ''; 602 } 603} 604//display_messages(); 605 606echo '<div class="row"> 607<div class="row-left">' . _('Email') . ':</div> 608 <div class="row-right"><input tabindex="1" type="email" required="required" autofocus="autofocus" class="required ' . (in_array('UserEmail',$Errors) ? 'error' : '' ) . '" name="UserEmail" size="30" maxlength="30" value="' . $_POST['UserEmail'] . '" /></div> 609</div> 610 611<div class="row"> 612 <div class="row-left">' . _('Password') . ':</div> 613 <div class="row-right"><input tabindex="2" id="Password" type="password" required class="required ' . (in_array('Password',$Errors) ? 'error' : '' ) . '" name="Password" size="15" maxlength="15" value="' . $_POST['Password'] . '" /></div> 614</div> 615 616<div class="row"> 617 <div class="row-left">' . _('Confirm Password') . ':</div> 618 <div class="row-right"><input tabindex="3" type="password" required class="required ' . (in_array('ConfirmPassword',$Errors) ? 'error' : '' ) . '" name="ConfirmPassword" size="15" maxlength="15" value="' . $_POST['ConfirmPassword'] . '"/></div> 619</div> 620 621<div class="row"> 622 <div class="row-left">' . _('Contact Name') . ':</div> 623 <div class="row-right"><input tabindex="4" type="text" required class="required ' . (in_array('ContactName',$Errors) ? 'error' : '' ) . '" name="ContactName" size="30" maxlength="30" value="' . $_POST['ContactName'] . '" /></div> 624</div> 625 626<div class="row"> 627 <div class="row-left">' . _('Company Name') . ':</div> 628 <div class="row-right"><input tabindex="5" type="text" ' . (in_array('CompanyName',$Errors) ? 'class="error"' : '' ) . ' name="CompanyName" size="30" maxlength="30" value="' . $_POST['CompanyName'] . '" /></div> 629</div> 630 631<div class="row"> 632 <div class="row-left">' . _('Billing Address - Number/Street') . ':</div> 633 <div class="row-right"><input tabindex="6" id="Address1" type="text" required class="required ' . (in_array('Address1',$Errors) ? 'error' : '' ) . '" name="Address1" size="30" maxlength="30" value="' . $_POST['Address1'] . '" /></div> 634</div> 635 636<div class="row"> 637 <div class="row-left">' . _('Billing Address - Street') . ':</div> 638 <div class="row-right"><input tabindex="7" type="text" id="Address2" name="Address2" required class="required ' . (in_array('Address2',$Errors) ? 'error' : '' ) . '" size="30" maxlength="30" value="' . $_POST['Address2'] . '" /></div> 639</div> 640 641<div class="row"> 642 <div class="row-left">' . _('Billing Address - Suburb') . ':</div> 643 <div class="row-right"><input tabindex="8" id="Address3" type="text" ' . (in_array('Address3',$Errors) ? 'class="error"' : '' ) . ' name="Address3" size="20" maxlength="20" value="' . $_POST['Address3'] . '" /></div> 644</div> 645 646<div class="row"> 647 <div class="row-left">' . _('Billing Address - City') . ':</div> 648 <div class="row-right"><input tabindex="9" id="Address4" type="text" class="required' . (in_array('Address4',$Errors) ? ' error' : '' ) . '" name="Address4" size="20" maxlength="20" value="' . $_POST['Address4'] . '" /></div> 649</div> 650 651<div class="row"> 652 <div class="row-left">' . _('Billing Address - ZIP') . ':</div> 653 <div class="row-right"><input tabindex="10" id="Address5" type="text" class="required' . (in_array('Address5',$Errors) ? ' error' : '' ) . '" name="Address5" size="10" maxlength="10" value="' . $_POST['Address5'] . '" /></div> 654</div> 655 656<div class="row"> 657 <div class="row-left">' . _('VAT No.') . ':</div> 658 <div class="row-right"><input tabindex="11" id="TaxRef" type="text" name="TaxRef" size="16" maxlength="16" value="' . $_POST['TaxRef'] . '" /></div> 659</div> 660 661 662<div class="row"> 663 <div class="row-left">' . _('Country') . ':</div> 664 <div><select tabindex="12" id="Address6" name="Address6" ' . (in_array('Address6',$Errors) ? 'class="error"' : '' ) . ' >'; 665 666foreach ($CountriesArray as $CountryName){ 667 if (isset($_POST['Address6']) AND (strtoupper($_POST['Address6']) == strtoupper($CountryName))){ 668 echo '<option selected="selected" value="' . $CountryName . '">' . $CountryName .'</option>'; 669 } else { 670 echo '<option value="' . $CountryName . '">' . $CountryName .'</option>'; 671 } 672} 673echo '</select></div> 674</div> 675 676<div class="row"> 677 <input id="DeliveryAsPerBilling" tabindex="13" class="button" type="submit" title="' . _('Click this button to make the delivery details the same as the billing address') . '" name="DeliveryAsPerBilling" value="' . _('Delivery Address As Billing Address') . '" /> 678</div> 679<div class="row"> 680 <div class="row-left">' . _('Delivery Address - Number/Street') . ':</div> 681 <div class="row-right"><input tabindex="14" id="DeliveryAddress1" type="text" class="required' . (in_array('DeliveryAddress1',$Errors) ? ' error' : '' ) . '" name="DeliveryAddress1" size="30" maxlength="30" value="' . $_POST['DeliveryAddress1'] . '" /></div> 682</div> 683 684<div class="row"> 685 <div class="row-left">' . _('Delivery Address - Street') . ':</div> 686 <div class="row-right"><input tabindex="15" id="DeliveryAddress2" type="text" name="DeliveryAddress2" ' . (in_array('DeliveryAddress2',$Errors) ? 'class="error"' : '' ) . ' size="30" maxlength="30" value="' . $_POST['DeliveryAddress2'] . '" /></div> 687</div> 688 689<div class="row"> 690 <div class="row-left">' . _('Delivery Address - Suburb') . ':</div> 691 <div class="row-right"><input tabindex="16" id="DeliveryAddress3" type="text" ' . (in_array('Address3',$Errors) ? 'class="error"' : '' ) . ' name="DeliveryAddress3" size="20" maxlength="20" value="' . $_POST['DeliveryAddress3'] . '" /></div> 692</div> 693 694<div class="row"> 695 <div class="row-left">' . _('Delivery Address - City') . ':</div> 696 <div class="row-right"><input tabindex="17" id="DeliveryAddress4" type="text" name="DeliveryAddress4" class="required' . (in_array('DeliveryAddress4',$Errors) ? ' error' : '' ) . '" size="20" maxlength="20" value="' . $_POST['DeliveryAddress4'] . '" /></div> 697</div> 698 699<div class="row"> 700 <div class="row-left">' . _('Delivery Address - ZIP') . ':</div> 701 <div class="row-right"><input tabindex="18" id="DeliveryAddress5" type="text" name="DeliveryAddress5" class="required' . (in_array('DeliveryAddress5',$Errors) ? ' error' : '' ) . '" size="10" maxlength="10" value="' . $_POST['DeliveryAddress5'] . '" /></div> 702</div> 703 704<div class="row"> 705 <div class="row-left">' . _('Country') . ':</div> 706 <div class="row-right"><select tabindex="19" id="DeliveryAddress6" name="DeliveryAddress6" ' . (in_array('Address6',$Errors) ? 'class="error"' : '' ) . ' >'; 707 foreach ($CountriesArray as $CountryEntry => $CountryName){ 708 if (isset($_POST['DeliveryAddress6']) AND (strtoupper($_POST['DeliveryAddress6']) == strtoupper($CountryName))){ 709 echo '<option selected="selected" value="' . $CountryName . '">' . $CountryName .'</option>'; 710 } else { 711 echo '<option value="' . $CountryName . '">' . $CountryName .'</option>'; 712 } 713 } 714 echo '</select></div> 715</div> 716 717<div class="row"> 718 <div class="row-left">' . _('Billing Currency') . ':</div> 719 <div class="row-right"><select tabindex="20" ' . (in_array('CurrCode',$Errors) ? 'class="error"' : '' ) . ' name="CurrCode">'; 720 $CurrenciesResult = DB_query("SELECT currabrev FROM currencies WHERE webcart=1"); 721 while ($CurrRow = DB_fetch_array($CurrenciesResult)){ 722 echo '<option '; 723 if ($_SESSION['CustomerDetails']['currcode']==$CurrRow['currabrev']){ 724 echo 'selected="selected" '; 725 } 726 echo 'value="' . $CurrRow['currabrev'] . '">' . $CurrRow['currabrev'] . '</option>'; 727 } 728 729 echo '</select></div> 730</div> 731 732<input type="hidden" name="Language" value="en_GB.utf8" /> 733 734<div class="row"> 735 <div class="row-left">' . _('Phone') . ':</div> 736 <div class="row-right"><input tabindex="21" id="Phone" type="tel" pattern="[0-9+\-\s()]*" class="required ' . (in_array('Phone',$Errors) ? 'error' : '' ) . '" name="Phone" size="20" maxlength="20" value="' . $_POST['Phone'] . '" /></div> 737</div> 738 739<div class="row"> 740 <input tabindex="22" class="button" type="submit" name="Register" value="' . ((isset($_SESSION['LoggedIn']) AND $_SESSION['LoggedIn']==true)?_('Update Details'):_('Register')) . '" /> 741</div> 742</form><!-- End of RegistrationForm --> 743</div><!-- End of register <div> --> 744</div><!-- End of column main <div> -->'; 745 746echo '</div>'; //end content_inner 747echo '</div>'; //end content_block 748include ('includes/footer.php'); 749 750?> 751