Last active
December 24, 2015 17:59
-
-
Save richardpilgrim/6839668 to your computer and use it in GitHub Desktop.
Facebook PHP Example Logout Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../src/facebook.php'; | |
// Create our Application instance (replace this with your appId and secret). | |
$facebook = new Facebook(array( | |
'appId' => '<appid>', | |
'secret' => '<appsecret>', | |
)); | |
$user = $facebook->getUser(); | |
//Check if user exists | |
if($user) | |
{ | |
$params = array( 'next' => 'logout.php' ); | |
$logoutUrl = $facebook->getLogoutUrl(); | |
} | |
else | |
{ | |
session_destroy(); | |
header("Location: example.php"); | |
die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment