Probelm with php facebook page app

Hello

I’m trying to make a face page app, and i’ve run into some problems. When the admin of the page goes to the app, i want it to display a text area box. If a regular user goes to the app, i want it to show what the admin put in the text area. So far i have this:

Index.php:
[php]<?
require ‘facebook.php’;

//initialize the facebook sdk
$app_id = “243056382379479”;
$app_secret = “dbacefe48915d55c51208dd9f73c52b1”;
$facebook = new Facebook(array(
‘appId’ => $app_id,
‘secret’ => $app_secret,
‘cookie’ => true
));

//decode from facebook
$signed_request = $facebook->getSignedRequest();

//get the page id, check if the user is an admin of the page,
//and check if the user has liked the page.
$page_id = $signed_request[“page”][“id”];
$page_admin = $signed_request[“page”][“admin”];
$like_status = $signed_request[“page”][“liked”];

//display those values
echo “
page id = $page_id”;
echo “
page admin = $page_admin”;
echo “
like status = $like_status”;

//display content based on user status
if ($page_admin) {
include (‘admin_view.php’);
}
else {
include (‘user_view.php’);
}

?>


[/php]

admin_view.php:
[php]

<?php include ('content.html'); ?>



<?php $content_file = "content.html"; $fh = fopen($content_file, 'w') or die("can't open file"); $data = $_POST['content']; fwrite($fh, $data); fclose($fh); ?> [/php]

user_view.php:
[php]<?
include “content.html”;
?>[/php]

This works when it’s not on Facebook. But when it is, nothing shows up when the user views it.

Thanks!

Sponsor our Newsletter | Privacy Policy | Terms of Service