Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Facebook Connect Support Thread


176 replies to this topic

#1 Stouffers3

  • Community Member
  • 49 posts
  • Real Name:Stephanie
  • Gender:Female
  • Location:CA

Posted 06 October 2010, 16:03

I'm starting a thread for the Facebook Connect contribution. Please post your questions here.

Tips:

As far as getting a Facebook application:
1. Go to http://www.facebook.com/developers/createapp.php
2. Fill out your application name (usually the name of your company or website)
3. The only other field I filled out was my site url
Stephanie D.

#2 PiLLaO

  • Community Member
  • 109 posts
  • Real Name:Gustavo

Posted 06 October 2010, 16:13

Great contribution!!

I have an issue, gender on create_account.php is showed empty

Only shows: name, surname, birthday and email

is this ok?

In login.php I have this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/html/catalog/login.php:111) in /home/content/html/catalog/includes/functions/general.php on line 36

Line 36 in general.php shows:

     header('Location: ' . $url);

Regards!!

#3 Stouffers3

  • Community Member
  • 49 posts
  • Real Name:Stephanie
  • Gender:Female
  • Location:CA

Posted 06 October 2010, 19:37

View PostPiLLaO, on 06 October 2010, 16:13, said:

Great contribution!!

I have an issue, gender on create_account.php is showed empty

Only shows: name, surname, birthday and email

is this ok?

In login.php I have this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/html/catalog/login.php:111) in /home/content/html/catalog/includes/functions/general.php on line 36

Line 36 in general.php shows:

     header('Location: ' . $url);

Regards!!

Can you post your login.php code
Stephanie D.

#4 PiLLaO

  • Community Member
  • 109 posts
  • Real Name:Gustavo

Posted 06 October 2010, 20:14

Hello!!

Thanks for your time, this is my login.php

<?php
/*
  $Id: login.php 1739 2007-12-20 00:52:16Z hpdl $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

//Facebook Connect
include 'includes/classes/facebook.php';
include_once "fbconnect.php";

//if user is logged in and session is valid.
if ($fbme){
    //collect some data using legacy api
    $param  =   array(
        'method'     => 'users.getinfo',
        'uids'       => $fbme['id'],
        'fields'     => 'birthday_date, locale',
        'callback'   => ''
    );

    try{
        $info           =   $facebook->api($param);
    }
    catch(Exception $o){
        error_log("Legacy Api Calling Error!");
    }
}
//end of Facebook Connect

  require('includes/application_top.php');

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
  if ($session_started == false) {
    tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

  $error = false;
  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
    $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
    $password = tep_db_prepare_input($HTTP_POST_VARS['password']);

// Check if email exists
//  $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) . "'");
// PWA BOF
// using guest_account with customers_email_address
    $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id, guest_account from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address). "' and guest_account='0'");
// PWA EOF
    if (!tep_db_num_rows($check_customer_query)) {
      $error = true;
    } else {
      $check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
      if (!tep_validate_password($password, $check_customer['customers_password'])) {
        $error = true;
      } else {
        if (SESSION_RECREATE == 'True') {
          tep_session_recreate();
        }

        $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'] . "'");
        $check_country = tep_db_fetch_array($check_country_query);

        $customer_id = $check_customer['customers_id'];
        $customer_default_address_id = $check_customer['customers_default_address_id'];
        $customer_first_name = $check_customer['customers_firstname'];
        $customer_country_id = $check_country['entry_country_id'];
        $customer_zone_id = $check_country['entry_zone_id'];
        tep_session_register('customer_id');
        tep_session_register('customer_default_address_id');
        tep_session_register('customer_first_name');
        tep_session_register('customer_country_id');
        tep_session_register('customer_zone_id');

// don't update login details if the master password was used - 
if (md5($password) != MASTER_PASS) {
        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 . "'");
}
        
// restore cart contents
        $cart->restore_contents();

// restore wishlist to sesssion
        $wishList->restore_wishlist();

        if (sizeof($navigation->snapshot) > 0) {
          $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
          $navigation->clear_snapshot();
          tep_redirect($origin_href);
        } else {
          tep_redirect(tep_href_link(FILENAME_DEFAULT));
        }
      }
    }
  }

  if ($error == true) {
    $messageStack->add('login', TEXT_LOGIN_ERROR);
  }

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', '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">
<script language="javascript"><!--
function session_win() {
  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();
}
//--></script>
  <script type="text/javascript" src="<?php echo DIR_WS_KEYBOARD;?>keyboard-<?php echo $language;?>.js" charset="UTF-8"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_KEYBOARD;?>keyboard.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- 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 //-->
<?php echo mws_header_main (''); ?>
    <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">
      <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_login.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>
<?php
  if ($messageStack->size('login') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('login'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }

  if ($cart->count_contents() > 0) {
?>
      <tr>
        <td class="smallText"><?php echo TEXT_VISITORS_CART; ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
  // PWA BOF
  if (defined('PURCHASE_WITHOUT_ACCOUNT') && ($cart->count_contents() > 0) && (PURCHASE_WITHOUT_ACCOUNT == 'ja' || PURCHASE_WITHOUT_ACCOUNT == 'yes')) {
?>
          <tr>
                <tr>
                  <td class="main" colspan="2"><b><?php echo TEXT_GUEST_INTRODUCTION_TITLE; ?></b></td>
                </tr>
            <td colspan="2" width="100%"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><div align="justify"><?php echo TEXT_GUEST_INTRODUCTION; ?></div></td>
                  </tr>
                  <tr>
                    <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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, 'guest=guest', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
<?php
  }
  // PWA EOF
?>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td class="main" width="48%" valign="top"><b><?php echo HEADING_NEW_CUSTOMER; ?></b></td>
            <td class="main" width="50%" valign="top"><b><?php echo HEADING_RETURNING_CUSTOMER; ?></b></td>
          </tr>
          <tr>
            <td width="48%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main" valign="top"><?php echo TEXT_NEW_CUSTOMER . '<br><br>' . TEXT_NEW_CUSTOMER_INTRODUCTION; ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
            <td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main" colspan="2"><?php echo TEXT_RETURNING_CUSTOMER; ?></td>
                  </tr>
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
                    <td class="main"><?php echo tep_draw_input_field('email_address'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><b><?php echo ENTRY_PASSWORD; ?></b></td>
                    <td class="main"><input type="password" name="password" class="keyboardInput" maxlength="40"></td>
                  </tr>
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="smallText" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'; ?></td>
                  </tr>
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td colspan="2"><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 align="right"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?>
                        <div id="fb-root"></div>
        <script type="text/javascript">
            window.fbAsyncInit = function() {
                FB.init({appId: '<?=$fbconfig['appid' ]?>', status: true, cookie: true, xfbml: true});

                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    // do something with response
                    login();
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    // do something with response
                    logout();
                });
            };
            (function() {
                var e = document.createElement('script');
                e.type = 'text/javascript';
                e.src = document.location.protocol +
                    '//connect.facebook.net/en_US/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
            }());

            function login(){
                document.location.href = "login.php";
            }

            function logout(){
                document.location.href = "logoff.php";
            }

</script>
    <p>
        <fb:login-button autologoutlink="true" perms="email,offline_access,user_birthday,user_location,user_work_history,user_religion_politics,user_relationships">Login with Facebook</fb:login-button>
    </p>
    <?php
    if($fbme>0){ 
        $fb_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 = '" . $fbme['email'] . "'");
        $fb_customer_check = tep_db_num_rows($fb_customer_query);
    
        if($fb_customer_check > 0){
            $fb_customer = tep_db_fetch_array($fb_customer_query);
            $fb_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$fb_customer['customers_id'] . "' and address_book_id = '" . (int)$fb_customer['customers_default_address_id'] . "'");
            $fb_country = tep_db_fetch_array($fb_country_query);
            $customer_id = $fb_customer['customers_id'];
            $customer_default_address_id = $fb_customer['customers_default_address_id'];
            $customer_first_name = $fb_customer['customers_firstname'];
            $customer_country_id = $fb_country['entry_country_id'];
            $customer_zone_id = $fb_country['entry_zone_id'];
            tep_session_register('customer_id');
            tep_session_register('customer_default_address_id');
            tep_session_register('customer_first_name');
            tep_session_register('customer_country_id');
            tep_session_register('customer_zone_id');
        
            tep_db_query("update " . TABLE_CUSTOMERS . " set fb_user_id = " . $fbme['id'] . " where customers_id = '" . (int)$customer_id . "'");
            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 . "'");
        
        
            //restore cart contents
            $cart->restore_contents();

            if (sizeof($navigation->snapshot) > 0) {
              $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
              $navigation->clear_snapshot();
              tep_redirect($origin_href);
            } else {
              tep_redirect(tep_href_link(FILENAME_DEFAULT));
            }
        }else{
            tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT));
         }
    }
    
    ?>
     </div>
                        </td>
                        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></form></td>
<?php echo mws_footer_main (''); ?>
<!-- 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 require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Regards!!!

#5 Stouffers3

  • Community Member
  • 49 posts
  • Real Name:Stephanie
  • Gender:Female
  • Location:CA

Posted 06 October 2010, 20:43

View PostPiLLaO, on 06 October 2010, 20:14, said:

Hello!!

Thanks for your time, this is my login.php

<?php
/*
  $Id: login.php 1739 2007-12-20 00:52:16Z hpdl $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

//Facebook Connect
include 'includes/classes/facebook.php';
include_once "fbconnect.php";

//if user is logged in and session is valid.
if ($fbme){
    //collect some data using legacy api
    $param  =   array(
        'method'     => 'users.getinfo',
        'uids'       => $fbme['id'],
        'fields'     => 'birthday_date, locale',
        'callback'   => ''
    );

    try{
        $info           =   $facebook->api($param);
    }
    catch(Exception $o){
        error_log("Legacy Api Calling Error!");
    }
}
//end of Facebook Connect

  require('includes/application_top.php');

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
  if ($session_started == false) {
    tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
  }

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

  $error = false;
  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
    $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
    $password = tep_db_prepare_input($HTTP_POST_VARS['password']);

// Check if email exists
//  $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) . "'");
// PWA BOF
// using guest_account with customers_email_address
    $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id, guest_account from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address). "' and guest_account='0'");
// PWA EOF
    if (!tep_db_num_rows($check_customer_query)) {
      $error = true;
    } else {
      $check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
      if (!tep_validate_password($password, $check_customer['customers_password'])) {
        $error = true;
      } else {
        if (SESSION_RECREATE == 'True') {
          tep_session_recreate();
        }

        $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'] . "'");
        $check_country = tep_db_fetch_array($check_country_query);

        $customer_id = $check_customer['customers_id'];
        $customer_default_address_id = $check_customer['customers_default_address_id'];
        $customer_first_name = $check_customer['customers_firstname'];
        $customer_country_id = $check_country['entry_country_id'];
        $customer_zone_id = $check_country['entry_zone_id'];
        tep_session_register('customer_id');
        tep_session_register('customer_default_address_id');
        tep_session_register('customer_first_name');
        tep_session_register('customer_country_id');
        tep_session_register('customer_zone_id');

// don't update login details if the master password was used - 
if (md5($password) != MASTER_PASS) {
        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 . "'");
}
        
// restore cart contents
        $cart->restore_contents();

// restore wishlist to sesssion
        $wishList->restore_wishlist();

        if (sizeof($navigation->snapshot) > 0) {
          $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
          $navigation->clear_snapshot();
          tep_redirect($origin_href);
        } else {
          tep_redirect(tep_href_link(FILENAME_DEFAULT));
        }
      }
    }
  }

  if ($error == true) {
    $messageStack->add('login', TEXT_LOGIN_ERROR);
  }

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', '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">
<script language="javascript"><!--
function session_win() {
  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();
}
//--></script>
  <script type="text/javascript" src="<?php echo DIR_WS_KEYBOARD;?>keyboard-<?php echo $language;?>.js" charset="UTF-8"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo DIR_WS_KEYBOARD;?>keyboard.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- 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 //-->
<?php echo mws_header_main (''); ?>
    <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">
      <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_login.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>
<?php
  if ($messageStack->size('login') > 0) {
?>
      <tr>
        <td><?php echo $messageStack->output('login'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }

  if ($cart->count_contents() > 0) {
?>
      <tr>
        <td class="smallText"><?php echo TEXT_VISITORS_CART; ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
  // PWA BOF
  if (defined('PURCHASE_WITHOUT_ACCOUNT') && ($cart->count_contents() > 0) && (PURCHASE_WITHOUT_ACCOUNT == 'ja' || PURCHASE_WITHOUT_ACCOUNT == 'yes')) {
?>
          <tr>
                <tr>
                  <td class="main" colspan="2"><b><?php echo TEXT_GUEST_INTRODUCTION_TITLE; ?></b></td>
                </tr>
            <td colspan="2" width="100%"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><div align="justify"><?php echo TEXT_GUEST_INTRODUCTION; ?></div></td>
                  </tr>
                  <tr>
                    <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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, 'guest=guest', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
<?php
  }
  // PWA EOF
?>
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
          <tr>
            <td class="main" width="48%" valign="top"><b><?php echo HEADING_NEW_CUSTOMER; ?></b></td>
            <td class="main" width="50%" valign="top"><b><?php echo HEADING_RETURNING_CUSTOMER; ?></b></td>
          </tr>
          <tr>
            <td width="48%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main" valign="top"><?php echo TEXT_NEW_CUSTOMER . '<br><br>' . TEXT_NEW_CUSTOMER_INTRODUCTION; ?></td>
                  </tr>
                  <tr>
                    <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
                        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
            <td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
              <tr class="infoBoxContents">
                <td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main" colspan="2"><?php echo TEXT_RETURNING_CUSTOMER; ?></td>
                  </tr>
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
                    <td class="main"><?php echo tep_draw_input_field('email_address'); ?></td>
                  </tr>
                  <tr>
                    <td class="main"><b><?php echo ENTRY_PASSWORD; ?></b></td>
                    <td class="main"><input type="password" name="password" class="keyboardInput" maxlength="40"></td>
                  </tr>
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td class="smallText" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'; ?></td>
                  </tr>
                  <tr>
                    <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
                  </tr>
                  <tr>
                    <td colspan="2"><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 align="right"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?>
                        <div id="fb-root"></div>
        <script type="text/javascript">
            window.fbAsyncInit = function() {
                FB.init({appId: '<?=$fbconfig['appid' ]?>', status: true, cookie: true, xfbml: true});

                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    // do something with response
                    login();
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    // do something with response
                    logout();
                });
            };
            (function() {
                var e = document.createElement('script');
                e.type = 'text/javascript';
                e.src = document.location.protocol +
                    '//connect.facebook.net/en_US/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
            }());

            function login(){
                document.location.href = "login.php";
            }

            function logout(){
                document.location.href = "logoff.php";
            }

</script>
    <p>
        <fb:login-button autologoutlink="true" perms="email,offline_access,user_birthday,user_location,user_work_history,user_religion_politics,user_relationships">Login with Facebook</fb:login-button>
    </p>
    <?php
    if($fbme>0){ 
        $fb_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 = '" . $fbme['email'] . "'");
        $fb_customer_check = tep_db_num_rows($fb_customer_query);
    
        if($fb_customer_check > 0){
            $fb_customer = tep_db_fetch_array($fb_customer_query);
            $fb_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$fb_customer['customers_id'] . "' and address_book_id = '" . (int)$fb_customer['customers_default_address_id'] . "'");
            $fb_country = tep_db_fetch_array($fb_country_query);
            $customer_id = $fb_customer['customers_id'];
            $customer_default_address_id = $fb_customer['customers_default_address_id'];
            $customer_first_name = $fb_customer['customers_firstname'];
            $customer_country_id = $fb_country['entry_country_id'];
            $customer_zone_id = $fb_country['entry_zone_id'];
            tep_session_register('customer_id');
            tep_session_register('customer_default_address_id');
            tep_session_register('customer_first_name');
            tep_session_register('customer_country_id');
            tep_session_register('customer_zone_id');
        
            tep_db_query("update " . TABLE_CUSTOMERS . " set fb_user_id = " . $fbme['id'] . " where customers_id = '" . (int)$customer_id . "'");
            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 . "'");
        
        
            //restore cart contents
            $cart->restore_contents();

            if (sizeof($navigation->snapshot) > 0) {
              $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
              $navigation->clear_snapshot();
              tep_redirect($origin_href);
            } else {
              tep_redirect(tep_href_link(FILENAME_DEFAULT));
            }
        }else{
            tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT));
         }
    }
    
    ?>
     </div>
                        </td>
                        <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></form></td>
<?php echo mws_footer_main (''); ?>
<!-- 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 require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Regards!!!

You need to delete any whitespace you may have before the <?php in your files
Stephanie D.

#6 TechHA

  • Community Member
  • 1 posts
  • Real Name:Bryan

Posted 07 October 2010, 02:45

Hi, this looks like a great addition. Is there any way to get this to work with the 'Separate Pricing per Customer' add-on?

Thanks for your time.

#7 noppie

  • Community Member
  • 306 posts
  • Real Name:Naomi
  • Gender:Female

Posted 07 October 2010, 05:14

Hello
I load this and on my login page I get this instead of a facebook button

function logout(){ document.location.href = "logoff.php"; }

Login with Facebook

below is my login.php
thank you
Noppie

Quote

<?php
/*
$Id: login.php 1739 2007-12-20 00:52:16Z hpdl $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/
//Facebook Connect

include 'includes/classes/facebook.php';

include_once "fbconnect.php";



//if user is logged in and session is valid.

if ($fbme){

//collect some data using legacy api

$param = array(

'method' => 'users.getinfo',

'uids' => $fbme['id'],

'fields' => 'birthday_date, locale',

'callback' => ''

);



try{

$info = $facebook->api($param);

}

catch(Exception $o){

error_log("Legacy Api Calling Error!");

}

}

//end of Facebook Connect
require('includes/application_top.php');

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)
if ($session_started == false) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
}

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

$error = false;
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);

// Check if email exists
$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) . "'");
if (!tep_db_num_rows($check_customer_query)) {
$error = true;
} else {
$check_customer = tep_db_fetch_array($check_customer_query);
// Check that password is good
if (!tep_validate_password($password, $check_customer['customers_password'])) {
$error = true;
} else {
if (SESSION_RECREATE == 'True') {
tep_session_recreate();
}

$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'] . "'");
$check_country = tep_db_fetch_array($check_country_query);

$customer_id = $check_customer['customers_id'];
$customer_default_address_id = $check_customer['customers_default_address_id'];
$customer_first_name = $check_customer['customers_firstname'];
$customer_country_id = $check_country['entry_country_id'];
$customer_zone_id = $check_country['entry_zone_id'];
tep_session_register('customer_id');
tep_session_register('customer_default_address_id');
tep_session_register('customer_first_name');
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');

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 . "'");

// restore cart contents
$cart->restore_contents();

if (sizeof($navigation->snapshot) > 0) {
$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
$navigation->clear_snapshot();
tep_redirect($origin_href);
} else {
tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
}
}
}

if ($error == true) {
$messageStack->add('login', TEXT_LOGIN_ERROR);
}

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', '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">
<script language="javascript"><!--
function session_win() {
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();
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- 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"><?php echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?><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_login.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>
<?php
if ($messageStack->size('login') > 0) {
?>
<tr>
<td><?php echo $messageStack->output('login'); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}

if ($cart->count_contents() > 0) {
?>
<tr>
<td class="smallText"><?php echo TEXT_VISITORS_CART; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main" width="50%" valign="top"><b><?php echo HEADING_NEW_CUSTOMER; ?></b></td>
<td class="main" width="50%" valign="top"><b><?php echo HEADING_RETURNING_CUSTOMER; ?></b></td>
</tr>
<tr>
<td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main" valign="top"><?php echo TEXT_NEW_CUSTOMER . '<br><br>' . TEXT_NEW_CUSTOMER_INTRODUCTION; ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<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 align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="50%" height="100%" valign="top"><table border="0" width="100%" height="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main" colspan="2"><?php echo TEXT_RETURNING_CUSTOMER; ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>
<td class="main"><?php echo tep_draw_input_field('email_address'); ?></td>
</tr>
<tr>
<td class="main"><b><?php echo ENTRY_PASSWORD; ?></b></td>
<td class="main"><?php echo tep_draw_password_field('password'); ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td class="smallText" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . TEXT_PASSWORD_FORGOTTEN . '</a>'; ?></td>
</tr>
<tr>
<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<tr>
<td colspan="2"><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 align="right"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td>
<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
<td width="10"></td> function logout(){

document.location.href = "logoff.php";

}
</script>

<p>

<fb:login-button autologoutlink="true" perms="email,offline_access,user_birthday,user_location,user_work_history,user_religion_politics,user_relationships">Login with Facebook</fb:login-button>

</p>

<?php

if($fbme>0){

$fb_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 = '" . $fbme['email'] . "'");

$fb_customer_check = tep_db_num_rows($fb_customer_query);



if($fb_customer_check > 0){

$fb_customer = tep_db_fetch_array($fb_customer_query);

$fb_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$fb_customer['customers_id'] . "' and address_book_id = '" . (int)$fb_customer['customers_default_address_id'] . "'");

$fb_country = tep_db_fetch_array($fb_country_query);

$customer_id = $fb_customer['customers_id'];

$customer_default_address_id = $fb_customer['customers_default_address_id'];

$customer_first_name = $fb_customer['customers_firstname'];

$customer_country_id = $fb_country['entry_country_id'];

$customer_zone_id = $fb_country['entry_zone_id'];

tep_session_register('customer_id');

tep_session_register('customer_default_address_id');

tep_session_register('customer_first_name');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');



tep_db_query("update " . TABLE_CUSTOMERS . " set fb_user_id = " . $fbme['id'] . " where customers_id = '" . (int)$customer_id . "'");

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 . "'");





//restore cart contents

$cart->restore_contents();



if (sizeof($navigation->snapshot) > 0) {

$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);

$navigation->clear_snapshot();

tep_redirect($origin_href);

} else {

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

}else{

tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT));

}

}



?> </tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
// *** BEGIN GOOGLE CHECKOUT ***
if (defined('MODULE_PAYMENT_GOOGLECHECKOUT_STATUS') && MODULE_PAYMENT_GOOGLECHECKOUT_STATUS == 'True') {
include_once('googlecheckout/gcheckout.php');
}
// *** END GOOGLE CHECKOUT ***
?>
<?php
// AMAZON CODE -> START
require_once("checkout_by_amazon/checkout_by_amazon_util_dao.php");
$utilDao = new UtilDAO();
$utilDao->printButton();
// AMAZON CODE -> END
?>

</td>
</tr>
</table></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 require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
</tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Peace is possible.. Please don't give up.

"War is --the old betraying the young"

#8 PiLLaO

  • Community Member
  • 109 posts
  • Real Name:Gustavo

Posted 07 October 2010, 06:00

View PostStouffers3, on 06 October 2010, 20:43, said:

You need to delete any whitespace you may have before the <?php in your files
Hello!!

I deleted all whitespaces before <?php and ?> and error is still shown

I installed the contribution on a fresh install of commerce, and the error is showed also

[img]http://img839.imageshack.us/img839/2100/facebookconnect.png[/img]

Regards!!

#9 noppie

  • Community Member
  • 306 posts
  • Real Name:Naomi
  • Gender:Female

Posted 07 October 2010, 06:14

check your
includes/database.php
includes/filesnames.php
includes/languages/english.php

made sure that the last line in this files are not white space.

and maybe the files login.php
logout.php
create_count.php
Peace is possible.. Please don't give up.

"War is --the old betraying the young"

#10 PiLLaO

  • Community Member
  • 109 posts
  • Real Name:Gustavo

Posted 07 October 2010, 06:52

View Postnoppie, on 07 October 2010, 06:14, said:

check your
includes/database.php
includes/filesnames.php
includes/languages/english.php

made sure that the last line in this files are not white space.

and maybe the files login.php
logout.php
create_count.php
Thanks for your answer

I'll uninstall the contribution and search all whitespaces on my files.

Before install this contribution I never have that error

Thanks for the support :) :)

#11 Stouffers3

  • Community Member
  • 49 posts
  • Real Name:Stephanie
  • Gender:Female
  • Location:CA

Posted 07 October 2010, 08:10

View Postnoppie, on 07 October 2010, 05:14, said:

Hello
I load this and on my login page I get this instead of a facebook button

function logout(){ document.location.href = "logoff.php"; }

Login with Facebook

below is my login.php
thank you
Noppie

Your missing some code in that file. Check the instructions again for the login.php file
Stephanie D.

#12 PiLLaO

  • Community Member
  • 109 posts
  • Real Name:Gustavo

Posted 07 October 2010, 08:16

Hi again!!

Why I can't edit my previous posts? :S

Uhmmm.... new files/includes/classes/facebook.php haven't got ?> at the end of the file, is this correct?

And... the line 111 in login.php

<html <?php echo HTML_PARAMS; ?>>
is a original oscommerce code, I not have idea how to delete here whitespaces.

Regards!!

#13 noppie

  • Community Member
  • 306 posts
  • Real Name:Naomi
  • Gender:Female

Posted 07 October 2010, 08:38

it is the white space at the end of the file
after the ?>
noppie

View PostPiLLaO, on 07 October 2010, 06:52, said:

Thanks for your answer

I'll uninstall the contribution and search all whitespaces on my files.

Before install this contribution I never have that error

Thanks for the support :) :)

Peace is possible.. Please don't give up.

"War is --the old betraying the young"

#14 acidvertigo

  • Community Member
  • 140 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 07 October 2010, 10:33

View Postnoppie, on 07 October 2010, 08:38, said:

it is the white space at the end of the file
after the ?>
noppie

same problem here

Warning: Cannot modify header information - headers already sent by (output started at /web/htdocs/www.mysite.com/home/catalog/login.php:122) in /web/htdocs/www.mysite.com/home/catalog/includes/functions/general.php on line 47

No ending ?> in the facebook.php file

#15 diy

  • Community Member
  • 352 posts
  • Real Name:kosmas
  • Gender:Male

Posted 07 October 2010, 13:09

I am getting thiw error message

Uncaught CurlException: 1: Protocol https not supported or disabled in libcurl thrown in /home/a6243178/public_html/catalog/includes/classes/facebook.php on line 615

#16 acidvertigo

  • Community Member
  • 140 posts
  • Real Name:Luca
  • Gender:Male
  • Location:Roma

Posted 07 October 2010, 13:42

View Postdiy, on 07 October 2010, 13:09, said:

I am getting thiw error message

Uncaught CurlException: 1: Protocol https not supported or disabled in libcurl thrown in /home/a6243178/public_html/catalog/includes/classes/facebook.php on line 615

seems that you have not https libcurl enabled on your server

Edited by acidvertigo, 07 October 2010, 13:43.


#17 andes1

  • Community Member
  • 181 posts
  • Real Name:andrea pataquiva diaz

Posted 07 October 2010, 15:35

ON VANILLA VERSION v2.2 RC 2a

when you already on facebook session on you browser an error appears on login.php

Warning: Cannot modify header information - headers already sent by (output started at login.php: line number…. meaing this code: <html <?php echo HTML_PARAMS; ?>>

includes/functions/general.php on line 33 meaing this code: header('Location: ' . $url);

Also above the page appear dir="LTR" lang="en" >

When you are not on facebook session no error appear. But still appear dir="LTR" lang="en" >

When you are logged on your store, and hit the FB login button, you logoff from FB.


Creating an account works good.

#18 Stouffers3

  • Community Member
  • 49 posts
  • Real Name:Stephanie
  • Gender:Female
  • Location:CA

Posted 07 October 2010, 16:49

View Postandes1, on 07 October 2010, 15:35, said:

ON VANILLA VERSION v2.2 RC 2a

when you already on facebook session on you browser an error appears on login.php

Warning: Cannot modify header information - headers already sent by (output started at login.php: line number…. meaing this code: <html <?php echo HTML_PARAMS; ?>>

includes/functions/general.php on line 33 meaing this code: header('Location: ' . $url);

Also above the page appear dir="LTR" lang="en" >

When you are not on facebook session no error appear. But still appear dir="LTR" lang="en" >

When you are logged on your store, and hit the FB login button, you logoff from FB.


Creating an account works good.

I'm in the process of installing a vanilla version for testing of this. Hope to have it up later today
Stephanie D.

#19 andes1

  • Community Member
  • 181 posts
  • Real Name:andrea pataquiva diaz

Posted 07 October 2010, 17:00

View PostStouffers3, on 07 October 2010, 16:49, said:

I'm in the process of installing a vanilla version for testing of this. Hope to have it up later today

thanks :rolleyes:

#20 noppie

  • Community Member
  • 306 posts
  • Real Name:Naomi
  • Gender:Female

Posted 07 October 2010, 17:06

View PostStouffers3, on 07 October 2010, 08:10, said:

Your missing some code in that file. Check the instructions again for the login.php file



that is what it was working now. thank you so much for doing this..
this is exciting.
Noppie
Peace is possible.. Please don't give up.

"War is --the old betraying the young"