MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/imenso.co/demo/resume-maker/fbdemo/fbconfig.php
<?php
session_start();
// added in v4.0.0
require_once 'autoload.php';
require 'functions.php'; 
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\Entities\AccessToken;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\HttpClients\FacebookHttpable;
// init app with app id and secret
FacebookSession::setDefaultApplication( '146727942439670','04b112dbd49d54c719a0105a4adbebd7' );
// login helper with redirect_uri
    $helper = new FacebookRedirectLoginHelper('http://dev.imenso.co/enhan_cv/fbdemo/fbconfig.php' );
try {
  $session = $helper->getSessionFromRedirect();
} catch( FacebookRequestException $ex ) {
  // When Facebook returns an error
} catch( Exception $ex ) {
  // When validation fails or other local issues
}
// see if we have a session
if ( isset( $session ) ) {
  // graph api request for user data
  $request = new FacebookRequest( $session, 'GET', '/me' );
  $response = $request->execute();
  // get response
    print_r($response);
  $graphObject = $response->getGraphObject();
  //print_r($graphObject);
     	echo $fbid = $graphObject->getProperty('id');              // To Get Facebook ID
 	    echo $fbfullname = $graphObject->getProperty('name'); // To Get Facebook full name
	    echo $femail = $graphObject->getProperty('email');    // To Get Facebook email ID
	/* ---- Session Variables -----*/
	    //$_SESSION['FBID'] = $fbid;           
        //$_SESSION['FULLNAME'] = $fbfullname;
	    //$_SESSION['EMAIL'] =  $femail;
		
		//checkuser($fbid,$fbfullname,$femail);
		
    /* ---- header location after session ----*/
  //header("Location: ../dashboard.php");
} else {
  $loginUrl = $helper->getLoginUrl();
 header("Location: ".$loginUrl);
}
?>