Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'facebook.php';
- $facebook = new Facebook(array(
- 'appId' => ' ',
- 'secret' => ' '
- ));
- $user = $facebook->getUser();
- $loginUrl = $facebook->getLoginUrl(
- array(
- 'scope' => 'publish_stream',
- 'redirect_uri' => ' '
- )
- );
- $logoutUrl = $facebook->getLogoutUrl();
- if ($user) {
- try {
- $user_profile = $facebook->api('/me');
- $user_id= $user;
- } catch (FacebookApiException $e) {
- echo 'Error';
- error_log($e);
- $user = null;
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Your Status</title>
- <link href="screen.css" media="screen" rel="stylesheet" type="text/css" />
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- </head>
- <body>
- <p align="center"><img src="coollogo.png"></p>
- <?php if ($user) { ?>
- <?php } else { ?>
- <strong> <p align="center" class="style1">Welcome !</strong>
- <p align="center"><a href=" " class="myButton" target="_blank">Click here to Enter</a></p>
- <?php } ?>
- <?php if ($user){ ?>
- <form action="" method="" onsubmit="updateStatus(); return false;">
- <label for="status">Update Status</label>
- <input type="text" id="status" name="status" size="60" VALUE="Whats on Your mind"/>
- <div align="right" style="height:30px; padding:10px 10px;">
- <label id="shareButton">
- <input type="submit" value="Share">
- </label>
- </div>
- </form>
- <?php } ?>
- <div id="fb-root">
- <script src='http://connect.facebook.net/en_US/all.js'></script>
- <script>
- FB.init({appId: "204674169621376", status: true, cookie: true});
- function updateStatus(){
- var status = document.getElementById('status').value;
- FB.api('/me/feed', 'post', { message: status }, function(response) {
- if (!response || response.error) {
- alert('Error occured');
- } else {
- alert('Status updated Successfully');
- }
- });
- </script>
- <script>(function(d, s, id) {
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) return;
- js = d.createElement(s); js.id = id;
- js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=204674169621376";
- fjs.parentNode.insertBefore(js, fjs);
- }(document, 'script', 'facebook-jssdk'));</script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement