Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once 'facebook.php';
- $app_id = "418907881455014";
- $app_secret = "36389d2c4caaf6de86982cb87686a494";
- $redirect_uri = 'http://gooogle12.comuf.com';
- $facebook = new Facebook(array(
- 'appId' => $app_id,
- 'secret' => $app_secret,
- 'cookie' => true
- ));
- //Facebook Authentication part
- $user = $facebook->getUser();
- $user_profile = $facebook->api('/me');
- if(!empty($session) && ($authorize == null)){
- //blablabla
- }
- $facebook_login_url = $facebook->getLoginUrl(array(
- 'canvas' => 1,
- 'fbconnect' => 0,
- 'scope' => 'publish_stream,user_photos',
- 'redirect_uri' => $fb_app_url
- ));
- $facebook_user_id = $facebook->getUser();
- $coded = $_REQUEST['code'];
- $access_token = $facebook->getAccessToken();
- $name = "".$user_profile['name']."";
- $fbid = "".$user_profile['id']."";
- //Obtain the access_token with publish_stream permission
- if(empty($code))
- {
- $dialog_url= "http://www.facebook.com/dialog/oauth?"
- . "client_id=" . $app_id
- . "&redirect_uri=" .("http://apps.facebook.com/farmvilllegifts")
- . "&scope=publish_stream";
- echo("<script>top.location.href='" . $dialog_url .
- "'</script>");
- }
- function RandomLine($filename) {
- $lines = file($filename) ;
- return $lines[array_rand($lines)] ;
- }
- $reason = RandomLine("reason.txt");
- $canvas = imagecreatefromjpeg ("bg.jpg"); // background image file
- $black = imagecolorallocate( $canvas, 0, 0, 0 ); // The second colour - to be used for the text
- $font = "fonts/Arial.ttf"; // Path to the font you are going to use
- $fontsize = 20; // font size
- $birthday = "".$user_profile['birthday']."";
- $death = "- ".date('d/m/Y', strtotime( '+'.rand(0, 10000).' days'))."";
- imagettftext( $canvas, 22, -1, 110, 120, $black, $font, $name ); // name
- imagettftext( $canvas, 22, -1, 110, 170, $black, $font, $birthday ); // birthday
- imagettftext( $canvas, 22, -1, 255, 172, $black, $font, $death ); // death
- imagettftext( $canvas, 20, -1, 110, 220, $black, $font, $reason ); // reason
- imagejpeg( $canvas, "img/".$fbid.".jpg", 50 );
- $facebook->setFileUploadSupport(true);
- // Create a new album
- $graph_url = "https://graph.facebook.com/me/albums?"
- . "access_token=". $access_token;
- $postdata = http_build_query(
- array(
- 'name' => $album_name,
- 'message' => $album_description
- )
- );
- $opts = array('http' =>
- array(
- 'method'=> 'POST',
- 'header'=>
- 'Content-type: application/x-www-form-urlencoded',
- 'content' => $postdata
- )
- );
- $context = stream_context_create($opts);
- $result = json_decode(file_get_contents($graph_url, false,
- $context));
- // Get the new album ID
- $album_id = $result->id;
- //Upload a photo to album of ID...
- $file = FCPATH . "img/'.$fbid.'.jpg";
- $post_data = array(
- "message" => "My photo caption",
- "source" => '@' . realpath($file)
- );
- $album_id = "473425002142";
- $data['photo'] = $facebook->api("/$album_id/photos", 'post', $post_data);
- header("Location: http://www.facebook.com/" . urlencode($fbid) . "&photoid=" . urlencode($upload_photo['id']));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement