Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PROBLEM : subscription / create account process


moosaic

Recommended Posts

I have a major problem : new user which try to create an account fill out the form, but once validated (create_account_process.php) it remains on the same page (create_account_process.php). All informations in the form are checked OK. I did not manipulate OS Commerce, but text and images.

 

No customers can order now, so please help ! Here is the file in /catalog

 

<?php

/*

$Id: create_account_process.php,v 1.1 2002/09/07 17:16:03 jpcivade Exp $

 

The Exchange Project - Community Made Shopping!

http://www.theexchangeproject.org

 

Copyright © 2000,2001 The Exchange Project

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT_PROCESS);

 

if (!@$HTTP_POST_VARS['action']) {

tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'NONSSL'));

}

 

$error = 0; // reset error flag

 

if ((ACCOUNT_GENDER == 'true') && (ACCOUNT_REQUIRED_GENDER == 'true')) {

if (($HTTP_POST_VARS['gender'] == 'm') || ($HTTP_POST_VARS['gender'] == 'f')) {

$entry_gender_error = false;

} else {

$error = 1;

$entry_gender_error = true;

}

}

 

if ((ACCOUNT_GPF == 'true') && (ACCOUNT_REQUIRED_GPF == 'true')) {

if (strlen(trim($HTTP_POST_VARS['lastname'])) < ENTRY_GPF_MIN_LENGTH) {

$error = true;

$entry_gpf_error = true;

} else {

$entry_gpf_error = false;

}

}

 

if ((ACCOUNT_FIRSTNAME == 'true') && (ACCOUNT_REQUIRED_FIRSTNAME == 'true')) {

if (strlen(trim($HTTP_POST_VARS['firstname'])) < ENTRY_FIRST_NAME_MIN_LENGTH) {

$error = true;

$entry_firstname_error = true;

} else {

$entry_firstname_error = false;

}

}

 

if ((ACCOUNT_LASTNAME == 'true') && (ACCOUNT_REQUIRED_LASTNAME == 'true')) {

if (strlen(trim($HTTP_POST_VARS['lastname'])) < ENTRY_LAST_NAME_MIN_LENGTH) {

$error = true;

$entry_lastname_error = true;

} else {

$entry_lastname_error = false;

}

}

 

if ((ACCOUNT_DOB == 'true') && (ACCOUNT_REQUIRED_DOB == 'true')) {

if (checkdate(substr(tep_date_raw($HTTP_POST_VARS['dob']), 4, 2), substr(tep_date_raw($HTTP_POST_VARS['dob']), 6, 2), substr(tep_date_raw($HTTP_POST_VARS['dob']), 0, 4))) {

$entry_date_of_birth_error = false;

} else {

$error = true;

$entry_date_of_birth_error = true;

}

}

 

if ((ACCOUNT_EMAIL == 'true') && (ACCOUNT_REQUIRED_EMAIL == 'true')) {

if (strlen(trim($HTTP_POST_VARS['email_address'])) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {

$error = true;

$entry_email_address_error = true;

} else {

$entry_email_address_error = false;

}

}

 

if (!(tep_validate_email(trim($HTTP_POST_VARS['email_address'])))) {

$error = true;

$entry_email_address_check_error = true;

} else {

$entry_email_address_check_error = false;

}

 

if ((ACCOUNT_COMPANY == 'true') && (ACCOUNT_REQUIRED_COMPANY == 'true')) {

if (strlen(trim($HTTP_POST_VARS['company'])) < ENTRY_COMPANY_MIN_LENGTH) {

$error = true;

$entry_company_error = true;

} else {

$entry_company_error = false;

}

}

 

if ((ACCOUNT_ADDRESS == 'true') && (ACCOUNT_REQUIRED_ADDRESS == 'true')) {

if (strlen(trim($HTTP_POST_VARS['street_address'])) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

$error = true;

$entry_street_address_error = true;

} else {

$entry_street_address_error = false;

}

}

 

if ((ACCOUNT_ZIPCODE == 'true') && (ACCOUNT_REQUIRED_ZIPCODE == 'true')) {

if (strlen(trim($HTTP_POST_VARS['postcode'])) < ENTRY_POSTCODE_MIN_LENGTH) {

$error = true;

$entry_post_code_error = true;

} else {

$entry_post_code_error = false;

}

}

 

if ((ACCOUNT_CITY == 'true') && (ACCOUNT_REQUIRED_CITY == 'true')) {

if (strlen(trim($HTTP_POST_VARS['city'])) < ENTRY_CITY_MIN_LENGTH) {

$error = true;

$entry_city_error = true;

} else {

$entry_city_error = false;

}

}

 

if ((ACCOUNT_STATE == 'true') && (ACCOUNT_REQUIRED_STATE == 'true')) {

$zone_id = $HTTP_POST_VARS['zone_id'];

if ($zone_id > 0) {

$state = '';

} else {

$state = trim($HTTP_POST_VARS['state']);

}

}

 

if ((ACCOUNT_COUNTRY == 'true') && (ACCOUNT_REQUIRED_COUNTRY == 'true')) {

if ($HTTP_POST_VARS['country'] == '0') {

$error = true;

$entry_country_error = true;

} else {

$entry_country_error = false;

}

}

 

if ((ACCOUNT_PHONE == 'true') && (ACCOUNT_REQUIRED_PHONE == 'true')) {

if (strlen(trim($HTTP_POST_VARS['telephone'])) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

$entry_telephone_error = true;

} else {

$entry_telephone_error = false;

}

}

 

if ((ACCOUNT_MOBILE == 'true') && (ACCOUNT_REQUIRED_MOBILE == 'true')) {

if (strlen(trim($HTTP_POST_VARS['telephone'])) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

$entry_mobile_error = true;

} else {

$entry_mobile_error = false;

}

}

 

if ((ACCOUNT_FAX == 'true') && (ACCOUNT_REQUIRED_FAX == 'true')) {

if (strlen(trim($HTTP_POST_VARS['telephone'])) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

$entry_fax_error = true;

} else {

$entry_fax_error = false;

}

}

 

$passlen = strlen(trim($HTTP_POST_VARS['password']));

if ($passlen < ENTRY_PASSWORD_MIN_LENGTH) {

$error = true;

$entry_password_error = true;

} else {

$entry_password_error = false;

}

 

if (trim($HTTP_POST_VARS['password']) != trim($HTTP_POST_VARS['confirmation'])) {

$error = true;

$entry_password_error = true;

}

 

$check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . $HTTP_POST_VARS['email_address'] . "' and customers_id <> '" . $customer_id . "'");

if (tep_db_num_rows($check_email)) {

$error = true;

$entry_email_address_exists = true;

} else {

$entry_email_address_exists = false;

}

 

if ($error == 1) {

$processed = true;

 

$location = ' » <a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'NONSSL') . '" class="headerNavigation">' . NAVBAR_TITLE_1 . '</a> » ' . NAVBAR_TITLE_2;

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

<?php require('includes/form_check.js.php'); ?>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><form name="account_edit" method="post" <?php echo 'action="' . tep_href_link(FILENAME_CREATE_ACCOUNT_PROCESS, '', 'NONSSL') . '"'; ?> onSubmit="return check_form();"><input type="hidden" name="action" value="process"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

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

</tr>

<tr>

<td><?php require(DIR_WS_MODULES . 'account_details.php'); ?></td>

</tr>

<tr>

<td align="right" class="main"><br><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

</tr>

</table><?php if ($HTTP_POST_VARS['origin']) { echo '<input type="hidden" name="origin" value="' . $HTTP_POST_VARS['origin'] . '">'; } ?></form></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php

} else {

$date_now = date('Ymd');

$dob_ordered = substr($HTTP_POST_VARS['dob'], -4) . substr($HTTP_POST_VARS['dob'], 0, 2) . substr($HTTP_POST_VARS['dob'], 2, 2);

// Crypted passwords mods

$crypted_password = crypt_password($HTTP_POST_VARS['password']);

tep_db_query("insert into " . TABLE_CUSTOMERS . " (customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_default_address_id, customers_telephone, customers_fax, customers_password, customers_newsletter) values ('" . $HTTP_POST_VARS['gender'] . "', '" . $HTTP_POST_VARS['firstname'] . "', '" . $HTTP_POST_VARS['lastname'] . "', '" . tep_date_raw($HTTP_POST_VARS['dob']) . "', '" . $HTTP_POST_VARS['email_address'] . "', '1', '" . $HTTP_POST_VARS['telephone'] . "', '" . $HTTP_POST_VARS['fax'] . "', '" . $crypted_password . "', '" . $HTTP_POST_VARS['newsletter'] . "')");

$insert_id = tep_db_insert_id();

tep_db_query("insert into " . TABLE_ADDRESS_BOOK . " (customers_id, address_book_id, entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id) values ('" . $insert_id . "', '1', '" . $HTTP_POST_VARS['gender'] . "', '" . $HTTP_POST_VARS['company'] . "', '" . $HTTP_POST_VARS['firstname'] . "', '" . $HTTP_POST_VARS['lastname'] . "', '" . $HTTP_POST_VARS['street_address'] . "', '" . $HTTP_POST_VARS['suburb'] . "', '" . $HTTP_POST_VARS['postcode'] . "', '" . $HTTP_POST_VARS['city'] . "', '" . $state . "', '" . $HTTP_POST_VARS['country'] . "', '" . $HTTP_POST_VARS['zone_id'] . "')");

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

 

$customer_id = $insert_id;

$customer_first_name = $HTTP_POST_VARS['firstname'];

$customer_default_address_id = 1;

$customer_country_id = $HTTP_POST_VARS['country'];

$customer_zone_id = $HTTP_POST_VARS['zone_id'];

 

// Moderate users. Don't allow automatic login.

if (MODERATE_USERS=='false') {

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

// end Moderate users. Don't allow automatic login.

}

 

// build the message content

$firstname = $HTTP_POST_VARS['firstname'];

$lastname = $HTTP_POST_VARS['lastname'];

$name = $firstname . " " . $lastname;

$email_address = $HTTP_POST_VARS['email_address'];

 

if (ACCOUNT_GENDER == 'true') {

if ($HTTP_POST_VARS['gender'] == 'm') {

$email_text = EMAIL_GREET_MR;

} else {

$email_text = EMAIL_GREET_MS;

}

} else {

$email_text = EMAIL_GREET_NONE;

}

 

if (MODERATE_USERS=='false') {

$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT;

}

else {

$email_text .= EMAIL_WELCOME . EMAIL_MODERATED . EMAIL_CONTACT;

}

tep_mail($name, $email_address, EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

 

if ($HTTP_POST_VARS['origin']) {

tep_redirect(tep_href_link($HTTP_POST_VARS['origin'], '', 'SSL'));

} else {

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

}

}

 

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

Or check at www.chronosmedias.com/catalog/create_account_process.php

Link to comment
Share on other sites

You are mistaken.

 

It created an account just fine for me.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Thankx for your replies, but it still does not work for some customers only !!!

 

1) Wizardsandwars : it works for you, some of my customers and I, but not for others...

 

2) I got the latest french package wich takes the date thing into account. This is not the date problem but thanks

 

FYI, I tried to simulate the subscription for this guy (which can't subscribe) :

- It works when changing name, last name, email only with other informations which are related to a good customer file

- It does not work when I type this guy's name (5 letters first name / 4 letters last name / [email protected])

 

Check at :

http://www.chronosmedias.com/catalog/creat...ate_account.php

 

It is a nightmare!!!

 

PLEASE HELP

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...