Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7957839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:19:26+00:00 2026-06-04T04:19:26+00:00

I have a little Facebook app, that posts some preloaded images. I changed the

  • 0

I have a little Facebook app, that posts some preloaded images. I changed the code structure, so i moved all the variables into config.php, so it would be more comfortable. But after that the app doesn’t work and i really don’t know why… After the permission dialog it realoads himself over and over… Can someone fing the bug?

This is the index.php:

<?php

require 'facebook.php';
require 'config.php';

$facebook = new Facebook(array(
'appId' => $appId,
'secret' => $appSecret,
'baseUrl' => $baseUrl,
'appBaseUrl' => $appBaseUrl,
'fileUpload' => 'true',
'cookie' => 'true'
));

if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
    $baseUrl = str_replace('http','https',$baseUrl);
    $fbPageURL = str_replace('http','https',$fbPageURL);
    $fbPageAppURL = str_replace('http','https',$fbPageAppURL);
}else{
    // not https
}

    $signed_request = $facebook->getSignedRequest();
    $page_id = $signed_request["page"]["id"];
    $like_status = $signed_request["page"]["liked"];

        if(!$like_status){
            header("Location: notfan.php");
            exit;
        }

$user = $facebook->getUser();

$params = array(
  scope => 'publish_stream,user_photos',
  redirect_uri => $fbPageAppURL
    );

$loginUrl = $facebook->getLoginUrl($params);
$app_data = $signed_request["app_data"];

?>
                    <!doctype html>
                    <html xmlns:fb="http://www.facebook.com/2008/fbml">
                    <head>
                    <title><?php echo $appName; ?></title>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                    <style>
                        a:link    {color:#f1effc;}
                        a:visited {color:#f1effc;}
                        a:hover   {color:#19378d;}
                        a:active  {color:#19378d;}
                        a:link    {text-decoration: none}
                    </style>
                    </head>
                    <body>
                    <script type="text/javascript">
                        function NotInFacebookFrame() {
                            return top === self;
                         }
                        function ReferrerIsFacebookApp() {
                            if(document.referrer) {
                                return document.referrer.indexOf("apps.facebook.com") != -1;
                        }
                         return false;
                         }
                        if (NotInFacebookFrame() || ReferrerIsFacebookApp()) {
                            top.location.replace("<?= $fbPageAppURL ?>");
                        }
                    </script>

<?php if($user){

        try {
                $user_profile = $facebook->api('/me'); 

                $scope = 'publish_stream,user_photos'; 
                $scope_params = explode(',',$scope);

                $permissions = $facebook->api("/me/permissions"); 

                    if( array_key_exists('publish_stream', $permissions['data'][0]) &&  array_key_exists('user_photos', $permissions['data'][0])) {

                    // the main app logic here

                    } else {
                        $user = null;
                    }


    } catch (FacebookApiException $e) {
            error_log($e);
            $user = null;
        }
    }

    if ($user) {
    // logged in user
    } else {
        // not logged in or not authenticated
        echo '<script type="text/javascript">top.location.href = "'.$loginUrl .'";</script>';
    }

?>  
</body>
</html>

and the config.php:

<?php
$appName = 'the name';
$appId = '123456789';
$appSecret = '1324v3434v34v';
$baseUrl = 'http://www.domain.com/app-name/';
$appBaseUrl = 'http://apps.facebook.com/zzzzzzz/';
$fbPageURL = 'http://www.facebook.com/xxxxxxx';
$fbPageAppURL = $fbPageURL.'?sk=app_'.$appId;
?>

Thank you very much!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:19:27+00:00Added an answer on June 4, 2026 at 4:19 am

    As it turned out, it was a server configuration failure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little web app that uses the Facebook like widget. This page
I have an app that connects and updates a users facebook status. I have
A little background info; I'm making an iOS App that uses facebook integration. I
I have something like Facebook's Wall build on PHP that uses MySQL database. Structure:
I'm writing a little web utility that posts status updates to Twitter and/or Facebook.
I have a web app that is being hit by facebook. The login page
I have a little facebook iframe application written with rails and the facebooker plugin.
I'm building a Facebook app that has (as part of its function) a display
I am trying to hack a little this facebook javascript code to make a
Okay since I have little experience with this stuff and the Facebook documentation is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.