puratugezgin Posted June 13, 2012 Share Posted June 13, 2012 hi everyone I am trying to create a facebook application. Basically I have a flash game that I am using as an application, Below is the code so far. The game is working but I get a security warning saying Protect Your Information You're already using https to browse Facebook more securely, but some content may still not be 100% secure. Turn on secure browsing to increase your account protection and avoid getting security warnings. I guess this one has started after adding the accept application auth Dialog pop up. Sorry this is my first time creating a facebook application I would appreciate any help <?php require 'facebook.php'; $appid = ''; $app_secret = ''; $use_cookie = true; // Create our Application instance (replace this with your appId and secret). $facebook = new Facebook(array( 'appId' => $appid, 'secret' => $app_secret, 'cookie' => $use_cookie )); // Get User ID $user = $facebook->getUser(); // We may or may not have this data based on whether the user is logged in. // // If we have a $user id here, it means we know the user is logged into // Facebook, but we don't know if the access token is valid. An access // token is invalid if the user logged out of Facebook. if(!$user) { $url = $facebook->getLoginUrl(array('redirect_uri' => '')); echo '<script>top.location.href = '.$url.';</script>'; } /* if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } */ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title>Game Title</title> <link href="css/game.css" rel="stylesheet" /> <meta property="og:title" content="game title" /> </head> <body> <div id="fb-root"> <?php $signed_request = $facebook->getSignedRequest(); // Return you the Page like status $liked_status = $signed_request["page"]["liked"]; if(!$like_status){ //User do not Liked the page //do nothing }else{ //User liked the page ?> <div class="not-liked"> <div class="clear"></div> <div class="fb-like" data-send="true" data-width="600" data-show-faces="false"></div> </div> <?php } ?> <div id="console_container"> <div id="leaderboard"> </div> <div class="fbgameBnr"></div> <div id="menu_bar" style="visibility: visible;"> <a id="btn_like_us" href="Games Link" target="_blank" class="menu_button"></a> <a id="btn_invite_friends" href="javascript:invitePopup()" class="menu_button"></a> <a id="btn_share" href="javascript:sharePopup()" class="menu_button"></a> <a id="btn_more_games" href="Games Link" target="_blank" class="menu_button"></a> <div class="nliked"> <div class="fb-like" data-send="false" data-layout="button_count" data-width="120" data-show-faces="false"></div> </div> </div> <div> <?php if ($user) { ?> <div id="game_container"> <object type="application/x-shockwave-flash" data="preview.swf" width="100%" height="100%" id="flashContent" style="visibility: visible; "> <param name="salign" value="tl"> <param name="menu" value="false"> <param name="wmode" value="opaque"> <param name="scale" value="showall"> <param name="allowFullscreen" value="true"> <param name="allowScriptAccess" value="always"> <param name="bgcolor" value="#FFFFFF"> </object> </div> <div class="clear"></div> <?php } else { ?> <script> var oauth_url = 'https://www.facebook.com/dialog/oauth/'; oauth_url += '?client_id='; oauth_url += '&redirect_uri=' + encodeURIComponent(''); oauth_url += '&scope=user_status' window.top.location = oauth_url; </script> <?php } ?> <div class="fbgameBnr2"></div> </div> </div> </div> <div id="fb-root"></div> <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_GB/all.js#xfbml=1&appId="; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId : '', status : true, cookie : true, xfbml : true }); }; (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)); function checkLogin(callback) { FB.getLoginStatus(function (response) { if (response && response.status == 'connected') { // logged in and connected user, someone you know if (callback) callback(); } else { // no user session available, someone you dont know // try to login FB.login(function (response) { if (response && response.status == 'connected') { if (response.perms) { // user is logged in and granted some permissions. // perms is a comma separated list of granted permissions } else { // user is logged in, but did not grant any permissions } if (callback) callback(); } else { // user is not logged in alert('Sorry, you are not logged in. Please try again.'); } }); } }); } function sharePopup(){ checkLogin(show_share); } function show_share(){ FB.ui({ method: 'feed', name: 'Description Content', link: '', }); } function invitePopup(){ checkLogin(show_invite); } function show_invite(){ sendRequestViaMultiFriendSelector(); } function sendRequestViaMultiFriendSelector() { FB.ui({method: 'apprequests', message: 'Game Request' }, requestCallback); } function requestCallback(response) { // Handle callback here } </script> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/264080-facebook-application-flash-game-security-error/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.