Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Facebook Connect Support Thread


Guest

Recommended Posts

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!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

<?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'); ?>

Link to comment
Share on other sites

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

 

facebookconnect.png

 

Regards!!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :) :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!!

Link to comment
Share on other sites

it is the white space at the end of the file

after the ?>

noppie

 

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 :) :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Using php4, and oscommerce 2.2 (modified) login.php is pretty much one of the files I have not touched for modification.

 

I get an error on this line

Parse error: syntax error, unexpected '{' in /htdocs/catalog/login-fb.php on line 28

   try  {
       $info           =   $facebook->api($param);
   }

 

Line 28 is try {

 

If i put the php5 addtypes in the .htaccess, the whole website stops working.

 

 

I do note, that this contrib uses <div> and not tables... which my osc 2.2 seems to be.

 

 

Any ideas?

A signature is something that reflects its user. - The dictionary

 

The question is not, 'to code, or not to code'

the question is, 'if we do not code, are we really alive?'

-- anonymous

Link to comment
Share on other sites

tryed the new version without <div>

 

still get a blank page.

 

login.php without the top part works, but only text no facebook image.

 

What did you guys fill in at facebook at the site url ? youesite.com or yoursite.com/catalog ?

 

and what do you fill in at fbconnect.php at base_url ?

 

this is my login.php:

 

<?php

/*

$Id: login.php,v 1.80 2003/06/05 23:28:24 hpdl Exp $

 

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; ?>">

<?php

# cDynamic Meta Tags

/*<title><?php echo TITLE; ?>*/

require(DIR_WS_INCLUDES . 'meta_tags.php');

#

?>

<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.jpg', 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>

</tr>

<tr>

<td>

<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";

}

 

function createAccount(){

document.location.href = "create_account.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 {

echo "<script type='text/javascript'>document.location.href = '".FILENAME_DEFAULT."';</script>";

}

}else{

echo "<script type='text/javascript'>document.location.href = '".FILENAME_CREATE_ACCOUNT."';</script>";

}

}

 

?>

</td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

</table></form></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'); ?>

Link to comment
Share on other sites

New files are up : http://addons.oscommerce.com/info/7577

 

Tested and works with vanilla version (No divs)

 

Hope this helps everyone!

 

 

wait, quick question, do I need to have the facebook php libs in the directory system for this to work?

A signature is something that reflects its user. - The dictionary

 

The question is not, 'to code, or not to code'

the question is, 'if we do not code, are we really alive?'

-- anonymous

Link to comment
Share on other sites

wait, quick question, do I need to have the facebook php libs in the directory system for this to work?

 

FUDGE! wrong file got uploaded!

 

IN login.php

 

change:

 

tep_redirect($origin_href);

 

to:

 

echo "<script type='text/javascript'>document.location.href = '".$origin_href."';</script>";

 

In your includes/classes folder you should have the facebook.php file

In your root (store) folder you should have fbconnect.php and xd_receiver.htm

 

Those are all of the files you need.

 

This works on vanilla install.

 

There is no base_url in the new fbconnect.php file.

 

In the facebook app you put your site url (mydomain.com)

 

EDIT: The new instructions are uploaded

Edited by Stouffers3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...