I have this index.php which tells what to include. I want to have one of the subpages in the tab with fan gating option. Could someone help me and tell me what is wrong with my code? I'm not very into php.
<?php
require 'src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => '262995697152250',
'secret' => '7ad8d22dc1b0224b4bb226d0085b4063',
));
$user = $facebook->getUser();
if ($user) {
try {
$likes = $facebook->api("/me/likes/286599224689000");
if( !empty($likes['data']) )
echo "I like!";
else
echo "not a fan!";
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl(array(
'scope' => 'user_likes'
));
}
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
include ("header.php");
if(!isset($_GET['page'])) $_GET['page']="";
switch($_GET['page']) {
case "1": include('leftside.html'); include('informace.html'); break;
case "2": include('reference.html'); break;
case "3": include('clanky.html'); ;break;
case "4":
// If a fan is on your page
if ($like_status) {
include ("formular.html");
} else {
// If a non-fan is on your page
include ("nonfan.html");}
;break;
case "5": include('clanok1.html'); break;
case "6": include('clanok2.html'); break;
case "7": include('clanok3.html'); break;
case "8": include('clanok4.html'); break;
case "9": include('leftside.html'); include('vyhody.html'); break;
default: include('leftside.html'); include('informace.html');
}
include ("footer.html");
?>