20 comments on “Adding Facebook Login feature to any Website
  1. bro i am getting errors, at my localhost
    Warning: Header may not contain more than a single header, new line detected. in C:\xampp\htdocs\fb\login_facebook.php on line 24

  2. Spot on with this write-up, I truly believe this site needs a great deal more attention. I’ll probably be back again to read more, thanks for the info!

  3. really nice tutorial and worked successfully.
    I want to login directly to my site through facebook and i dont want to check database.for this what i do in this code.

    • Check on Line 66:
      authenticate_user($data[“email”]);

      remove this line and replace it with:
      $access_token = get_access_token();
      $userData = getData($access_token);

      Now you have a variable named $userData with the user’s Facebook ID, Email Address and Name, use this information to instantly signup or temporarily login the user into your site……

    • Sir, rest assured the blog’s images are working fine. Modify your Browser settings, check your internet connection, or at least clear your cache and reload the page(Ctrl+F5).

  4. siri am getting errors, at my localhost
    its cant redirect on facebook page
    this is a my login facebook.php code
    query(“SELECT id FROM users WHERE email='”.$email.”‘”);
    $array = $query->fetch_assoc();
    if($query->num_rows==1){
    $_SESSION[“user”] = $array[“id”];
    header(“location: index.php”);
    }else{
    header(“location: index.php”);
    }
    }

    if(isset($_REQUEST[“error”])){
    header(“location: index.php”);
    }elseif(isset($_REQUEST[“code”])){

    if(isset($_REQUEST[“state”]) && $_REQUEST[“state”]==$_SESSION[“state”]){
    $access_token = get_access_token();
    $data = getData($access_token);

    authenticate_user($data[“email”]);
    }

    }else{
    dialog();
    }
    ?>
    pls help me

Leave a Reply

Your email address will not be published. Required fields are marked *