MR1 Posted March 23, 2010 Share Posted March 23, 2010 Hello Guys, I have just installed Sams Anti Hack tool, but not sure if this problem has come after or it was before, as when i have no products in cart and then when i click on create a account i get the option to enter a password for the account, but if i have something in the cart and then when i click on check out i dont get the option to enter a password for the account. ANy help would be apericiated, here is the code. <?php /* $Id: create_account.php 1.5 2010/02/02 Spooks $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ // anti-hacker account $no_pword = true; // set to true to disable password requirement & enable 'remember me' check box. $login_box = true; // set to true to show login box above create account box $top_phone = false; // set to true to show phone fields with personal details $no_fax = false; // set to true to disable fax fields require('includes/functions/account_secure.php'); $password = tep_to_hex($_POST['password']); $pw_size = strlen($_POST['password']); $pw_match = ($_POST['confirmation'] == $_POST['password']); $strong_pw = tep_strong_password($_POST["password"]); unset($_POST['password']);unset($_POST['confirmation']); $email_address = ''; clean_post (); // EOF anti-hacker account require('includes/application_top.php'); // ajax require(DIR_WS_FUNCTIONS . 'ajax.php'); if (isset($_POST['action']) && $_POST['action'] == 'getStates' && isset($_POST['country'])) { ajax_get_zones_html(tep_db_prepare_input($_POST['country'])); } else { $nocart = ($cart->count_contents() < 1); if ($nocart) $no_pword = false; if ($no_pword) $pw_match = true; $country = STORE_COUNTRY; // EOF ajax // 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($_POST['action']) && ($_POST['action'] == 'process')) { $process = true; // anti-hacker account $_POST['dob'] = $_POST['dob_ind'].'/'.$_POST['dob_inm'].'/'.$_POST['dob_in']; // EOF anti-hacker account if (ACCOUNT_GENDER == 'true') { if (isset($_POST['gender'])) { $gender = tep_db_prepare_input($_POST['gender']); } else { $gender = false; } } $firstname = tep_db_prepare_input($_POST['firstname']); $lastname = tep_db_prepare_input($_POST['lastname']); if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($_POST['dob']); $email_address = tep_db_prepare_input($_POST['email_address']); if (ACCOUNT_COMPANY == 'true') $company = tep_db_prepare_input($_POST['company']); $street_address = tep_db_prepare_input($_POST['street_address']); if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($_POST['suburb']); $postcode = tep_db_prepare_input($_POST['postcode']); $city = tep_db_prepare_input($_POST['city']); if (ACCOUNT_STATE == 'true') { $state = isset($_POST['state']) ? tep_db_prepare_input($_POST['state']) : ''; if (isset($_POST['zone_id'])) { $zone_id = tep_db_prepare_input($_POST['zone_id']); } else { $zone_id = false; } } $country = tep_db_prepare_input($_POST['country']); $telephone = tep_db_prepare_input($_POST['telephone']); $fax = tep_db_prepare_input($_POST['fax']); if (isset($_POST['newsletter'])) { $newsletter = tep_db_prepare_input($_POST['newsletter']); } else { $newsletter = false; } // anti-hacker account $details = isset($_POST['details']) ? $_POST['details'] : false; if ($no_pword) { $password = ''; while (!tep_strong_password($password) || !tep_not_null($password)) $password = tep_create_random_value(ENTRY_PASSWORD_MIN_LENGTH); $crypted_password = tep_to_hex($password); $pw_size = ENTRY_PASSWORD_MIN_LENGTH; } $messagePage = 'create_account'; $error = false; $short_check = false; include(DIR_WS_MODULES . 'validate_name_fields.php'); include(DIR_WS_MODULES . 'validate_address_fields.php'); if ($pw_size < ENTRY_PASSWORD_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_PASSWORD_ERROR); } elseif (!$pw_match) { $error = true; $messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING); } if (!$strong_pw) { $messageStack->add('create_account', ENTRY_PASSWORD_STRONG_ERROR); $error = true; } // EOF anti-hacker account 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, // anti-hacker account 'customers_password' => tep_encrypt_password($no_pword ? $crypted_password : $password)); // EOF anti-hacker account 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_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); } // anti-hacker account if (!$no_pword) $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING; else $email_text .= EMAIL_WELCOME . EMAIL_CONTACT . EMAIL_WARNING; if ($no_pword && $details) { $email_text .= EMAIL_PASSWORD . $password; } tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); if (!$no_pword || $nocart) { tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, 'info_message=' . TEXT_ACCOUNT_CREATED, 'SSL')); } // EOF anti-hacker account } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); ?> <!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 (($request_type == 'SSL') ? 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> <!-- 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"><!-- anti-hacker account --> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" 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> <!-- anti-hacker account --> <?php $colpos = '<tr><td width="140px"></td></tr>'; ?> <?php if (!$login_box) { ?> <tr> <td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td> </tr> <?php } elseif (!$process) { ?> <tr> <td class="main" valign="top"><b>To Login: </b></td> </tr> <tr class="infoBoxContents"> <td ><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?> <table border="0" cellspacing="1" cellpadding="2" class="infoBox" width="100%"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <?php echo $colpos; ?> <tr> <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> <td class="main" align="left"><?php echo tep_draw_input_field('email_address', '', 'size="28"'); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_PASSWORD; ?></td> <td class="main"><?php echo tep_draw_password_field('password', '', 'size="16" maxlength="22"'); ?></td> </tr> </table> <table border="0" cellspacing="2" cellpadding="2" width="100%"> <tr> <td class="smallText" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, 'email_address=' . $email_address, 'SSL') . '">' . "Forgot Password?" . '</a>'; ?></td> <td align="right"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td> <td ><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table> </td> </tr> </table> </form> </td> </tr> <?php } ?> <!-- EOF anti-hacker account --> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if ($messageStack->size('create_account') > 0) { ?> <tr> <td><?php echo $messageStack->output('create_account'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- anti-hacker account --> </table> <?php echo tep_draw_form('create_account', tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'), 'post', 'onSubmit="return check_form(create_account);"') . tep_draw_hidden_field('action', 'process'); ?><!-- ajax --><div id="indicator"></div><!-- eof ajax --> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <!-- EOF anti-hacker account --> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><b><?php echo CATEGORY_PERSONAL; ?></b></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <?php echo $colpos; ?> <?php if (ACCOUNT_GENDER == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_GENDER; ?></td> <td class="main"><?php echo tep_draw_radio_field('gender', 'm') . ' ' . MALE . ' ' . tep_draw_radio_field('gender', 'f') . ' ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('firstname') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_LAST_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('lastname') . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td> </tr> <?php if (ACCOUNT_DOB == 'true') { // anti-hacker account $def_year = isset($_POST['dob_in']) ? $_POST['dob_in'] : 1980; $day = isset($_POST['dob_ind']) ? $_POST['dob_ind'] : '00'; $month = isset($_POST['dob_inm']) ? $_POST['dob_inm'] : '00'; ?> <tr> <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td> <td class="main"><?php echo tep_pull_down_date('dob_in', $day, $month, $def_year, true, 1900) . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> <td class="main"><?php echo tep_draw_input_field('email_address', '', 'size="28"') . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td> </tr> <?php if ($top_phone) { ?> <tr> <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td> <td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td> </tr> <?php if (!$no_fax) { ?> <tr> <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td> <td class="main"><?php echo tep_draw_input_field('fax') . ' ' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td> </tr> <?php } } ?> <!-- EOF anti-hacker account --> </table></td> </tr> </table></td> </tr> <?php if (ACCOUNT_COMPANY == 'true') { ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><b><?php echo CATEGORY_COMPANY; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <?php echo $colpos; ?> <tr> <td class="main"><?php echo ENTRY_COMPANY; ?></td> <td class="main"><?php echo tep_draw_input_field('company') . ' ' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><b><?php echo CATEGORY_ADDRESS; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <?php echo $colpos; ?> <!-- anti-hacker account --> <?php include(DIR_WS_MODULES . 'address_fields.php'); ?> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if (!$top_phone) { ?> <tr> <td class="main"><b><?php echo CATEGORY_CONTACT; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <?php echo $colpos; ?> <tr> <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td> <td class="main"><?php echo tep_draw_input_field('telephone') . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td> </tr> <?php if (!$no_fax) { ?> <tr> <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td> <td class="main"><?php echo tep_draw_input_field('fax') . ' ' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td> </tr> <?php } ?> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <!-- EOF anti-hacker account --> <tr> <td class="main"><b><?php echo CATEGORY_OPTIONS; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <tr> <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td> <td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . ' ' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><b><?php echo $no_pword ? CATEGORY_DETAILS : CATEGORY_PASSWORD; ?></b></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" cellspacing="2" cellpadding="2"> <?php if (!$no_pword) { echo $colpos; ?> <tr> <td class="main"><?php echo ENTRY_PASSWORD; ?></td> <td class="main"><?php echo tep_draw_password_field('password', '', 'size="16" maxlength="22"') . ' ' . (tep_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td> <td class="main"><?php echo tep_draw_password_field('confirmation', '', 'size="16" maxlength="22"') . ' ' . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td> </tr> <?php } else { ?> <tr> <td class="main"><?php echo ENTRY_SAVE_DETAIL ; ?></td> <td class="main"><?php echo tep_draw_checkbox_field('details', '1'); ?></td> </tr> <?php } ?> </table></td> </tr> </table></td> </tr> <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 class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></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 //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php include(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php include(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); // ajax } // EOF ajax ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.