epicrevolt 6 Junior Poster in Training

Alright, so I have been o this for quite sometime. I am building a Facebook application with Wordpress and have a question. I have the app integrated into my fanpage and that works fine. The only problem is, whenever a user clicks a page inside the iFrame, it should be running a php script (by Facebook) that checks if the user has liked the page, It always thinks they have not liked it (tested by unliking and liking the page again). The code is below. I made it simple, just will display text on top telling the user if they're a fan or not. It will obviously be different in the final version.
The code is on top, the page renders below it. The page will always say "You are not a fan!". D:

<?php
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
 
if (empty($data["page"]["liked"])) {
    echo "You are not a fan!";
} else {
    echo "Welcome back fan!";
}
?>
<?php get_header(); ?>
	<div id="contentarea">
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
			<h2 class="title" id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
			<?php if ( has_post_thumbnail()) : ?><div class="featuredimage"><?php the_post_thumbnail(); ?></div><?php endif; ?>
			<div class="pagecontent">
				<?php the_content('Read the rest of this article >>'); ?>
			</div>
			<?php  ?>
		<?php endwhile; else: ?>
		<?php include (TEMPLATEPATH . '/404.php'); ?>
		<?php endif; ?>
	</div>
<?php get_footer(); ?>

Do I need more code? Everywhere I look I apparently don't need an API key.