Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.79 KB | None | 0 0
  1. <?php
  2. if ( $_POST["signed_request"] ) {
  3.     $signed_request = $_POST["signed_request"];
  4. } else {
  5.     $signed_request = "";
  6. }
  7.  
  8. $sr_data = parse_signed_request( $signed_request );
  9. //var_dump( $sr_data );
  10.  
  11. if ( !$sr_data || !array_key_exists( "user_id", $sr_data ) || !array_key_exists( "oauth_token", $sr_data ) ) {
  12.     redirect( "https://www.facebook.com/v2.1/dialog/oauth?client_id=1439528002984558&scope=email,publish_actions,user_friends,public_profile&redirect_uri=https://apps.facebook.com/varwarsdev/" );
  13. }
  14.  
  15. $user_id = $sr_data[ "user_id" ];
  16. $token = $sr_data[ "oauth_token" ];
  17. $locale = $sr_data[ "user" ]["locale"];
  18.  
  19. function parse_signed_request($signed_request) {
  20.   list($encoded_sig, $payload) = explode('.', $signed_request, 2);
  21.  
  22.   $secret = "123123"; // Use your app secret here
  23.  
  24.   // decode the data
  25.   $sig = base64_url_decode($encoded_sig);
  26.   $data = json_decode(base64_url_decode($payload), true);
  27.  
  28.   // confirm the signature
  29.   $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
  30.   if ($sig !== $expected_sig) {
  31.     error_log('Bad Signed JSON signature!');
  32.     return null;
  33.   }
  34.  
  35.   return $data;
  36. }
  37.  
  38. function base64_url_decode($input) {
  39.   return base64_decode(strtr($input, '-_', '+/'));
  40. }
  41.  
  42. function redirect( $url ) {
  43.     die("<script>
  44.        if(typeof(parent) != 'undefined'){
  45.            parent.window.location.href='".$url."';
  46.        }else{
  47.            window.location.href='".$url."';
  48.        }
  49.    </script>");
  50. }
  51.  
  52.  
  53. ?>
  54. <!DOCTYPE html>
  55. <html>
  56. <head>
  57. <title>Варвары</title>
  58. <meta name="google" value="notranslate"/>
  59. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  60. <style type="text/css" media="screen">
  61. html,body{height:100%;width:100%;position:absolute;top:-8px;}
  62. body{margin:0;padding:0;overflow:auto;text-align:center;
  63. background-color:#fff;}
  64. object:focus{outline:none;}
  65. #flashContent{display:none;}
  66. div.play.act{height:730px;}
  67. #vk_menu{visibility:hidden;float:right;margin-right:5px;display:block;background:url(http://s.shadowlands.ru/kingdom/socialnetworks/vk/add_menu.jpg) 0 0 no-repeat;height:22px;width:122px;}
  68. #header{background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) 0 0 no-repeat;width:1000px;height:47px;}
  69. #header ul{padding-left:621px;list-style-type:none;}
  70. #header ul li{float:left;margin-right:8px;cursor:pointer;}
  71. #header ul li.tab_head_play.ru{
  72.     background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
  73.     background-position:0px -48px;
  74.     width:100px;
  75.     height:44px;
  76. }
  77. #header ul li.tab_head_play.ru.active{background-position:0px -138px;}
  78. #header ul li.tab_head_play.ru.hover{background-position:0px -93px;}
  79. #header ul li.tab_head_play.en{
  80.     background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
  81.     background-position:-342px -48px;
  82.     width:100px;
  83.     height:44px;
  84. }
  85. #header ul li.tab_head_play.en.active{background-position:-342px -138px;}
  86. #header ul li.tab_head_play.en.hover{background-position:-342px -93px;}
  87. #header ul li.tab_head_faq.ru{
  88.     background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
  89.     background-position:-100px -48px;
  90.     width:103px;
  91.     height:44px;
  92. }
  93. #header ul li.tab_head_faq.ru.active{background-position:-100px -138px;}
  94. #header ul li.tab_head_faq.ru.hover{background-position:-100px -93px;}
  95. #header ul li.tab_head_faq.en{
  96.     background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
  97.     background-position:-443px -48px;
  98.     width:104px;
  99.     height:44px;
  100. }
  101. #header ul li.tab_head_faq.en.active{background-position:-443px -138px;}
  102. #header ul li.tab_head_faq.en.hover{background-position:-443px -93px;}
  103. #header ul li.tab_head_group.ru{
  104.     background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
  105.     background-position:-203px -48px;
  106.     width:137px;
  107.     height:44px;
  108. }
  109. #header ul li.tab_head_group.ru.active{background-position:-203px -138px;}
  110. #header ul li.tab_head_group.ru.hover{background-position:-203px -93px;}
  111. #header ul li.tab_head_group.en{
  112.     background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
  113.     background-position:-547px -48px;
  114.     width:136px;
  115.     height:44px;
  116. }
  117. #header ul li.tab_head_group.en.active{background-position:-547px -138px;}
  118. #header ul li.tab_head_group.en.hover{background-position:-547px -93px;}
  119. </style>
  120. <link rel="stylesheet" type="text/css" href="history/history.css"/>
  121. <script type="text/javascript" src="history/history.js"></script>
  122. <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
  123. <script type="text/javascript" src="//vk.com/js/api/xd_connection.js?2"></script>
  124. <script type="text/javascript" src="swfobject.js"></script>
  125. <script type="text/javascript" src="common.js?7"></script>
  126. <script src="//connect.facebook.net/ru_RU/all.js"></script>
  127. <script type="text/javascript">
  128. FB.init({
  129.     appId  : '1439528002984558',
  130.     status     : true,
  131.     xfbml      : true,
  132.     version    : 'v2.1'
  133. });
  134.  
  135. loadSWF( "<?php echo $user_id?>", "<?php echo $token?>", "<?php echo $signed_request?>", "<?php echo $locale?>" );
  136.  
  137. function loadSWF( uid, accessToken, signed_request, locale ){
  138.     var lang = locale.split("_")[0];
  139.  
  140.     // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
  141.     var swfVersionStr="11.0.0";
  142.     // To use express install, set to playerProductInstall.swf, otherwise the empty string.
  143.     var xiSwfUrlStr="playerProductInstall.swf";
  144.     var flashvars={
  145.         "mainSWFPath": "https://localhost:4082/bin-debug/app/main/Game.swf",
  146.         // "mainSWFPath":"https://glera-team.com:4082/debug/TD/storage_debug_fb/app/main/Game.swf?70",
  147.         "signed_request":signed_request,
  148.         "uid": uid,
  149.         "accessToken": accessToken,
  150.         "lang": lang
  151.         // "mainSWFPath":"//glera-team.com/debug/TD/storage_debug/app/main/game.swf?100",
  152.         //"mainSWFPath":"//glera-team.com/debug/TD/storage_debug_ok/app/main/game.swf?70"
  153.         //"mainSWFPath":"//glera-team.com/debug/TD/storage_debug_fb/app/main/game.swf?70"
  154.         //"mainSWFPath":"//s.shadowlands.ru/kingdom/app_ok/main/game.swf?1"
  155.         //"mainSWFPath":"//s.shadowlands.ru/kingdom/app/main/game.swf?73"
  156.     };
  157.     var params={
  158.         "quality":"high",
  159.         "bgcolor":"#ffffff",
  160.         "allowScriptAccess":"always",
  161.         "allowFullScreen":"true",
  162.         "wmode":"direct"
  163.     };
  164.     var attributes={
  165.         "id":"GleraSocialPreloader",
  166.         "name":"GleraSocialPreloader",
  167.         "align":"middle"
  168.     };
  169.     swfobject.embedSWF(
  170.         "GleraSocialPreloader.swf?4",
  171.         "flashContent",
  172.         "100%",
  173.         "730",
  174.         swfVersionStr,
  175.         xiSwfUrlStr,
  176.         flashvars,
  177.         params,
  178.         attributes
  179.     );
  180.     // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
  181.     swfobject.createCSS("#flashContent","display:block;text-align:left;");
  182. }
  183.  
  184. </script>
  185. </head>
  186. <body scroll="no">
  187. <div id="header">
  188.     <ul class="tab_head">
  189.         <li class="tab_head_play active"></li>
  190.         <li class="tab_head_faq"></li>
  191.         <li class="tab_head_group"></li>
  192.     </ul>
  193. </div>
  194. <div id="contents">
  195.     <div class="play act" align="center">
  196.         <div id="game-container" align="center">
  197.             <div id="flashContent">
  198.                 <a href="http://www.adobe.com/go/getflashplayer">
  199.                     <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
  200.                 </a>
  201.             </div>
  202.         </div>
  203.     </div>
  204. </div>
  205. <div id="uid-container"></div>
  206. <div style="padding-top:18px;padding-bottom:18px;padding-left:5px;">
  207.     <table border="0" cellpadding="0" cellspacing="0" width="100%">
  208.     <tr>
  209.         <td>
  210.             <div style="float:left;"><div id="vk_subscribe" style="background-color:transparent;"></div></div>
  211.         </td>
  212.         <td>
  213.             <div id="vk_like" style="float:left;background-color:transparent;"></div>
  214.         </td>
  215.         <td>
  216.             <a title="Добавить игру в меню слева" href="#" id="vk_menu"></a>
  217.         </td>
  218.     </tr>
  219.     </table>
  220. </div>
  221. <form enctype="multipart/form-data" method="post" id="multipartPost" style="visibility:hidden;"></form>
  222. </body>
  223. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement