qorn Posted June 26, 2004 Posted June 26, 2004 Hi I have been given a script that adds users email addresses to the database to enable them to recive the newsletter. I need to put these 2 files back together, but for the life of me, I have failed If there is anyone out there that understands, please help. I need this script into the next one <?php /* $Id: quick_signup.php,v 1.1 2003/06/22 08:20:07 Tim Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ global $insert_java; $insert_java = 'false'; require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_QUICK_SIGNUP); $action = "process"; if ( ($HTTP_GET_VARS['email_address'] != "") || (strlen($HTTP_GET_VARS['email_address']) > 0 )) { // Actually insert the email address into the table $email_address = tep_db_prepare_input($HTTP_GET_VARS['email_address']); $newsletter = 1; // subscribed $error = false; // reset error flag if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $entry_email_address_error = true; } else { $entry_email_address_error = false; } if (!tep_validate_email($email_address)) { $error = true; $entry_email_address_check_error = true; } else { $entry_email_address_check_error = false; } $check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_id <> '" . tep_db_input($customer_id) . "'"); if (tep_db_num_rows($check_email)) { $error = true; $entry_email_address_exists = true; } else { $entry_email_address_exists = false; } if ($error == true) { $processed = true; $breadcrumb->add(NAVBAR_TITLE2); } else { $sql_data_array = array('customers_email_address' => $email_address, 'customers_newsletter' => $newsletter, 'customers_default_address_id' => 0); //no address tep_db_perform(TABLE_CUSTOMERS, $sql_data_array); $customer_id = tep_db_insert_id(); // then show confirmation page $action = "confirm"; } } else { if ($HTTP_GET_VARS['action'] == "process") { $error = true; $entry_email_address_error = true; } $breadcrumb->add(NAVBAR_TITLE1, tep_href_link(FILENAME_QUICK_SIGNUP, '', 'NONSSL')); } ?> <?php /* $Id: quick_signup.php,v 1.1 2003/06/22 08:20:06 Tim Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ ?> <!-- body_text //--> <td width="100%" valign="top"> <form name="quick_signup" method="get" <?php echo 'action="' . tep_href_link(FILENAME_QUICK_SIGNUP, '', 'SSL') . '"'; ?> onSubmit="return check_form();"> <input type="hidden" name="action" value="process"> <input type="hidden" name="pageID" value="<?php echo FILENAME_QUICK_SIGNUP?>"> <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_browse.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> <tr> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php if ($action == 'confirm') { echo TEXT_CONFIRM; } else { if ($entry_email_address_exists) { echo TEXT_IF_MEMBER; } else { echo TEXT_WHY_SIGNUP; } } ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if ($action != 'confirm') { ?> <tr> <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="formArea"> <tr> <td class="main"><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"> <?php echo ENTRY_EMAIL_ADDRESS; ?></td> <td class="main"> <?php if ($error) { if ($entry_email_address_error) { echo tep_draw_input_field('email_address') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR; } elseif ($entry_email_address_check_error) { echo tep_draw_input_field('email_address') . ' ' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR; } elseif ($entry_email_address_exists) { echo tep_draw_input_field('email_address') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS; } else { echo $email_address . tep_draw_hidden_field('email_address'); } } else { echo tep_draw_input_field('email_address', '') . ' ' . ENTRY_EMAIL_ADDRESS_TEXT; } ?></td> </tr> </tr> </table></td> </tr> </table></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="main" align="left"><?php if ($action != 'confirm') { echo '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('sort', 'page', 'x', 'y')), 'NONSSL', true, false) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; }?></td> <td align="right" class="main"><?php if ($action != 'confirm') { echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); } else { echo '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('sort', 'page', 'x', 'y')), 'NONSSL', true, false) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; }?></td> </tr> </table> </td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="1" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> Thanks for your help Dave My Contributions
Guest Posted June 26, 2004 Posted June 26, 2004 where did you get these codes from? they are not very complete, and does one section even work? there is an old contribution which was for ms1 which would probably be better to merge here.
qorn Posted July 1, 2004 Author Posted July 1, 2004 Thanks for your help John I saw these on a website, so I eMailed him asking him for the script, and he sent me 3 files, the infobox script I didnt include within my last post. The site is Beautifulmood He said that he was using the "One Template Mod" and I would have to put the two files back together if I wasnt using this mod. This is the best way customers can add there email address to the newsletter database, but no one has made this into a contrib. Kind Regards Dave My Contributions
Recommended Posts
Archived
This topic is now archived and is closed to further replies.