[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/ -> login.php (source)

   1  <?php
   2  /*
   3    $Id: login.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15  // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
  16    if ($session_started == false) {
  17      tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
  18    }
  19  
  20    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);
  21  
  22    $error = false;
  23    if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
  24      $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
  25      $password = tep_db_prepare_input($HTTP_POST_VARS['password']);
  26  
  27  // Check if email exists
  28      $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
  29      if (!tep_db_num_rows($check_customer_query)) {
  30        $error = true;
  31      } else {
  32        $check_customer = tep_db_fetch_array($check_customer_query);
  33  // Check that password is good
  34        if (!tep_validate_password($password, $check_customer['customers_password'])) {
  35          $error = true;
  36        } else {
  37          if (SESSION_RECREATE == 'True') {
  38            tep_session_recreate();
  39          }
  40  
  41          $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
  42          $check_country = tep_db_fetch_array($check_country_query);
  43  
  44          $customer_id = $check_customer['customers_id'];
  45          $customer_default_address_id = $check_customer['customers_default_address_id'];
  46          $customer_first_name = $check_customer['customers_firstname'];
  47          $customer_country_id = $check_country['entry_country_id'];
  48          $customer_zone_id = $check_country['entry_zone_id'];
  49          tep_session_register('customer_id');
  50          tep_session_register('customer_default_address_id');
  51          tep_session_register('customer_first_name');
  52          tep_session_register('customer_country_id');
  53          tep_session_register('customer_zone_id');
  54  
  55          tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
  56  
  57  // restore cart contents
  58          $cart->restore_contents();
  59  
  60          if (sizeof($navigation->snapshot) > 0) {
  61            $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
  62            $navigation->clear_snapshot();
  63            tep_redirect($origin_href);
  64          } else {
  65            tep_redirect(tep_href_link(FILENAME_DEFAULT));
  66          }
  67        }
  68      }
  69    }
  70  
  71    if ($error == true) {
  72      $messageStack->add('login', TEXT_LOGIN_ERROR);
  73    }
  74  
  75    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  76  ?>
  77  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  78  <html <?php echo HTML_PARAMS; ?>>
  79  <head>
  80  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  81  <title><?php echo TITLE; ?></title>
  82  <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
  83  <link rel="stylesheet" type="text/css" href="stylesheet.css">
  84  <script language="javascript"><!--
  85  function session_win() {
  86    window.open("<?php echo tep_href_link(FILENAME_INFO_SHOPPING_CART); ?>","info_shopping_cart","height=460,width=430,toolbar=no,statusbar=no,scrollbars=yes").focus();
  87  }
  88  //--></script>
  89  </head>
  90  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
  91  <!-- header //-->
  92  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  93  <!-- header_eof //-->
  94  
  95  <!-- body //-->
  96  <table border="0" width="100%" cellspacing="3" cellpadding="3">
  97    <tr>
  98      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  99  <!-- left_navigation //-->
 100  <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
 101  <!-- left_navigation_eof //-->
 102      </table></td>
 103  <!-- body_text //-->
 104      <td width="100%" valign="top"><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
 105        <tr>
 106          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 107            <tr>
 108              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 109              <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_login.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
 110            </tr>
 111          </table></td>
 112        </tr>
 113        <tr>
 114          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 115        </tr>
 116  <?php
 117    if ($messageStack->size('login') > 0) {
 118  ?>
 119        <tr>
 120          <td><?php echo $messageStack->output('login'); ?></td>
 121        </tr>
 122        <tr>
 123          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 124        </tr>
 125  <?php
 126    }
 127  
 128    if ($cart->count_contents() > 0) {
 129  ?>
 130        <tr>
 131          <td class="smallText"><?php echo TEXT_VISITORS_CART; ?></td>
 132        </tr>
 133        <tr>
 134          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 135        </tr>
 136  <?php
 137    }
 138  ?>
 139        <tr>
 140          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 141            <tr>
 142              <td class="main" width="50%" valign="top"><b><?php echo HEADING_NEW_CUSTOMER; ?></b></td>
 143              <td class="main" width="50%" valign="top"><b><?php echo HEADING_RETURNING_CUSTOMER; ?></b></td>
 144            </tr>
 145            <tr>
 146              <td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
 147                <tr class="infoBoxContents">
 148                  <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
 149                    <tr>
 150                      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 151                    </tr>
 152                    <tr>
 153                      <td class="main" valign="top"><?php echo TEXT_NEW_CUSTOMER . '<br><br>' . TEXT_NEW_CUSTOMER_INTRODUCTION; ?></td>
 154                    </tr>
 155                    <tr>
 156                      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 157                    </tr>
 158                    <tr>
 159                      <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 160                        <tr>
 161                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 162                          <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
 163                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 164                        </tr>
 165                      </table></td>
 166                    </tr>
 167                  </table></td>
 168                </tr>
 169              </table></td>
 170              <td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
 171                <tr class="infoBoxContents">
 172                  <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
 173                    <tr>
 174                      <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 175                    </tr>
 176                    <tr>
 177                      <td class="main" colspan="2"><?php echo TEXT_RETURNING_CUSTOMER; ?></td>
 178                    </tr>
 179                    <tr>
 180                      <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 181                    </tr>
 182                    <tr>
 183                      <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
 184                      <td class="main"><?php echo tep_draw_input_field('email_address'); ?></td>
 185                    </tr>
 186                    <tr>
 187                      <td class="main"><b><?php echo ENTRY_PASSWORD; ?></b></td>
 188                      <td class="main"><?php echo tep_draw_password_field('password'); ?></td>
 189                    </tr>
 190                    <tr>
 191                      <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 192                    </tr>
 193                    <tr>
 194                      <td class="smallText" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'; ?></td>
 195                    </tr>
 196                    <tr>
 197                      <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 198                    </tr>
 199                    <tr>
 200                      <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 201                        <tr>
 202                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 203                          <td align="right"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td>
 204                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 205                        </tr>
 206                      </table></td>
 207                    </tr>
 208                  </table></td>
 209                </tr>
 210              </table></td>
 211            </tr>
 212          </table></td>
 213        </tr>
 214      </table></form></td>
 215  <!-- body_text_eof //-->
 216      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 217  <!-- right_navigation //-->
 218  <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
 219  <!-- right_navigation_eof //-->
 220      </table></td>
 221    </tr>
 222  </table>
 223  <!-- body_eof //-->
 224  
 225  <!-- footer //-->
 226  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 227  <!-- footer_eof //-->
 228  <br>
 229  </body>
 230  </html>
 231  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics