Бальзам account fb connect php. Это правильный способ сделать FB Connect? Регистрация приложения в фб

login api (3)

Я считаю, что вам нужно вернуть false, чтобы предотвратить нормальное поведение ссылки. Что касается перенаправления, я делаю это на своем сайте:

Logout

Я не совсем уверен, почему ваш logoutAndRedirect не работает, но этот пост может пролить свет: http://forum.developers.facebook.com/viewtopic.php?id=38549 .

Моя строка инициализации:

function initFB (){ FB_RequireFeatures ([ "XFBML" ], function (){ FB . init ("xxxx" , "xd_receiver.htm" );});}

Моя выход из системы:

Log Out

У меня есть действующий сеанс в моем webapp и действительный сеанс Facebook, потому что мой пользователь показывает pic-шоу.

Единственный способ, с помощью которого я могу заставить Facebook правильно выйти из этой функции или.logout (), - это бросить

return false ;

в смесь, так:

Log Out

Это, однако, все равно не перенаправляет нигде. Приложение просто сидит там после выхода из Facebook, поэтому сеанс сайта все еще живет и сломан.

Это чертовски расстраивает, поэтому, если кто-нибудь может изложить, почему это не будет перенаправлено, я все уши.

Находила функция, которую кто-то написал, чтобы запустить выход в Facebook и перенаправить правильно. Это прекрасно работает.

Javascript code : function fBlogout (){ try { FB . Connect . ifUserConnected (function (){ FB . Connect . logoutAndRedirect (); }, "http://fullurl.com/account/logout" ); } catch (e ){ location . href = "http://fullurl.com/account/logout" ; } } HTML Link : < a href = "#" onclick = "FBlogout(); return false;" > Log Out PHP code for logout : $facebook -> expire_session (); $facebook -> logout (MAIN_SITE_URL );

Это должно работать почти во всех браузерах:

Var xhr=new XMLHttpRequest(); xhr.onload=function(){ console.log(xhr.responseText); } xhr.open("GET","https://12Me21.github.io/test.txt"); xhr.send();

Кроме того, есть новый API Fetch:

Fetch("https://12Me21.github.io/test.txt") .then(response => response.text()) .then(text => console.log(text))

Nowadays the web users are not interested in filling a big form for registration on the website. Short registration process helps to get more subscribers to your website. Login with Facebook is a quick and powerful way to integrate registration and login system on the website. Facebook is a most popular social network and most of the users have a Facebook account. Facebook Login allows users to sign into your website using their Facebook account credentials without sign up on your website.

PHP SDK allows accessing the Facebook API from the web application. You can easily implement the Login with Facebook account using Facebook SDK for PHP. In this tutorial will show how you can implement user login and registration system with Facebook using PHP and store the user profile data into the MySQL database. Our example Facebook Login script uses Facebook PHP SDK v5 with Facebook Graph API to build Facebook Login system with PHP and MySQL.

To get started with the latest version of Facebook SDK v5.x , make sure your system meets the following requirements.

  • Navigate to the Settings » Basic page.
  • Navigate to the Facebook Login » Settings page.
    • In the Valid OAuth Redirect URIs field, enter the Redirect URL.
    • Click the Save Changes .
  • Go to the Settings » Basic page, note the App ID and App Secret . This App ID and App secret allow you to access the Facebook APIs.

    Note that: The App ID and App secret need to be specified in the script at the time of Facebook API call. Also, the Valid OAuth Redirect URIs must be matched with the Redirect URL that specified in the script.

    Get the Profile Link and Gender

    To retrieve the user’s Facebook timeline link and gender, you need to submit a request for user_link and user_gender permissions.


    Once the review process is completed and approved by the Facebook, you will be able to get the user profile link and gender from the Facebook Graph API.

    Do you want a detailed guide on Facebook App creation? Go through this guide to .

    Create Database Table

    To store the user’s profile information from Facebook, a table needs to be created in the database. The following SQL creates a users table with some basic fields in the MySQL database to hold the Facebook account information.

    CREATE TABLE `users` (`id` int (11 ) NOT NULL AUTO_INCREMENT, `oauth_provider` enum("" ,"facebook" ,"google" ,"twitter" ) COLLATE utf8_unicode_ci NOT NULL , `oauth_uid` varchar (50 ) COLLATE utf8_unicode_ci NOT NULL , `first_name` varchar (25 ) COLLATE utf8_unicode_ci NOT NULL , `last_name` varchar (25 ) COLLATE utf8_unicode_ci NOT NULL , `email` varchar (25 ) COLLATE utf8_unicode_ci NOT NULL , `gender` varchar (10 ) COLLATE utf8_unicode_ci DEFAULT NULL , `picture` varchar (200 ) COLLATE utf8_unicode_ci NOT NULL , `link` varchar (100 ) COLLATE utf8_unicode_ci NOT NULL , `created` datetime NOT NULL , `modified` datetime NOT NULL , PRIMARY KEY (`id` )) ENGINE =InnoDB DEFAULT CHARSET =utf8 COLLATE =utf8_unicode_ci; Facebook SDK for PHP

    The facebook-php-graph-sdk/ directory contains the latest version (v5) of Facebook SDK for PHP. You don’t need to download it separately, all the required files of Facebook PHP SDK v5 are included in our Facebook Login PHP source code.

    User Class (User.class.php)

    The User class handles the database related operations (connect, insert, and update) using PHP and MySQL. It helps to connect to the database and insert/update Facebook account data in the users table.

    • __construct() – Connect to the MySQL database.
    • checkUser() – Insert or update the user profile data based on the OAuth provider and ID. Returns the user’s account data as an array.