用户无法使用facebook登录进行登录

时间:2015-08-15 22:05:36

标签: facebook login

我刚开始学习facebook,我有这个代码,所以当有人用他们的Facebook帐户登录时,它不会将它们重定向到他们的account.php,它会一遍又一遍地重新加载页面,直到他们退出Facebook,然后它停止刷新。我能做些什么来解决这个问题,我在网上到处都看,但我找不到解决办法,这真的令人沮丧。

由于

<html>
<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId: 'xxxxxxxxxxx',
      cookie: true,
      xfbml: true,
      oauth: true
    });
    FB.Event.subscribe('auth.login', function(response) {
      window.location.reload();
    });
    FB.Event.subscribe('auth.logout', function(response) {
      window.location.reload();
    });
  };
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js';
    document.getElementById('fb-root').appendChild(e);
  }());
</script>

<div id="wrapper">
<?php if ($user) { ?>
<div id="logobox"><?php include 'bigLogo.php';?></div>
<span class="logginginmsg">Logging in...</span><br/>
<?php
            $fb = new Facebook();
            $object = $fb->api('/me');
            $response = $fb->get('/me');
    $u = get_fbid();
    if($u == 0) {
    // The user is not found... let's create them:

        // Get the referrer if there is one
        $referrer = $_GET["ref"];
        // Check if the user was referred or not
        if (!empty($referrer)) {
            add_ref_data();
            } ?>
        <span class='heading'>Welcome!</span><br/>
        <span class='heading'>Since it's your first time here you need to        enter your Bitcoin wallet ID below.</span><br/>
        <span class='heading'>You can get one for free at <a href="https://blockchain.info/" target="_blank">BlockChain.Info</a></span><br/><br/>
        <span class='warningmsg'>Make sure you enter it correctly because it can't be changed!</span><br/>
        <form class="btcregform" action='register.php' method='post'>
            <input class="btcregforminput" type='text' value='' id='btcaddress' name='btcaddress'>
            <input class="btcregformbutton" type='submit' value='Submit' id='button' name='regButton'>
        </form>
        <div id="creditsandlinks">
            <?php include 'footerCredits.php';?>
        </div>
    <?php } else {
        // User is found! Redirect them to their account. ?>
        <script>location.href='account.php'</script>
    <?php } ?>

    <?php } else {

    // Facebook API detected no active user ID ?>
    <div id="logobox"><?php include 'bigLogo.php';?></div>
    <div id="contentbox">
        <div id="leftcontent">
            <span class="greeting">Hello guest !</span><br/>
            <p class='heading'>For your convenience VidCoin uses your existing Facebook account to authenticate you.</p>
            <p class='heading'>If it's your first time here you will be asked to provide a Bitcoin wallet ID so that we can make payments to you.</p>
            <div class="fb-login-button" data-max-rows="1" data-size="large" data-show-faces="false" data-auto-logout-link="true"></div><br><br>
        </div>
        <div id="rightcontent">
            <span class="rightheading">Earn Beezes</span><br/>
            <p class='heading'>Beezes is a virtual currency that can only be earned by watching short videos and do offers on our website.</p>
            <p class='heading'>You can exchange your Beezes into Bitcoins (BTC) at any time.</p>
            <p class='heading'>One VidCoin is currently worth <?php print btc_price(); ?> Satoshis.</p>
            <p class='heading'>There is no minimum amount to reach in order to exchange!</p>
        </div>  
    </div><br><br>



                  

0 个答案:

没有答案
相关问题