Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

strange create_account.php problem


Benjjj6

Recommended Posts

Hey,

 

When I fill in all the details on my create_account.php page and then click continue it comes back with an error telling me to

Please select a state from the States pull down menu.

 

The strange thing is before I clicked 'continue' the 'County/State:' box was a text box that I could write in, however now its a dropdwn list with only one option 'United Kingdom' :(

 

How can I put it back to normal where a customer would just type in their County/State and click continue, I really dont know why im having this error :(

 

Heres my create_account.php page im sorry its so long! :P :

 

<?php
/*
 $Id: create_account.php,v 1.65 2003/06/09 23:03:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

 $process = false;
 if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
$process = true;

if (ACCOUNT_GENDER == 'true') {
  if (isset($HTTP_POST_VARS['gender'])) {
	$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
  } else {
	$gender = false;
  }
}
$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
$city = tep_db_prepare_input($HTTP_POST_VARS['city']);
if (ACCOUNT_STATE == 'true') {
  $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
  if (isset($HTTP_POST_VARS['zone_id'])) {
	$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
  } else {
	$zone_id = false;
  }
}
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);
if (isset($HTTP_POST_VARS['newsletter'])) {
  $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
} else {
  $newsletter = false;
}
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);

// BOC Added for Account Agreement

$agreement = tep_db_prepare_input($HTTP_POST_VARS['agreement']);

// EOC Added for Account Agreement

$error = false;

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 (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
	$error = true;

	$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
  }
}

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
} elseif (tep_validate_email($email_address) == false) {
  $error = true;

  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
} else {
  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
  $check_email = tep_db_fetch_array($check_email_query);
  if ($check_email['total'] > 0) {
	$error = true;

	$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
  }
}

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
}

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
}

if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_CITY_ERROR);
}

if (is_numeric($country) == false) {
  $error = true;

  $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
}
if (ACCOUNT_STATE == 'true') {
  $zone_id = 0;
  $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
  $check = tep_db_fetch_array($check_query);
  $entry_state_has_zones = ($check['total'] > 0);
  if ($entry_state_has_zones == true) {
	$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
	if (tep_db_num_rows($zone_query) == 1) {
	  $zone = tep_db_fetch_array($zone_query);
	  $zone_id = $zone['zone_id'];
	} else {

	  $error = true;

	  $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
	}
  } else {
	if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_STATE_ERROR);
	}
  }
}

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
}


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);

}

// BOC Added for Account Agreement
if (ACCOUNT_AGREEMENT_REQUIRED == 'true') {
	if ($agreement == false) {
		$error = true;   

		$messageStack->add('create_account',ENTRY_AGREEMENT_ERROR);
	}
}
// EOC Added for Account Agreement

if ($error == false) {

 $sql_data_array = array('customers_firstname' => $firstname,

					 'customers_lastname' => $lastname,

					 'customers_email_address' => $email_address,

					 'customers_telephone' => $telephone,

					 'customers_fax' => $fax,

					 'customers_newsletter' => $newsletter,

					 'customers_agreement' => $agreement,

					 'customers_password' => tep_encrypt_password($password));


  if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
  if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

  $customer_id = tep_db_insert_id();

  $sql_data_array = array('customers_id' => $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;
	}
  }

  tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

  $address_id = tep_db_insert_id();

  tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

  tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');

// restore cart contents
  $cart->restore_contents();

// 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);
  }

  $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
  tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

  tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
}
 }

 $breadcrumb->add(NAvb script:void(0);" onclick="NewWindow('popup_conditions.php','tech','800','600','yes');return false"><u style="main"><?php echo CONDITIONS_AGREEMENT; ?></u></a><?php echo AGREEMENT_SEPARATOR; ?><a href="java script:void(0);" onclick="NewWindow('popup_privacy.php','tech','800','600','yes');return false"><u style="main"><?php echo PRIVACY_AGREEMENT; ?></u></a></td>

		  </tr>

		</table></td>

	  </tr>

	</table></td>

  </tr>

  <tr>

	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

  </tr>

<?php

}

?>

 <!-- EOC Added for Account Agreement -->  
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php include(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

thanks,

 

Ben :thumbsup:

Link to comment
Share on other sites

anyone there?.... no one can register on my website until i sort this out..

help please!

Bumping is against forum rules, and is totally annoying.

 

How did you make your page do that (ie what were you installing)?

Link to comment
Share on other sites

hey,

 

sorry for bumping, but this forum is so busy you cant help but feel everyone has missed your post :blush:

 

Im not sure how long this has actually been a problem, very recently I installed the contribution you can see at the bottom of the page making customers agree to my T&C although i'd be surprised if this had an effect on the county/state box.

 

So im not actually sure how it happened :-/ as apart from that the only other mod I have made to that page is changing it so that it is more UK friendly with a contribution I found. Which i think did include changing something about the county/state box, although I dont seem to be able to find that contribution now. Im sure it was called 'UK-friendly' but cant find it after searching :blink:

Link to comment
Share on other sites

hey,

 

sorry for bumping, but this forum is so busy you cant help but feel everyone has missed your post :blush:

 

Im not sure how long this has actually been a problem, very recently I installed the contribution you can see at the bottom of the page making customers agree to my T&C although i'd be surprised if this had an effect on the county/state box.

 

So im not actually sure how it happened :-/ as apart from that the only other mod I have made to that page is changing it so that it is more UK friendly with a contribution I found. Which i think did include changing something about the county/state box, although I dont seem to be able to find that contribution now. Im sure it was called 'UK-friendly' but cant find it after searching :blink:

 

You could take out Account Agreement and see if it fixes it.

 

UK-Based osCommerce 2.2 http://www.oscommerce.com/community/contri...search,uk+based

 

Since this is now an old contrib, its installation must be done with extra care.

Recheck the edits you made. There is also a suppoort thread for it,

http://www.oscommerce.com/forums/index.php?showtopic=130454

but it looks like the author is not there anymore.

 

Or was it country state selector contrib?

Link to comment
Share on other sites

I havent installed the country state selector contrib. I know alot of people want the country/state box to be a dropdown list, however I just want mine to be a text box. Before I go back and review any changes I may have made is it possible for you to look at the code I posted and tell me if it looks as if it is doing what I want? in other words, can you see any obvious errors that could be causing the county/state box to act funny?

 

thanks,

 

Ben

Link to comment
Share on other sites

I just replaced the files that were edited by the 'Account Agreement with Popup' contrib, these being create_account.php and includes/form_check.js.php with the files that I backed up before I installed the contrib. However, im still having the same problem, I get exactly the same error and it tells me to choose a state from the pull down menu :(

 

I guess this means its most likely due to the UK-Based Contribution, I'll check through that and compare it with my original create_account.php file before I installed that contribution and see what could be the problem.

 

do you have any other ideas/suggestions?

Link to comment
Share on other sites

I just replaced the files that were edited by the 'Account Agreement with Popup' contrib, these being create_account.php and includes/form_check.js.php with the files that I backed up before I installed the contrib. However, im still having the same problem, I get exactly the same error and it tells me to choose a state from the pull down menu :(

 

I guess this means its most likely due to the UK-Based Contribution, I'll check through that and compare it with my original create_account.php file before I installed that contribution and see what could be the problem.

 

do you have any other ideas/suggestions?

Sorry, that is all I can suggest. I am not a programmer.

 

At least you have the backup files.

Link to comment
Share on other sites

hmmmm ive compared my original create_account.php and the UK version of the same file and there is very little difference. I'm sort of convinced that the problem is not actually with that file but with another. Im going to look at the other files that contribution edited and see if I can see anything useful.

 

thanks, for your help

 

Ben

Link to comment
Share on other sites

hmmm after looking at the files downloaded from the UK-Based contribution, it contains a huge SQL file and I think assumes that you are installing OSC from scratch :(

 

hmmm... im abit stuck, I hope someone else can help

Link to comment
Share on other sites

hmmmm ive compared my original create_account.php and the UK version of the same file and there is very little difference. I'm sort of convinced that the problem is not actually with that file but with another. Im going to look at the other files that contribution edited and see if I can see anything useful.

 

thanks, for your help

 

Ben

No problem, sorry it isn't sorted. When the file is compared to a standard file, it has the html stuff missing.

Link to comment
Share on other sites

  • 5 months later...
No problem, sorry it isn't sorted. When the file is compared to a standard file, it has the html stuff missing.

 

I noticed if you take the tep_encrypt_password($password));

 

Search for this:

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password));

 

 

 

Replace it with:

 

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => ($password)); //took out tep_encrypt_password

 

and it lets users register. Maybe you have to take all the tep_encrypt_password everywhere but I also noticed that you have to use PHP 5.x.x and up. You might add this to the .httaccess file by adding.

 

AddHandler application/x-httpd-php5 .php.

 

Open the .httaccess file in notpad and upload the file to your root web folder (example my is /html_ftp/myroot

Link to comment
Share on other sites

Hey,

 

When I fill in all the details on my create_account.php page and then click continue it comes back with an error telling me to

The strange thing is before I clicked 'continue' the 'County/State:' box was a text box that I could write in, however now its a dropdwn list with only one option 'United Kingdom' :(

 

How can I put it back to normal where a customer would just type in their County/State and click continue, I really dont know why im having this error :(

 

Heres my create_account.php page im sorry its so long! :P :

 

<?php
/*
 $Id: create_account.php,v 1.65 2003/06/09 23:03:54 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// needs to be included earlier to set the success message in the messageStack
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

 $process = false;
 if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
$process = true;

if (ACCOUNT_GENDER == 'true') {
  if (isset($HTTP_POST_VARS['gender'])) {
	$gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
  } else {
	$gender = false;
  }
}
$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($HTTP_POST_VARS['company']);
$street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']);
if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']);
$postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']);
$city = tep_db_prepare_input($HTTP_POST_VARS['city']);
if (ACCOUNT_STATE == 'true') {
  $state = tep_db_prepare_input($HTTP_POST_VARS['state']);
  if (isset($HTTP_POST_VARS['zone_id'])) {
	$zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']);
  } else {
	$zone_id = false;
  }
}
$country = tep_db_prepare_input($HTTP_POST_VARS['country']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);
if (isset($HTTP_POST_VARS['newsletter'])) {
  $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']);
} else {
  $newsletter = false;
}
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
$confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']);

// BOC Added for Account Agreement

$agreement = tep_db_prepare_input($HTTP_POST_VARS['agreement']);

// EOC Added for Account Agreement

$error = false;

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 (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4)) == false) {
	$error = true;

	$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
  }
}

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
} elseif (tep_validate_email($email_address) == false) {
  $error = true;

  $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
} else {
  $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
  $check_email = tep_db_fetch_array($check_email_query);
  if ($check_email['total'] > 0) {
	$error = true;

	$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
  }
}

if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
}

if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
}

if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_CITY_ERROR);
}

if (is_numeric($country) == false) {
  $error = true;

  $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
}
if (ACCOUNT_STATE == 'true') {
  $zone_id = 0;
  $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
  $check = tep_db_fetch_array($check_query);
  $entry_state_has_zones = ($check['total'] > 0);
  if ($entry_state_has_zones == true) {
	$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
	if (tep_db_num_rows($zone_query) == 1) {
	  $zone = tep_db_fetch_array($zone_query);
	  $zone_id = $zone['zone_id'];
	} else {

	  $error = true;

	  $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
	}
  } else {
	if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
	  $error = true;

	  $messageStack->add('create_account', ENTRY_STATE_ERROR);
	}
  }
}

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
  $error = true;

  $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
}
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);

}

// BOC Added for Account Agreement
if (ACCOUNT_AGREEMENT_REQUIRED == 'true') {
	if ($agreement == false) {
		$error = true;   

		$messageStack->add('create_account',ENTRY_AGREEMENT_ERROR);
	}
}
// EOC Added for Account Agreement

if ($error == false) {

 $sql_data_array = array('customers_firstname' => $firstname,

					 'customers_lastname' => $lastname,

					 'customers_email_address' => $email_address,

					 'customers_telephone' => $telephone,

					 'customers_fax' => $fax,

					 'customers_newsletter' => $newsletter,

					 'customers_agreement' => $agreement,

					 'customers_password' => tep_encrypt_password($password));
  if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
  if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

  $customer_id = tep_db_insert_id();

  $sql_data_array = array('customers_id' => $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;
	}
  }

  tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

  $address_id = tep_db_insert_id();

  tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

  tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

  if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');

// restore cart contents
  $cart->restore_contents();

// 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);
  }

  $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
  tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

  tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
}
 }

 $breadcrumb->add(NAvb script:void(0);" onclick="NewWindow('popup_conditions.php','tech','800','600','yes');return false"><u style="main"><?php echo CONDITIONS_AGREEMENT; ?></u></a><?php echo AGREEMENT_SEPARATOR; ?><a href="java script:void(0);" onclick="NewWindow('popup_privacy.php','tech','800','600','yes');return false"><u style="main"><?php echo PRIVACY_AGREEMENT; ?></u></a></td>

		  </tr>

		</table></td>

	  </tr>

	</table></td>

  </tr>

  <tr>

	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

  </tr>

<?php

}

?>

 <!-- EOC Added for Account Agreement -->  
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php include(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

thanks,

 

Ben :thumbsup:

 

 

I noticed if you take the tep_encrypt_password($password));

 

Search for this:

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password));

 

 

 

Replace it with:

 

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => ($password)); //took out tep_encrypt_password

 

and it lets users register. Maybe you have to take all the tep_encrypt_password everywhere but I also noticed that you have to use PHP 5.x.x and up. You might add this to the .httaccess file by adding.

 

AddHandler application/x-httpd-php5 .php.

 

Open the .httaccess file in notpad and upload the file to your root web folder (example my is /html_ftp/myroot

Link to comment
Share on other sites

I noticed if you take the tep_encrypt_password($password));

 

Search for this:

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password));

Replace it with:

 

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => ($password)); //took out tep_encrypt_password

 

and it lets users register. Maybe you have to take all the tep_encrypt_password everywhere but I also noticed that you have to use PHP 5.x.x and up. You might add this to the .httaccess file by adding.

 

AddHandler application/x-httpd-php5 .php.

 

Open the .httaccess file in notpad and upload the file to your root web folder (example my is /html_ftp/myroot

 

I have found my problem.

 

Adding the " AddHandler application/x-httpd-php5 .php." to the .httaccess.

You can open the file in notepad in your local computer then upload it to your server.

 

For the tep_encrypt_password errors you need to find /catalog/includes/functions/password_funcs.php

Make sure you have all of this.... copy your old file in case this doesn't work.

 

Copy All and Replace all with this in the password_funcs.php

 

<?php

/*

$Id: password_funcs.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

////

// This funstion validates a plain text password with an

// encrpyted password

function tep_validate_password($plain, $encrypted) {

if (tep_not_null($plain) && tep_not_null($encrypted)) {

// split apart the hash / salt

$stack = explode(':', $encrypted);

 

if (sizeof($stack) != 2) return false;

 

if (md5($stack[1] . $plain) == $stack[0]) {

return true;

}

}

 

return false;

}

 

////

// This function makes a new password from a plaintext password.

function tep_encrypt_password($plain) {

$password = '';

 

for ($i=0; $i<10; $i++) {

$password .= tep_rand();

}

 

$salt = substr(md5($password), 0, 2);

 

$password = md5($salt . $plain) . ':' . $salt;

 

return $password;

}

?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...