Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Enter your APP ID below
- define("266872970045582","1a");
- define("266872970045582","2a");
- define("266872970045582","3a");
- define("266872970045582","4a");
- ?>
- <!-- Copyright 2004-2011 Facebook. All Rights Reserved.-->
- <html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:fb="http://www.facebook.com/2008/fbml">
- <head>
- <title>Der Maya-Kalender - Countdown zum 21.12.2012</title>
- <link rel="stylesheet" href="facebook.css" type="text/css" media="screen" />
- </head>
- <body>
- <?php
- include 'libs/facebook.php';
- $facebook = new Facebook(array(
- 'appId' => '266872970045582',
- 'secret' => '7d6fa5183c71ed9a9da9fc840bbbc6d8',
- 'cookie' => true
- ));
- $session = $facebook->getUser();
- $me = null;
- if($session)
- {
- try
- {
- $friends = $facebook->api('/me/friends');
- $me = $facebook ->api('/me');
- }
- catch(FacebookApiException $e)
- {
- echo $e->getMessage();
- }
- }
- if($me)
- {
- $logoutUrl = $facebook->getLogoutUrl();
- echo "<a href='$logoutUrl'>Logout</a>";
- }
- else
- {
- $loginUrl = $facebook->getLoginUrl();
- echo "<a href='$loginUrl'>Login</a>";
- }
- ?>
- <div id="fb-root"></div>
- <script> // FACEBOOK INITIALIZE
- window.fbAsyncInit = function() {
- FB.init({
- appId : '266872970045582', // App ID
- channelUrl : '//smaug.nuro.local/mayacalendar/channel.html', // Channel File
- status : true, // check login status
- cookie : true, // enable cookies to allow the server to access the session
- xfbml : true // parse XFBML
- oauth : true
- FB.Event.subscribe('auth.authResponseChange', handleResponseChange);
- });
- function handleResponseChange(response) {
- document.body.className = response.authResponse ? 'connected' : 'not_connected';
- if (response.authResponse) {
- console.log(response);
- updateUserInfo(response);
- }
- }
- // Additional initialization code here
- };
- function loginUser() { //Login
- FB.login(function(response) { }, {scope:'email'});
- }
- // Load the SDK Asynchronously
- (function(d){
- var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
- js = d.createElement('script'); js.id = id; js.async = true;
- js.src = "//connect.facebook.net/en_US/all.js";
- d.getElementsByTagName('head')[0].appendChild(js);
- }(document));
- //// SUBSCRIBE - BUTTOM - FUNKTIONSDEFINITIONEN. - EVENT - HANDLER///////////////
- FB.Event.subscribe('edge.create',
- function(response) {
- alert('You liked the URL: ' + response);
- }
- );
- //// SUBSCRIBE - BUTTOM - FUNKTIONSDEFINITIONEN. ///////////////
- FB.Event.subscribe('auth.authResponseChange', function(response) {
- alert('The status of the session is: ' + response.status);
- });
- // Attach the handler using FB.Event.subscribe
- FB.Event.subscribe('edge.create', handleResponse(response));
- // Function to handle the response
- var handleResponse = function(response) {
- alert ('You liked the URL: ' + response);
- };
- // At some point, you no longer want to be notified, and unsubscribe
- FB.Event.unsubscribe('edge.create', handleResponse);
- </script>
- <h3 align="center"> Purchase Credits</h3>
- <!--<form name ="oder_body" id="order_form" action="#">
- <img src="http://www.facebook.com/images/gifts/21.png">
- <input type="hidden" name="item_id" value="1a" id="item_id">
- <img src="http://developers.facebook.com/attachment/credits_sm.png"
- height="25px">
- </form>-->
- <a name="1Monat" id="item_id1" value="1a">
- <input id="showBuyItem1" type="image" src="http://www.facebook.com/images/credits/paybutton.png">
- <input type="hidden" name="title" id="title_id" value="1monat">
- <input type="hidden" name="price" id="price_id" value="1">
- <input type="hidden" name="description" id="desc_id" size="64" value="1-Monat Packet des Maya Kalendar's">
- <input type="hidden" name="expire" id="expire_id" value="30-11-2012">
- <!--<input type="hidden" name="image_url" id="img_id" size="64" value="">-->
- 1-Month-Package
- </a><br>
- <a name="3Monate" id="item_id" value="2a">
- <input id="showBuyItem2" type="image" src="http://www.facebook.com/images/credits/paybutton.png">
- <input type="hidden" name="title" id="title_id" value="3monat">
- <input type="hidden" name="price" id="price_id" value="1">
- <input type="hidden" name="description" id="desc_id" size="64" value="3-Monate Packet des Maya Kalendar's">
- <input type="hidden" name="expire" id="expire_id" value="30-09-2012">
- <!--<input type="hidden" name="image_url" id="img_id" size="64" value="">-->
- 3-Month-Package
- </a><br>
- <a name="6Monate" id="item_id" value="3a">
- <input id="showBuyItem3" type="image" src="http://www.facebook.com/images/credits/paybutton.png">
- <input type="hidden" name="title" id="title_id" value="6monat">
- <input type="hidden" name="price" id="price_id" value="1">
- <input type="hidden" name="description" id="desc_id" size="64" value="6-Monate Packet des Maya Kalendar's">
- <input type="hidden" name="expire" id="expire_id" value="30-06-2012">
- <!-- <input type="hidden" name="image_url" id="img_id" size="64" value="">-->
- 6-Month-Package
- </a><br>
- <a name="12Monate" id="item_id" value="4a">
- <input id="showBuyItem4" type="image" src="http://www.facebook.com/images/credits/paybutton.png">
- <input type="hidden" name="title" id="title_id" value="12monat">
- <input type="hidden" name="price" id="price_id" value="1">
- <input type="hidden" name="description" id="desc_id" size="64" value="12-Monate Packet des Maya Kalendar's">
- <input type="hidden" name="expire" id="expire_id" value="30-12-2013">
- <!--<input type="hidden" name="image_url" id="img_id" size="64" value="">-->
- Full-Month-Package
- </a><br>
- <a name="getcredits" id="more">
- <input id="showBuyCredits" type="image" src="http://www.facebook.com/images/credits/creditsbutton.png" />
- Buy Credits
- </a><br>
- <div id="output"> <?=$html?> </div> </br></br>
- <!--<script>
- FB.init({appId: <?php echo "266872970045582"; ?>, status: true, cookie: true});
- function placeOrder() {
- // Assign an internal ID that points to a database record
- // var item_id = '1a';
- //var item= document.getElementByID('item_id').value;
- var title= document.getElementByID('title_id').value;
- var price = document.getElementById('price_id').value;
- var desc = document.getElementById('desc_id').value;
- var expire = document.getElementById('expire_id').value;
- //var img_url = document.getElementById('img_id').value;
- //var order_info = item_id;
- var oder_info = {
- "title": title,
- "price":price,
- "description":desc,
- "expire":expire
- //"img_id":img_url,
- };
- //calling the API ...
- var obj = {
- method: 'pay',
- order_info: order_info,
- purchase_type: 'item'
- //dev_purchase_params: {'oscif': false}
- };
- FB.ui(obj, callback);
- }
- function buyMore(){
- // calling the API ...
- var obj = {
- method: 'pay',
- credits_purchase: true
- };
- FB.ui(obj, callback);
- }
- var callback = function(data) {
- if (data['order_id']) {
- writeback("Transaction Completed! </br></br>"
- + "Data returned from Facebook: </br>"
- + "<b>Order ID: </b>" + data['order_id'] + "</br>"
- + "<b>Status: </b>" + data['status']);
- } else if (data['error_code']) {
- writeback("Transaction Failed! </br></br>"
- + "Error message returned from Facebook:</br>"
- + data['error_message']);
- } else {
- writeback("Transaction failed!");
- }
- };
- function writeback(str) {
- document.getElementById('output').innerHTML=str;
- }
- </script>-->
- <div id="fb-root"></div>
- <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
- <script type="text/javascript">
- var jsSdk = window['FB'];
- // initialize the SDK
- jsSdk.init({apiKey: '266872970045582', status:true });
- /*document.getElementById('showBuyCurrency').onclick = function(){
- jsSdk.ui({method: 'pay', credits_purchase : false, order_info:'currency.001' },function(){alert('Erfolgreich!')});
- return false;
- };*/
- document.getElementById('showBuyItem1').onclick = function(){
- jsSdk.ui({method: 'pay', credits_purchase : false, order_info:'item.001' },function(){alert('Erfolgreich!')});
- return false;
- };
- document.getElementById('showBuyItem2').onclick = function(){
- jsSdk.ui({method: 'pay', credits_purchase : false, order_info:'item.002' },function(){alert('Erfolgreich!')});
- return false;
- };
- document.getElementById('showBuyItem3').onclick = function(){
- jsSdk.ui({method: 'pay', credits_purchase : false, order_info:'item.003' },function(){alert('Erfolgreich!')});
- return false;
- };
- document.getElementById('showBuyItem4').onclick = function(){
- jsSdk.ui({method: 'pay', credits_purchase : false, order_info:'item.004' },function(){alert('Erfolgreich!')});
- return false;
- };
- document.getElementById('showBuyCredits').onclick = function(){
- jsSdk.ui({method: 'pay', credits_purchase : true },function(){alert('Erfolgreich!')});
- return false;
- };
- </script>
- <script>
- (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>
- <?php
- // if $order_id and $status are passed back, we know they were send from the full
- // page view, here we print the same information users see through the normal path
- if ($_GET['order_id'] && $_GET['status']) {
- $html = "Transaction Completed! </br></br>"
- ."Data returned from Facebook: </br>"
- ."<b>Order ID: </b>" . $_GET['order_id'] . "</br>"
- ."<b>Status: </b>" . $_GET['status'];
- } elseif ($_GET['error_code'] && $_GET['error_message']) {
- $html = "Transaction Failed! </br></br>"
- ."Error message returned from Facebook:</br>"
- .$_GET['error_message'];
- }
- ?>
- <div id="user-info"></div>
- <script>
- function updateUserInfo(response) {
- FB.api('/me', function(response) {
- document.getElementById('user-info').innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture">' + response.name;
- });
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment