<html>
<head>
<style type="text/css">body {overflow: hidden;}</style>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
</head>
<body onLoad="FB.Canvas.setSize({width: 500, height: 1100})" style="text-align:center;">
<div id="fb-root"></div>
<script type="text/javascript">
FB.init({
appId : 'YOUR_APP_ID_HERE',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
window.fbAsyncInit = function(){
fb.canvas.setautoresize();
}
</script>
<?php
function parsePageSignedRequest() {
if (isset($_REQUEST['signed_request'])) {
$encoded_sig = null;
$payload = null;
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
$sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));
return $data;
}
return false;
}
if($signed_request = parsePageSignedRequest()) {
if($signed_request->page->liked) {
?>
Hi, thanks for being a fan! :)
or...
redirect them to another tab
PM me if you want help customizing this script to do that
<?php
} else {
?>
Hi, please become a fan by clicking the Like button! :)
or...
redirect them to another tab
PM me if you want help customizing this script to do that
<?php
}
} else {
header('Location: http://www.url-to-your-fan-page.com/in-case-they-visit-your-page-from-outside-facebook.php');
exit();
}
?>
</body>
</html>