Fan-Gate on Facebook App url + Facebook Tab Display Blank -
i have problem on facebook app. want make fan-gate when 1 enter app url, ex. apps.facebook.com/zoomcompetition/
i can't make on tab because display blank. works on app url want add fan-gate on app appoint facebook page. code
<?php require 'src/facebook.php'; //require 'fbconfig.php'; require 'functions.php'; // create instance of our facebook application. $facebook = new facebook(array( 'appid' => ***************, 'secret' => **************, )); // app user id $user = $facebook->getuser(); if ($user) { try { // if user authenticated , logged-in $user_profile = $facebook->api('/me'); //var_dump($user_profile); } catch (facebookapiexception $e) { error_log($e); $user = null; } // if user authenticated generate variable logout url if ($user) { $logouturl = $facebook->getlogouturl(); ?> <!-- insert logged in html here --> <a href="<?php echo $logouturl; ?>">logout</a> <?php //always place code @ top of page session_start(); if (!isset($_session['id'])) { // redirection login page facebook header("location: index.php"); } echo ' welcome '.$_session['username']; // or whatever want user see. $varri = "http://www.*****.ps"; ?> <iframe src=<?php print $varri; ?> scrolling="auto" width=100% height=100% frameborder="0"> </iframe> <?php $user = $facebook->getuser(); if ($user) { $ret_obj = $facebook->api('/me/feed', 'post', array( 'link' => 'https://www.************.com', 'picture' => 'http://www.*******************.jpg', 'caption' => "أهلا وسهلا!", 'message' => ' welcome '.$_session['username'], 'uid'=> $facebook->getuser() )); } ?> <?php } else { $loginurl = $facebook->getloginurl(); } if (!empty($user_profile )) { $username = $user_profile['name']; $uid = $user_profile['id']; $email = $user_profile['email']; $user = new user(); $userdata = $user->checkuser($uid, 'facebook', $username,$email,$twitter_otoken,$twitter_otoken_secret); if(!empty($userdata)){ session_start(); $_session['id'] = $userdata['id']; $_session['oauth_id'] = $uid; $_session['username'] = $userdata['username']; $_session['email'] = $email; $_session['oauth_provider'] = $userdata['oauth_provider']; //header("location: home.php"); ?> <!--<!doctype> <html> <head> <script> function run(){ window.location.href = '/facebook/home.php'; } </script> </head> <body onload="run()"> </body> </html> --> <?php } } else { die("there error."); } } else { // generate session if there none. $login_url = $facebook->getloginurl(array( 'scope' => ' read_stream, publish_stream, email')); ?> <!doctype> <html> <head> <script> function run(){ window.location.href = '<?php echo $login_url ?>'; } </script> </head> <body onload="run()"> </body> </html> <?php } ?> can me solve 1 of following:
- what need make not display "blank" on tab? 2- how can make fan-gate specific facebook pae if 1 go app url directly?
what need make not display "blank" on tab?
generate output instead of nothing, i’d guess …?
how can make fan-gate specific facebook pae if 1 go app url directly?
you can redirect canvas page specific page/app combination via javascript (top.location.href = "fb-address of page/app id combo"). , check whether you’re on canvas page, simplest way give parameter in canvas page address, can evaluate in code.
Comments
Post a Comment