gjferrando, on 29 December 2011, 13:30, said:
Si, me pasaba lo mismo con Internet Explorer y Mozilla Firefox por eso le agregué el setTimeout('document.location.href = "create_account.php"', 0);
Cuál navegador usas..?
Posted 30 December 2011, 08:52
gjferrando, on 29 December 2011, 13:30, said:
Posted 30 December 2011, 09:46
juanmasi1, on 30 December 2011, 08:52, said:
Posted 30 December 2011, 17:34
JenniferJordan, on 30 July 2011, 17:33, said:
<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 class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
Posted 02 January 2012, 22:14
addeaz, on 21 December 2011, 09:45, said:
Posted 10 January 2012, 21:46
Edited by kshop, 10 January 2012, 21:47.
Posted 19 January 2012, 04:03
Posted 21 January 2012, 09:48
kshop, on 10 January 2012, 21:46, said:
<?php
//Facebook Connect
require('includes/application_top.php');
define('FILENAME_DO_FBLOGIN','dofblogin.php');//this file
// If user is logged in and session is valid.
if(!isset($_GET["code"]))
{
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
$url="https://graph.facebook.com/oauth/authorize?client_id=".$fbconfig['appid' ]."&redirect_uri=".tep_href_link(FILENAME_DO_FBLOGIN)."&state="
. $_SESSION['state'];
header("location:".$url);
exit();
}
if(isset($_GET["code"]))
{
if($_REQUEST['state'] == $_SESSION['state']) {
$token_url ="https://graph.facebook.com/oauth/access_token?client_id="
. $fbconfig['appid' ] . "&redirect_uri=" . tep_href_link(FILENAME_DO_FBLOGIN)
. "&client_secret=" . $fbconfig['secret']
. "&code=" . $_GET['code'];
$access_token = file_get_contents($token_url);
$_SESSION["access_token"]=$access_token;
//$_SESSION["steps_facebook"]="authorized";
$graph_url = "https://graph.facebook.com/me?" .$_SESSION["access_token"];
$results = json_decode(file_get_contents($graph_url));
if(isset($results->id))
{ //user is logged in into FB
$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 = '" . $results->email . "'");
$fb_customer_check = tep_db_num_rows($fb_customer_query);
if($fb_customer_check <= 0){
//check for id, email may not be available in case the user has changed FB privacy settings
$fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where fb_user_id = '" . $results->id . "'");
$fb_customer_check = tep_db_num_rows($fb_customer_query);
}
// if user is logged in, set current user's login FB login (merge)
if (($fb_customer_check <= 0) and (!empty($_SESSION['customer_id']))){
$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_id = '" . (int)$_SESSION['customer_id'] . "'");
$fb_customer_check = tep_db_num_rows($fb_customer_query);
}
if ($fb_customer_check > 0){
if (SESSION_RECREATE == 'True') {
tep_session_recreate();
}
$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_default_address_id = $fb_customer['customers_default_address_id'];
global $customer_first_name;
$customer_first_name = $fb_customer['customers_firstname'];
$customer_country_id = $fb_country['entry_country_id'];
$customer_zone_id = $fb_country['entry_zone_id'];
$_SESSION['customer_id']=$fb_customer['customers_id'];
$_SESSION['customer_default_address_id']=$customer_default_address_id;
$_SESSION['customer_first_name']=$customer_first_name;
$_SESSION['customer_country_id']=$customer_country_id;
$_SESSION['customer_zone_id']=$customer_zone_id;
tep_db_query("update " . TABLE_CUSTOMERS . " set fb_user_id = " . $results->id . " where customers_id = '" . (int)$fb_customer['customers_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)$fb_customer['customers_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{
//fb user not found in customers table
$account=array();
$account['customers_nickname']=$results->first_name;
$account['customers_firstname']=$results->first_name;
$account['customers_lastname']=$results->last_name;
/*if (isset($results->gender)){
if ($results->gender=='female'){
$account['customers_gender']='f';
} else {
$account['customers_gender']='m';
}
} else {
$account['customers_gender']='m';
}
*/
if (isset($results->email)) {
$account['customers_email_address']=$results->email;
} else {
$account['customers_email_address']=tep_create_random_value(10).'@[member='unknown'].addr';
}
$newpass = tep_create_random_value(8);
$crypted_password = tep_encrypt_password($newpass);
$account['customers_password']=$crypted_password;
$account['fb_user_id']=$results->id;
$account['customers_default_address_id']=1;
tep_db_perform(TABLE_CUSTOMERS,$account);
$fb_customer_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where fb_user_id = '" . $results->id . "'");
$fb_customer = tep_db_fetch_array($fb_customer_query);
$_SESSION['customer_id']=$fb_customer['customers_id'];
$_SESSION['customer_default_address_id']=1;
tep_redirect(tep_href_link(FILENAME_ACCOUNT_EDIT));//account_edit
}
}//results->id
} else {
echo("The state does not match. You may be a victim of CSRF.");
}
}//code
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Posted 23 January 2012, 02:32
Posted 23 January 2012, 18:16
kshop, on 21 January 2012, 09:48, said:
Posted 23 January 2012, 21:35
rabon33, on 23 January 2012, 18:16, said:
<tr>
<td width="50%" align="right" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
<td width="50%" align="right" valign="top"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td>
</tr>
<tr>
<td>
</td>
<td width="50%" align="right" valign="top">
<?php
echo '<a href="' . tep_href_link(FILENAME_DO_FBLOGIN, '', 'SSL') . '">' . tep_image_button('button_fb_login.png', IMAGE_BUTTON_LOGIN) . '</a>';
?>
</td>
</tr>
create_account.php:
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('account_edit', tep_href_link(FILENAME_CREATE_ACCOUNT_PROCESS, '', 'SSL'), 'post', 'onSubmit="return check_form();"') . tep_draw_hidden_field('action', 'process'); ?><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_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<?php
echo '<a href="' . tep_href_link(FILENAME_DO_FBLOGIN, '', 'SSL') . '">' . tep_image_button('button_fb_login.png', IMAGE_BUTTON_LOGIN) . '</a>';
?>
</td>
</tr>
the definition define('FILENAME_DO_FBLOGIN','dofblogin.php'); should be moved to includes/filenames.php//$cart->restore_contents();
Edited by kshop, 23 January 2012, 21:44.
Posted 23 January 2012, 21:54
Edited by kshop, 23 January 2012, 21:57.
Posted 25 January 2012, 01:25
kshop, on 23 January 2012, 21:54, said:
Posted 03 February 2012, 06:15
Posted 10 February 2012, 17:20
Posted 24 March 2012, 13:46