elaniin / AccountKit-Web-PHP

Example of implementation of Facebook Account Kit for Web using PHP
24 stars 22 forks source link

Easy fix when using PHP include #6

Open atchoo78 opened 8 years ago

atchoo78 commented 8 years ago

Thank you for this great PHP implementation of Account kit functionality.

This may be self-explanatory for many, but maybe it will help someone: I placed the main PHP code (the actual login functions/session variables) in a separate PHP page that I included from my main page, and modified $final = json_decode($result); to $_SESSION['final'] = json_decode($result);, and of course replaced every instance of $final with $_SESSION['final']

Example: <?=$_SESSION['final']->email->address?>.

I also modified !isset($_SESSION) to!isset($_SESSION['final']) in the session check, just in case.

That way, the user info is easy accessible from anywhere on the website/app as long as the user is logged in. Just my 5 cents, or something :)

BeDataAnalyst commented 7 years ago

I can't make it work it for emailogin. I replaced all $final to $_SESSION['final'] and still not working

can please help me?

atchoo78 commented 7 years ago

Did you start the session?

if (!isset($_SESSION)) { session_start(); }

echo "<pre>" . $_SESSION . "</pre>";

…to check which session variables are set (and if the session is in fact started).

I haven't used the account kit since last summer, so I can't verify if it's still working. It seems very likely that someone changed the code since july 2016 though.

BeDataAnalyst commented 7 years ago

Hi friend thanks for help!

Yes session its start cause when i confirrm the mail pass trought

if(is_session_started() === FALSE && !isset($_SESSION)){ shows me correct the html for when you login

When i add this: echo "<pre>" . $_SESSION . "</pre>";

Shows me the word "Array"

BeDataAnalyst commented 7 years ago

Friends,

The issue its on the setting. Don't on the option "Required App Secret"