ดูโค้ดตัวนี้หน่อยนะครับ อยากได้แบบว่าถ้าเรา log out ไปแล้วไม่โชว์ข้อมูลใด ๆ ครับ
Code (PHP)
<?php
session_start;
include("connect.php");
require '../scripts/src/facebook.php';
$facebook = new Facebook(array(
'appId' => '338212302933297',
'secret' => 'ebbe8ca92a23de8586976efb51a2f71c',
));
// See if there is a user from a cookie
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
$user = null;
}
}
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl( array('scope' => 'email,read_stream'));
}
?>