Buying PHP or Javascript code to check if visitor is logged in Facebook

Discussion in 'Programming' started by r3ticul, Dec 28, 2011.

  1. #1
    Hi,

    I want to create a page where I want to display a <div> only to the visitors that are logged in Facebook.

    Basically, it will be a div that has a background and a Recommend button in it and I want it to show it only to those that are already logged in Facebook.

    The problem is that I'm not familiar with Facebook api and all that and I need a PHP code or a javascript code to check if the visitor is logged and if so, echo div or document.write it (or even change a var from "0" to "1" in the case of javascript). If Javascript is used, I would prefer the code beeing used in a separate file (code.js for example).

    I can pay 20$ for the one that helps me.

    for the moment, here is my code:

    
    <html>
    <body>
    <head>
    <title>Facebook</title>
    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    </head>
    <body>
    
    <div id="numdo"><fb:like href="http://www.facebook.com/pages/deleted" send="false" layout="button_count" width="150" show_faces="false" action="recommend"></fb:like></div>
    
    </body>
    </html>
    
    
    Code (markup):
    Waiting for PMs


    L.E. I forgot to mention that I'm promoting a fan page (url is deleted above) and I tried to work with this code, but nothing works (because I also don't really know how FB works...but maybe someone here does):

    <script type="text/javascript">
    window.fbAsyncInit = function() {
    FB.init({appId: 'XXXXXXXXXXXXXXX', status: true, cookie: true,
    xfbml: true});
    FB.getLoginStatus(function(response) {
    if (response.session) {
    alert('Logged In');
    } else {
    alert('Not Logged In');
    }
    });
    };

    (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>
     
    Last edited: Dec 28, 2011
    r3ticul, Dec 28, 2011 IP