本文整理汇总了PHP中Facebook::IsAuthenticated方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::IsAuthenticated方法的具体用法?PHP Facebook::IsAuthenticated怎么用?PHP Facebook::IsAuthenticated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook
的用法示例。
在下文中一共展示了Facebook::IsAuthenticated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Registrar
$registrar = new Registrar();
echo $registrar->getHTML();
exit;
}
/* If user doesn't grant Facebook app the access, redirect to the login page */
if (isset($_GET['error']) && $_GET['error'] == 'access_denied') {
header("Location: " . SITE_URL . "login/?access_denied");
exit;
}
/* User has granted Facebook app (some or all) permissions. */
if (isset($_GET['code'])) {
require 'Facebook/Facebook.php';
require 'config/app.php';
require 'config/login.php';
$facebook = new Facebook(APP_ID, APP_SECRET, REDIRECT_URI);
if ($facebook->IsAuthenticated()) {
/* Verify that all of the required scopes have been granted */
if (!$facebook->verifyScopes(unserialize(SCOPES))) {
//var_dump($facebook); exit;
header("Location: " . $facebook->getLoginURL($facebook->denied_scopes, REREQUEST));
exit;
}
// All scopes have been granted
// Login/Registration can be proceeded
$fb_user = $facebook->getUserProfile();
// Check if the facebook user is already registered
$loginHelper = new LoginHelper($db);
$user_id = $loginHelper->IsRegistered(OAUTH_FACEBOOK, $fb_user['id']);
if ($user_id) {
// Facebook user is already registered - Login the user
$redirect_uri = $loginHelper->Login($user_id, OAUTH_FACEBOOK, $fb_user['id']);