$user = $facebook->getUser();
if (!$user)
{
$loginUrl = $facebook->getLoginUrl(array(
'redirect_uri' => REDIRECT_URL,
'scope' => APP_PERMS,
'display' => 'page'
));
//do something with $loginUrl, for example:
echo '<a href="'.$loginUrl.'">Login with facebook</a>';
}
else
{
//check that this user is still valid
$realUser = $facebook->api('me');
...
ส่วน Like ลองดูอันนี้ครับ http://stackoverflow.com/questions/6830497/check-if-user-already-likes-fanpage