예제 #1
0

/*
 * LOGOUT 
*/
if(isset($_GET['logout']) and isset($_SESSION['loggedin'])) {
	$_SESSION = array();
	session_destroy();
}

if(isset($_GET['signin'])) {

	# STEP 1: Redirect user to Facebook, to grant permission for our application
	$url = 'https://graph.facebook.com/oauth/authorize?' . xhttp::toQueryString(array(
		'client_id'    => $client_id,
		'redirect_uri' => $callbackURL,
		'scope'        => $extendedPermissions,
	));
	header("Location: $url", true, 303);
	die();
}

if(isset($_GET['code'])) {

	# STEP 2: Exchange the code that we have for an access token
	$data = array();
	$data['get'] = array(
		'client_id'     => $client_id,
		'client_secret' => $client_secret,
		'code'		=> $_GET['code'],
		'redirect_uri'  => $callbackURL,