[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/modules/pages/unsubscribe/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * unsubscribe header_php.php 

   4   *

   5   * @package page

   6   * @copyright Copyright 2003-2006 Zen Cart Development Team

   7   * @copyright Portions Copyright 2003 osCommerce

   8   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   9   * @version $Id: header_php.php 3000 2006-02-09 21:11:37Z wilt $

  10   */
  11  
  12  // This should be first line of the script:

  13  $zco_notifier->notify('NOTIFY_HEADER_START_UNSUBSCRIBE');
  14  
  15  require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
  16  
  17  //present the option to unsubscribe, with a confirm button/link

  18  if (isset($_GET['addr'])) {
  19    $unsubscribe_address = ereg_replace('[^0-9A-Za-z@._-]', '', $_GET['addr']);
  20    if ($unsubscribe_address=='')  zen_redirect(zen_href_link(FILENAME_ACCOUNT_NEWSLETTERS));
  21  } else {
  22    $unsubscribe_address = '';
  23  }
  24  
  25  $breadcrumb->add(NAVBAR_TITLE, zen_href_link(FILENAME_UNSUBSCRIBE, '', 'NONSSL'));
  26  
  27  
  28  // if they clicked on the "confirm unsubscribe" then process it:

  29  if (isset($_GET['action']) && ($_GET['action'] == 'unsubscribe')) {
  30    $unsubscribe_address = zen_db_prepare_input($_GET['addr']);
  31    /// Check and see if the email exists in the database, and is subscribed to the newsletter.

  32    $unsubscribe_count_query = "SELECT 1 
  33                                FROM " . TABLE_CUSTOMERS . " 
  34                                WHERE customers_newsletter = '1' 
  35                                AND customers_email_address = :emailAddress";
  36    
  37    $unsubscribe_count_query = $db->bindVars($unsubscribe_count_query, ':emailAddress', $unsubscribe_address, 'string');
  38    $unsubscribe = $db->Execute($unsubscribe_count_query);
  39  
  40    // If we found the customer's email address, and they currently subscribe

  41    if ($unsubscribe->RecordCount() >0) {
  42      $unsubscribe_query = "UPDATE " . TABLE_CUSTOMERS . " 
  43                            SET customers_newsletter = '0' 
  44                            WHERE customers_email_address = :emailAddress";
  45      
  46      $unsubscribe_query = $db->bindVars($unsubscribe_query, ':emailAddress', $unsubscribe_address, 'string');    
  47      $unsubscribe = $db->Execute($unsubscribe_query);
  48      $status_display = UNSUBSCRIBE_DONE_TEXT_INFORMATION . $unsubscribe_address;
  49    } else {
  50      // If not found, we want to display an error message (This should never occur, unless they try to unsubscribe twice)

  51      $status_display = UNSUBSCRIBE_ERROR_INFORMATION . $unsubscribe_address;
  52    }
  53  }
  54  
  55  $_SESSION['navigation']->remove_current_page();
  56  
  57  // This should be last line of the script:

  58  $zco_notifier->notify('NOTIFY_HEADER_END_UNSUBSCRIBE');
  59  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics