[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> affiliate_password.php (source)

   1  <?php
   2  /*

   3    $Id: affiliate_password.php,v 2.00 2003/10/12

   4  

   5    OSC-Affiliate

   6  

   7    Contribution based on:

   8  

   9    osCommerce, Open Source E-Commerce Solutions

  10    http://www.oscommerce.com

  11  

  12    Copyright (c) 2002 - 2003 osCommerce

  13  

  14    Released under the GNU General Public License

  15  */
  16  
  17    require ('includes/application_top.php');
  18  
  19    if (!tep_session_is_registered('affiliate_id')) {
  20      $navigation->set_snapshot();
  21      tep_redirect(tep_href_link(FILENAME_AFFILIATE, '', 'SSL'));
  22    }
  23  
  24  // needs to be included earlier to set the success message in the messageStack

  25    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_AFFILIATE_PASSWORD);
  26  
  27    if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
  28      $password_current = tep_db_prepare_input($HTTP_POST_VARS['password_current']);
  29      $password_new = tep_db_prepare_input($HTTP_POST_VARS['password_new']);
  30      $password_confirmation = tep_db_prepare_input($HTTP_POST_VARS['password_confirmation']);
  31  
  32      $error = false;
  33  
  34      if (strlen($password_current) < ENTRY_PASSWORD_MIN_LENGTH) {
  35        $error = true;
  36  
  37        $messageStack->add('a_password', ENTRY_PASSWORD_CURRENT_ERROR);
  38      } elseif (strlen($password_new) < ENTRY_PASSWORD_MIN_LENGTH) {
  39        $error = true;
  40  
  41        $messageStack->add('a_password', ENTRY_PASSWORD_NEW_ERROR);
  42      } elseif ($password_new != $password_confirmation) {
  43        $error = true;
  44  
  45        $messageStack->add('a_password', ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING);
  46      }
  47  
  48      if ($error == false) {
  49        $check_affiliate_query = tep_db_query("select affiliate_password from " . TABLE_AFFILIATE . " where affiliate_id = '" . (int)$affiliate_id . "'");
  50        $check_affiliate = tep_db_fetch_array($check_affiliate_query);
  51  
  52        if (tep_validate_password($password_current, $check_affiliate['affiliate_password'])) {
  53          tep_db_query("update " . TABLE_AFFILIATE . " set affiliate_password = '" . tep_encrypt_password($password_new) . "' where affiliate_id = '" . (int)$affiliate_id . "'");
  54  
  55          $messageStack->add_session('account', SUCCESS_PASSWORD_UPDATED, 'success');
  56  
  57          tep_redirect(tep_href_link(FILENAME_AFFILIATE_SUMMARY, '', 'SSL'));
  58        } else {
  59          $error = true;
  60  
  61          $messageStack->add('a_password', ERROR_CURRENT_PASSWORD_NOT_MATCHING);
  62        }
  63      }
  64    }
  65  
  66    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_AFFILIATE, '', 'SSL'));
  67    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_AFFILIATE_PASSWORD, '', 'SSL'));
  68    $content = affiliate_password; 
  69    include (bts_select('main', $content_template)); // BTSv1.5

  70     require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7