Jump to content

Call to FB.Api before PHP session Code


jimfog

Recommended Posts

On top of my PHP scripts I have session checking code:

 

if (!isset($_SESSION['regular_user'])) { 

     if ((isset($_COOKIE['cookiename']))) {// check for existense of persistent cookie (the user ticked the remember me option) 
        
    } else {

        header("Location: ../Frontend/login.php"); 

    }
}

I am using also Facebook Social Login(JS SDK)...and on every page I must check also if the user is connected to my App.

Than means JS code-Facebook API request and ajax request to create sessions.

Js cannot be placed on top of the page before PHP session code.

What are my alternatives? 

The only solution I have found so far is to put the ajax request/FB api call inside a PHP script that is required in the page

that contains the above code...along w the HTML of course.

What do you think?

Link to comment
Share on other sites

The solution is questionable...so any suggestions are welcome.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...