コード例 #1
0
$text .= "</head><body>";
//$text .= "<center>";
$text .= "<div id=\"facebookDIV\">";
$text .= $displayerror;
//Connect to e107 database
//dbFBConnect();
//If a User is Logged In
if ($currentUser['user_id'] != "") {
    $fbid = checkUser($currentUser['user_id']);
    //If User is Not Connected With Facebook Ask to Link Account
    if (!$fbid || $fbid == "" || $fbid == false) {
        $text .= USERNAME . ", would you like to <a href=\"" . e_PLUGIN . "facebookconnect_menu/actions.php?linkaccount=yes\">link your account with Facebook?</a><br>";
        $text .= "<div class=\"fb-login-button\" data-show-faces=\"true\" data-width=\"200\" data-max-rows=\"1\" data-scope=\"email,user_birthday\" data-onlogin=\"LinkAccounts();\">Link Accounts</div>";
    } else {
        if ($uid == 0) {
            $text .= "<div class=\"fb-login-button\" data-show-faces=\"true\" data-width=\"200\" data-max-rows=\"1\" data-scope=\"email,user_birthday\" data-onlogin=\"Login();\"></div>";
        } else {
            $text .= "<img src=\"https://graph.facebook.com/" . $uid . "/picture\"/><br>Welcome, " . $user_profile['name'];
        }
    }
} else {
    $text .= "<div class=\"fb-login-button\" data-show-faces=\"true\" data-width=\"200\" data-max-rows=\"1\" data-scope=\"email,user_birthday\" data-onlogin=\"Login();\">Connect with Facebook</div>";
}
$text .= "</div>";
$text .= loadFBjs();
//$text .= "</center>";
$text .= "</body></html>";
//Set to Table
$ns->tablerender($caption, $text);
?>
	
コード例 #2
0
+-------------------------------*/
//Check for Referring Page
$refer = urldecode($_GET['refer']);
//Check for FB Login to Link Accounts
$fblinkaccount = @$_GET['linkaccount'];
if ($fblinkaccount == "yes") {
    $updateuser = updateUser($currentUser['user_id'], $uid);
    if ($updateuser === TRUE) {
        echo "<script type=\"text/javascript\">window.top.location= '" . $refer . "'; </script>";
    } else {
        echo "<script type=\"text/javascript\">window.top.location= '" . $_SESSION['refer'] . "?error=fbidexists'; </script>";
    }
}
$fblogin = @$_GET['login'];
if ($fblogin == "yes") {
    $createuser = createUserfromFacebook($uid);
    if ($createuser == "created") {
        echo "<script type=\"text/javascript\">window.top.location= '" . $_SESSION['refer'] . "'; </script>";
    }
    if ($createuser == "error") {
        echo "<script type=\"text/javascript\">window.top.location= '" . $_SESSION['refer'] . "?error=create'; </script>";
    }
    if ($createuser == "login") {
        echo "<script type=\"text/javascript\">window.top.location= '" . $_SESSION['refer'] . "'; </script>";
    }
    if ($createuser == "nouser") {
        echo "<script type=\"text/javascript\">window.top.location= '" . $_SESSION['refer'] . "?error=nouser'; </script>";
    }
}
$js = loadFBjs();
echo $js;