I saw many post how to add Facebook connect functionality into a website but i could not see how to implement it to a website with an existing user database.

would you please help me to make this work, facebook connect functionality?
i am sure it will help a lot of people.

my site needs below from the users when they are registering

User Name 	: 	
Password: 	: 	
Password Confirmation 	: 	
Password 	: 	
Secret Question 	: 	
Response 	: 	
Personal Information
Your name 	: 	
Surname 	: 	
Date of Birth 	: 	
Gender 	: 	
Contact Information
E-Mail 	: 	
City 	: 	
Country 	: 	

Security Code (like captcha)

Recommended Answers

All 8 Replies

are you looking for them to login or just use there facebook login if there logged in

if you want to use the login if they are already logged into facebook you have to have the php sdk installed and you run

$facebook_user = $facebook->getUser();

i am actually looking for a whole instruction how to do it.
but maybe i should not be looking here? is that ok?

thank you

when the user logs in to facebook you can get info like email
address and name you can set up a script to verify this info in your current database and allow him to login or basically check to see if he exisits then log him in as that user or setup another table and store the fbuser name and check for that to try to integrate the

hi, happy new year to all

i am not a programmer and I have been looking but i dont see any examples of how i can
"set up a script to verify this info in your current database and allow him to login or basically check to see if he exisits then log him in as that user or setup another table and store the fbuser name and check for"

when the user logs in to facebook you can get info like email
address and name you can set up a script to verify this info in your current database and allow him to login or basically check to see if he exisits then log him in as that user or setup another table and store the fbuser name and check for that to try to integrate the

Hi,

What he was referring you was these codes.

<?php

define('YOUR_APP_ID', 'YOUR APP ID');

//uses the PHP SDK.  Download from https://github.com/facebook/php-sdk
require 'facebook.php';

$facebook = new Facebook(array(
  'appId'  => YOUR_APP_ID,
  'secret' => 'YOUR APP SECRET',
));

$userId = $facebook->getUser();

?>

<html>
  <body>
    <?php if ($userId) { 
      $userInfo = $facebook->api('/' + $userId); ?>
      Welcome <?= $userInfo['name'] ?>
    <?php } else { ?>
    <div id="fb-root"></div>
    <fb:login-button></fb:login-button>
    <?php } ?>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : '<?= YOUR_APP_ID ?>',
          status     : true, 
          cookie     : true,
          xfbml      : true,
          oauth      : true,
        });

        FB.Event.subscribe('auth.login', function(response) {
          window.location.reload();
        });
      };

      (function(d){
         var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
         js = d.createElement('script'); js.id = id; js.async = true;
         js.src = "//connect.facebook.net/en_US/all.js";
         d.getElementsByTagName('head')[0].appendChild(js);
       }(document));
    </script>
  </body>
</html>

First, you need to register your app ID in facebook site, and then download this file here https://github.com/facebook/php-sdk.

Second, if you have not program anything, maybe this is the right time to practice on something a lot smaller. Pretty soon, you maybe wanting to do it with twitter oauth, where the process will be more tedious than facebook.

Third, just try to write something so that people can guide you, but they will not write the codes for you. However, if you really don't know where to start, try reading and downloading the script from this site http://thinkdiff.net/facebook/php-sdk-3-0-graph-api-base-facebook-connect-tutorial/ .

Fourth, try to understand how the script works. As you become familiar with the script, your confidence will also grow and it is time to experiment integrating it to your site's database.

Good luck and happy coding... :)

hi, first of all thank you for raking time to explain
I read that tutorial and some other ones many many times, i actually created an application using one of his other tutorial.
but what i cannot find is how will fb login to my web site, it logins to facebook get the the permission from facebook i even found that i can insert the info to database but nothing about how will facebook actually login to my site

thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.