Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ( $_POST["signed_request"] ) {
- $signed_request = $_POST["signed_request"];
- } else {
- $signed_request = "";
- }
- $sr_data = parse_signed_request( $signed_request );
- //var_dump( $sr_data );
- if ( !$sr_data || !array_key_exists( "user_id", $sr_data ) || !array_key_exists( "oauth_token", $sr_data ) ) {
- 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/" );
- }
- $user_id = $sr_data[ "user_id" ];
- $token = $sr_data[ "oauth_token" ];
- $locale = $sr_data[ "user" ]["locale"];
- function parse_signed_request($signed_request) {
- list($encoded_sig, $payload) = explode('.', $signed_request, 2);
- $secret = "123123"; // Use your app secret here
- // decode the data
- $sig = base64_url_decode($encoded_sig);
- $data = json_decode(base64_url_decode($payload), true);
- // confirm the signature
- $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
- if ($sig !== $expected_sig) {
- error_log('Bad Signed JSON signature!');
- return null;
- }
- return $data;
- }
- function base64_url_decode($input) {
- return base64_decode(strtr($input, '-_', '+/'));
- }
- function redirect( $url ) {
- die("<script>
- if(typeof(parent) != 'undefined'){
- parent.window.location.href='".$url."';
- }else{
- window.location.href='".$url."';
- }
- </script>");
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Варвары</title>
- <meta name="google" value="notranslate"/>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <style type="text/css" media="screen">
- html,body{height:100%;width:100%;position:absolute;top:-8px;}
- body{margin:0;padding:0;overflow:auto;text-align:center;
- background-color:#fff;}
- object:focus{outline:none;}
- #flashContent{display:none;}
- div.play.act{height:730px;}
- #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;}
- #header{background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) 0 0 no-repeat;width:1000px;height:47px;}
- #header ul{padding-left:621px;list-style-type:none;}
- #header ul li{float:left;margin-right:8px;cursor:pointer;}
- #header ul li.tab_head_play.ru{
- background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
- background-position:0px -48px;
- width:100px;
- height:44px;
- }
- #header ul li.tab_head_play.ru.active{background-position:0px -138px;}
- #header ul li.tab_head_play.ru.hover{background-position:0px -93px;}
- #header ul li.tab_head_play.en{
- background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
- background-position:-342px -48px;
- width:100px;
- height:44px;
- }
- #header ul li.tab_head_play.en.active{background-position:-342px -138px;}
- #header ul li.tab_head_play.en.hover{background-position:-342px -93px;}
- #header ul li.tab_head_faq.ru{
- background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
- background-position:-100px -48px;
- width:103px;
- height:44px;
- }
- #header ul li.tab_head_faq.ru.active{background-position:-100px -138px;}
- #header ul li.tab_head_faq.ru.hover{background-position:-100px -93px;}
- #header ul li.tab_head_faq.en{
- background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
- background-position:-443px -48px;
- width:104px;
- height:44px;
- }
- #header ul li.tab_head_faq.en.active{background-position:-443px -138px;}
- #header ul li.tab_head_faq.en.hover{background-position:-443px -93px;}
- #header ul li.tab_head_group.ru{
- background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
- background-position:-203px -48px;
- width:137px;
- height:44px;
- }
- #header ul li.tab_head_group.ru.active{background-position:-203px -138px;}
- #header ul li.tab_head_group.ru.hover{background-position:-203px -93px;}
- #header ul li.tab_head_group.en{
- background:url(http://s.shadowlands.ru/kingdom/app/i/head_s.png?1) no-repeat;
- background-position:-547px -48px;
- width:136px;
- height:44px;
- }
- #header ul li.tab_head_group.en.active{background-position:-547px -138px;}
- #header ul li.tab_head_group.en.hover{background-position:-547px -93px;}
- </style>
- <link rel="stylesheet" type="text/css" href="history/history.css"/>
- <script type="text/javascript" src="history/history.js"></script>
- <script type="text/javascript" src="jquery-1.9.1.min.js"></script>
- <script type="text/javascript" src="//vk.com/js/api/xd_connection.js?2"></script>
- <script type="text/javascript" src="swfobject.js"></script>
- <script type="text/javascript" src="common.js?7"></script>
- <script src="//connect.facebook.net/ru_RU/all.js"></script>
- <script type="text/javascript">
- FB.init({
- appId : '1439528002984558',
- status : true,
- xfbml : true,
- version : 'v2.1'
- });
- loadSWF( "<?php echo $user_id?>", "<?php echo $token?>", "<?php echo $signed_request?>", "<?php echo $locale?>" );
- function loadSWF( uid, accessToken, signed_request, locale ){
- var lang = locale.split("_")[0];
- // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
- var swfVersionStr="11.0.0";
- // To use express install, set to playerProductInstall.swf, otherwise the empty string.
- var xiSwfUrlStr="playerProductInstall.swf";
- var flashvars={
- "mainSWFPath": "https://localhost:4082/bin-debug/app/main/Game.swf",
- // "mainSWFPath":"https://glera-team.com:4082/debug/TD/storage_debug_fb/app/main/Game.swf?70",
- "signed_request":signed_request,
- "uid": uid,
- "accessToken": accessToken,
- "lang": lang
- // "mainSWFPath":"//glera-team.com/debug/TD/storage_debug/app/main/game.swf?100",
- //"mainSWFPath":"//glera-team.com/debug/TD/storage_debug_ok/app/main/game.swf?70"
- //"mainSWFPath":"//glera-team.com/debug/TD/storage_debug_fb/app/main/game.swf?70"
- //"mainSWFPath":"//s.shadowlands.ru/kingdom/app_ok/main/game.swf?1"
- //"mainSWFPath":"//s.shadowlands.ru/kingdom/app/main/game.swf?73"
- };
- var params={
- "quality":"high",
- "bgcolor":"#ffffff",
- "allowScriptAccess":"always",
- "allowFullScreen":"true",
- "wmode":"direct"
- };
- var attributes={
- "id":"GleraSocialPreloader",
- "name":"GleraSocialPreloader",
- "align":"middle"
- };
- swfobject.embedSWF(
- "GleraSocialPreloader.swf?4",
- "flashContent",
- "100%",
- "730",
- swfVersionStr,
- xiSwfUrlStr,
- flashvars,
- params,
- attributes
- );
- // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
- swfobject.createCSS("#flashContent","display:block;text-align:left;");
- }
- </script>
- </head>
- <body scroll="no">
- <div id="header">
- <ul class="tab_head">
- <li class="tab_head_play active"></li>
- <li class="tab_head_faq"></li>
- <li class="tab_head_group"></li>
- </ul>
- </div>
- <div id="contents">
- <div class="play act" align="center">
- <div id="game-container" align="center">
- <div id="flashContent">
- <a href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/>
- </a>
- </div>
- </div>
- </div>
- </div>
- <div id="uid-container"></div>
- <div style="padding-top:18px;padding-bottom:18px;padding-left:5px;">
- <table border="0" cellpadding="0" cellspacing="0" width="100%">
- <tr>
- <td>
- <div style="float:left;"><div id="vk_subscribe" style="background-color:transparent;"></div></div>
- </td>
- <td>
- <div id="vk_like" style="float:left;background-color:transparent;"></div>
- </td>
- <td>
- <a title="Добавить игру в меню слева" href="#" id="vk_menu"></a>
- </td>
- </tr>
- </table>
- </div>
- <form enctype="multipart/form-data" method="post" id="multipartPost" style="visibility:hidden;"></form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement