Advertisement
Guest User

Status update

a guest
Dec 22nd, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  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 Update</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. <script>
  39.            function updateStatus(){
  40.                 var status  =   document.getElementById('status').value;
  41.                     FB.api('/me/feed', 'post', { message: status }, function(response) {
  42.                         if (!response || response.error) {
  43.                              alert('Error occured');
  44.                         } else {
  45.                              alert('Status updated Successfully');
  46.                         }
  47.                    });
  48. </script>
  49. </head>
  50. <body>
  51. <p align="center"><img src="coollogo.png"></p>
  52.     <?php if ($user) { ?>
  53.     <?php } else { ?>
  54.       <strong> <p align="center" class="style1">Welcome !</strong>
  55.       <p align="center"><a href=" " class="myButton" target="_blank">Click here to Enter</a></p>
  56.     <?php } ?>
  57.  
  58. <?php if ($user){ ?>
  59. <form action="" method="" onsubmit="updateStatus(); return false;">
  60.   <label for="status">Update Status</label>
  61.   <input type="text" id="status" name="status" size="60" VALUE="Whats on Your mind"/>
  62.   <div align="right" style="height:30px; padding:10px 10px;">
  63.     <label id="shareButton">
  64.       <input type="submit" value="Share">
  65.     </label>
  66.  </div>
  67. </form>
  68. <?php } ?>
  69.  
  70. </body>
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement