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 6347577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:14:38+00:00 2026-05-24T21:14:38+00:00

I have a file named fbmain.php which do all facebook authentication parts. And I

  • 0

I have a file named fbmain.php which do all facebook authentication parts. And I have a button in index.php file which passes data to a.php file
This is just an example

//fbmain.php : do all facebook authentication parts

//index.php
      <?php
           include_once "fbmain.php";
       ?>
<form enctype="multipart/form-data" action="http://myserver/a/a.php" method="POST">
     //Some codes 
     <input type="submit" value="Upload"/>
</form>

In a.php file I have to include fbmain.php again since here I do some api call.

  //a.php
<?php    
    include_once "fbmain.php";

        //some codes            
            try{            
                $me = $facebook->api('/me?access_token='. $token); 
                print_r($me);               
            } catch(FacebookApiException $e){
                echo "Error:" .$e;
            }
?>

THis app works fine in firefox browser but doesnt work in IE(When the user click ‘Upload button it redirect user to the host Canvas Callback URL’).

I tried placing bellow codes at the top of in each and every file(fbmain.php, index.php, a.php). But it still doesn’t work?

First I tried this

header('P3P: CP=HONK');
ob_start();

Then I tried this

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');    
ob_start();

But nothing works in IE.
Can anyone please help me?

//fbmain.php file

<?php
    //header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
    header('P3P: CP="CAO PSA OUR"');
    ob_start();
    //facebook application
    //set facebook application id, secret key and api key here
    $fbconfig['appid' ] = "MY_APP_ID";      
    $fbconfig['api'   ] = "MY_API_KEY";
    $fbconfig['secret'] = "MY_APP_SECRET";

    //set application urls here
    $fbconfig['baseUrl']    =   "http://MYSERVER/uploader/index.php"; //http://thinkdiff.net/demo/newfbconnect1/iframe;
    $fbconfig['appBaseUrl'] =   "http://apps.facebook.com/approne"; //http://apps.facebook.com/thinkdiffdemo;

    $uid            =   null; //facebook user id

    try{
        include_once "facebook.php";
    }catch(Exception $o){
        echo '<pre>';
        print_r($o);
        echo '</pre>';
    }
    // Create our Application instance.
    $facebook = new Facebook(array(
      'appId'  => $fbconfig['appid'],
      'secret' => $fbconfig['secret'],
      'cookie' => true,
    ));

    //Facebook Authentication part
    $session = $facebook->getSession();

    $loginUrl = $facebook->getLoginUrl(
            array(
            'canvas'    => 1,
            'fbconnect' => 0,
            'req_perms' => 'email,publish_stream,status_update,user_photos'
            )
    );
    if (!$session) {
        echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
        exit;
    } 
    if ($session) {
        try {
            $uid      =   $facebook->getUser();
                //Has a loading problem
        } catch (FacebookApiException $e) {
            echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
            exit;
        }       
    }

    $signed_request = $_REQUEST['signed_request'];
    $secret = $fbconfig['secret'];
    $data = parse_signed_request($signed_request, $secret);
    $fan_page_id = $data['page']['id'];
    $admin_check = $data['page']['admin'];

        //Get fan page id
    function parse_signed_request($signed_request, $secret) {

        list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

        // decode the data
        $sig = base64_url_decode($encoded_sig);
        $data = json_decode(base64_url_decode($payload), true);

        if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
            error_log('Unknown algorithm. Expected HMAC-SHA256');
            return null;
        }

        // check sig
        $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
        if ($sig !== $expected_sig) {
            error_log('Bad Signed JSON signature!');
            return null;
        }
        return $data;

    }

    function base64_url_decode($input) {
        return base64_decode(strtr($input, '-_', '+/'));
    }   

?>
  • 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-05-24T21:14:39+00:00Added an answer on May 24, 2026 at 9:14 pm

    I came across a similar issue with IE before where the user session was not persisting server side. To get around it I added a hidden field to forms served to IE containing the signed_request.

    <input type='hidden' name='signed_request' value='VALID_SIGNED_REQUEST' />
    

    But this solution should work with the code parameter or by passing the authorisation token and then using it to restore the users session server side. You can also try maintaining your own session cookie.


    I see you are using the pre v3 of the PHP SDK. So you should try adding the hidden field:

    <input type='hidden' name='session' value='<?php echo json_encode($session); ?>' />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file named common.cs which contains commonly used functions like this public
I have a file named discussion.php , where a form is located. In this
I have a file named a.txt which looks like this: I'm the first line
var PageLoad = true; I have a file named properties.js which holds this value
Let me explain this as best as I can. I have PHP file named
I have a file named my file.pdf and I can't delete this file with
I have created a file named MyFile.db using SQLite3 from my C#.net application. This
I have a file named file.txt which is update by adding lines to it.
I have a text file named abc.txt . The file have info like this
I have a file named gcc.exe and I have a php page... I want

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.