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

  • Home
  • SEARCH
  • 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 6825953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:05:29+00:00 2026-05-26T22:05:29+00:00

I am developing a facebook app using PHP. I am able to login using

  • 0

I am developing a facebook app using PHP.
I am able to login using the below code

 <?php

$app_id = "XXXXXXXXXXXXXXXXX";
$canvas_page = "http://apps.facebook.com/sandysfirst/";
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
       . $app_id . "&redirect_uri=" .urlencode($canvas_page)."&scope="."publish_stream,read_stream,offline_access";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
       echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {

}?>

<?php
  include_once "src/facebook.php";
  $app_id = 'XXXXXXXXXXXXXXXXXXX';
  $application_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
  $facebook = new Facebook(array(
 'appId'  => $app_id,
 'fileUpload' =>true,
 'secret' => $application_secret,
 'cookie' => true, // enable optional cookie support
));
       if ($facebook->getSession()) {
       $user = $facebook->getUser();
       $uid = $facebook->getUser();
              $fbme  =   $facebook->api('/me');
              echo "<br/><br/><br/><br/> Welcome ".$fbme['name'];
         }
       echo "<html>

and the HTML follows below that with a form action.
I want to know how I can get the same user id or session on the second page once the form is submitted.
I am not using facebook.php of sdk 3.0.

  • 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-26T22:05:29+00:00Added an answer on May 26, 2026 at 10:05 pm

    I don’t know the facebook api, but from some basic php there’s a few methods you could use:

    1 – Add the uid as a hidden field in the form.

    <input type="hidden" name="uid" value="$uid">
    

    2 – Add it to the action url

    <form action="submit.php?uid=$uid">
    

    However the better way is to use the facebook api, pretty much the same way you’ve got it listed there already (from the include_once "src/facebook.php";), to retrieve the uid each time, otherwise you leave it open to security hacks (easy to pass a fake uid in a form).

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

Sidebar

Related Questions

I am developing iPhone app that let user login using their facebook account using
I've been developing a Facebook app using Google App Engine in Python and the
I started developing a Facebook app using the new Graph API. I want to
I'm developing a facebook app which has the following structure: Browser window (facebook.com/page/xxxx) --
Im developoing an app for the iPhone where users can chat using their facebook
I'm developing a facebook app right now all by my lonesome. I'm attempting to
I'm developing an IFrame application in Facebook (using pyfacebook and Django) and could not
I am developing a facebook app and I seem to have got stuck on
I am developing a Facebook app in Zend Framework. In startAction() I am getting
I am developing an iPhone app which needs Facebook to be integrated to my

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.