Jump to content

Recommended Posts

PHP 5.3.1

latest facebook-php-sdk https://github.com/facebook/facebook-php-sdk

 

Currently I am working on Facebook web application which requires an authentication to extract fb information.

 

The authentication process is of course to be done when users intend to login. But I need to split files so that maintenance of codes would be easier.  More specifically, I want to have a single file.php that is responsible for the authentication, and other files read objects or whatever necessary from it in order to apply various functions to the application.

 

the authentication goes like,

 

 

switch(getenv("SERVER_NAME")) {
case "xxx"
 define('FACEBOOK_APP_ID', '');
 define('FACEBOOK_APP_SECRET', '');
 define('HTTP_ROOT', 'http://xxx.facebookapp/');
 define('DB_HOST', 'localhost');
 define('DB_USER', 'root');
 define('DB_PASSWORD', '');
 define('DB_DATABASE', 'xxx');
 break;
}

 

 

$facebook = new Facebook(array(
'appId' => FACEBOOK_APP_ID,
'secret' => FACEBOOK_APP_SECRET,
));
 
I need this "$facebook" object in many other files.
Somehow this part will be in an independent file, and other files refer to the object.
 
Is it possible to do it?
Can anyone help me out?
 
soichi
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.