Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Status update

By: a guest on Dec 22nd, 2011  |  syntax: PHP  |  size: 2.48 KB  |  hits: 43  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.   <?php
  2.  
  3.     require 'facebook.php';
  4.  
  5.     $facebook = new Facebook(array(
  6.     'appId'  => ' ',
  7.     'secret' => ' '
  8.     ));
  9.        
  10.         $user = $facebook->getUser();
  11.  
  12.     $loginUrl   = $facebook->getLoginUrl(
  13.             array(
  14.                 'scope'         => 'publish_stream',
  15.                 'redirect_uri'  => ' '
  16.             )
  17.     );
  18.         $logoutUrl  = $facebook->getLogoutUrl();
  19.  
  20.         if ($user) {
  21.            try {
  22.     $user_profile = $facebook->api('/me');
  23.         $user_id= $user;
  24.       } catch (FacebookApiException $e) {
  25.                   echo 'Error';
  26.           error_log($e);
  27.           $user = null;
  28.       }
  29.      } 
  30. ?>
  31.  
  32. <!DOCTYPE html>
  33. <html lang="en">
  34. <head>
  35. <title>Your Status</title>
  36. <link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
  37. <script src="http://code.jquery.com/jquery-latest.js"></script>
  38. </head>
  39. <body>
  40. <p align="center"><img src="coollogo.png"></p>
  41.     <?php if ($user) { ?>
  42.     <?php } else { ?>
  43.           <strong> <p align="center" class="style1">Welcome !</strong>
  44.       <p align="center"><a href=" " class="myButton" target="_blank">Click here to Enter</a></p>
  45.     <?php } ?>
  46.  
  47. <?php if ($user){ ?>
  48. <form action="" method="" onsubmit="updateStatus(); return false;">
  49.   <label for="status">Update Status</label>
  50.   <input type="text" id="status" name="status" size="60" VALUE="Whats on Your mind"/>
  51.   <div align="right" style="height:30px; padding:10px 10px;">
  52.     <label id="shareButton">
  53.       <input type="submit" value="Share">
  54.     </label>
  55.  </div>
  56. </form>
  57. <?php } ?>
  58.  
  59. <div id="fb-root">
  60.  <script src='http://connect.facebook.net/en_US/all.js'></script>
  61.   <script>
  62.       FB.init({appId: "204674169621376", status: true, cookie: true});
  63.                    function updateStatus(){
  64.                 var status  =   document.getElementById('status').value;
  65.                     FB.api('/me/feed', 'post', { message: status }, function(response) {
  66.                         if (!response || response.error) {
  67.                              alert('Error occured');
  68.                         } else {
  69.                              alert('Status updated Successfully');
  70.                         }
  71.                    });
  72.     </script>
  73.  
  74. <script>(function(d, s, id) {
  75.   var js, fjs = d.getElementsByTagName(s)[0];
  76.   if (d.getElementById(id)) return;
  77.   js = d.createElement(s); js.id = id;
  78.   js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=204674169621376";
  79.   fjs.parentNode.insertBefore(js, fjs);
  80. }(document, 'script', 'facebook-jssdk'));</script>
  81.  
  82. </body>
  83. </html>