我已经在页面选项卡中尝试了这段代码,当我喜欢该页面时,它应该指引我到我的应用程序。但是现在,即使我喜欢粉丝页面也没有直播。你知道为什么吗?
<?php
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
include_once "config.php";
session_start();
if(!isset($_SESSION["visited"]))
{
$_SESSION["visited"] = "yes";
?>
<html>
<head>
</head>
<body>
<center>
<script type="text/javascript" language="javascript">
function doReload() {
top.location.href = "<?=$allow_url?>";
}
</script>
<span id="continue" onclick="doReload()">
<input type="image" src="photos/astronaut.png" width="400px" id="submitBtn" type="submit" value="login" />
</span>
</center>
</body>
</html>
<?php
}
else
{
include_once "fbmain.php";
include_once "mysqli.connect.php";
function userIsFan()
{
global $page_id, $facebook, $access_token;
$fql = "SELECT uid from page_fan WHERE uid=me() AND page_id='".$page_id."'";
$param = array('method' => 'fql.query',
'access_token' => $access_token,
'query' => $fql,
'callback' => '');
$response = $facebook->api($param);
if (isset($response[0]))
{
return true;
}
return false;
}
function checkUserParticipation($facebookID)
{
global $mysqli;
$userPart = array('exists' => false);
$sql = "SELECT * FROM users WHERE fbID = '".$facebookID."'";
$result = $mysqli->query($sql);
if ($result->num_rows != 0)
{
$userPart['exists'] = true;
}
return $userPart;
}
function insertUser($facebookID, $facebookName)
{
global $mysqli;
$sql = "INSERT INTO users(fbID, fbName) VALUES('".$facebookID."', '".$mysqli->real_escape_string($facebookName)."') ON DUPLICATE KEY UPDATE fbName='".$mysqli->real_escape_string($facebookName)."'";
$result = $mysqli->query($sql);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
</head>
<body id="my_body">
<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_US/all.js#xfbml=1&appId=172619139504029";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '<?php echo $facebook->getAppID() ?>',
cookie: true,
xfbml: true,
oauth: true
});
FB.Canvas.setAutoResize();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script type="text/javascript">
if (top.location.href.indexOf("<?=$fbconfig['baseUrl']?>") != -1)
{
top.location.href = "<?=$allow_url?>";
}
</script>
<?php
if ($me)
{
$_SESSION['fbID'] = $me['id'];
if (userIsFan())
{
$userPart = checkUserParticipation($me['id']);
if ($userPart['exists'])
{
//echo "User exists in database";
include "mainFamily.php";
}
else
{
echo "User don't exist in database";
insertUser($me['id'], $me['name']);
include "showContinue.inc";
}
}
else
{
//echo "User Not fan yet";
insertUser($me['id'], $me['name']);
include "showMustLike.inc";
}
/*adminDisplay:
if (in_array($me['id'], $admins))
{
include "showVisitors.inc";
}*/
}
?>
</body>
</html>
<?php
}
?>