I'm new to web development, still a beginner.
I unsure on how to code for session calling the FaceBook if there any. However, I've added this at all pages which I want my facebook to be loaded. I believe it is the Facebook SDK. For example, I add this code in my register.php and login.php.
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $config['appId']; ?>',
xfbml : true,
version : 'v2.4'
});
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
I also added this in my config.php which I believe it is Config for FB Login.
$config = array();
However, every time I tried to click on the Facebook button in my login.php, there will be error such that
Fatal error: Call to a member function getLoginUrl() on a non-object in C:\wamp\www\sggrocer\loginFb.php on line 13
loginFB.php
<?php
session_start();
include('ajax-helper/config.php');
$_SESSION[$PROJECT_NAME . '-loginFb'] = true;
unset($_SESSION[$PROJECT_NAME . '-logout']);
$params = array(
'scope' => 'email, user_birthday',
'redirect_uri' => $base_url . "http://localhost/sggrocer/",
);
$loginUrl = $facebook->getLoginUrl($params);
header('Location:' . $loginUrl);
?>
This is my login.php: https://jsfiddle.net/Snurainiyakob/V4u5X/872/
And the UI as follows: enter image description here