Passed
Push — master ( 1ffcd5...02eff1 )
by Rakesh
01:37
created

index.php (1 issue)

Severity
1
<?php
2
if(!session_id()) {
3
  session_start();
4
}
5
6
require_once 'lib\Facebook\autoload.php';
7
8
if(isset($_SESSION['fb_access_token'])){
9
  // Get access token from session
10
  $accessToken = $_SESSION['fb_access_token'];
11
  header('Location:fb-callback.php');
12
}else{
13
$fb = new Facebook\Facebook([
14
  'app_id' => '362540437809242', // my facebook app id
15
  'app_secret' => '538cd04f971479ff14dc409df2fbcf3b',
16
  'default_graph_version' => 'v3.2',
17
  ]);
18
19
$helper = $fb->getRedirectLoginHelper();
20
21
$permissions = ['email']; // Optional permissions
22
$loginUrl = $helper->getLoginUrl('https://localhost/rtCamp/fb-callback.php', $permissions);
23
24
echo "<h3> Connect Clicking Below Facebook Icon Using Your Facebook Account.<h3>";
25
echo '<a href="' .htmlspecialchars($loginUrl).'"><img alt="Login With Facebook" src="images/fb_icon.png"></a>';
26
}
27
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...