开发者

Facebook connect - Detect Login State using PHP

I have Facebook Connect working (partially at least).

For a user who logged into facebook, when they first visit my site's login page, the following js line will refresh the page and my php log the user in.

FB.init("api-key","xd_receiver.htm",{"reloadIfSessionStateChanged":true});

However, when a user logs out of facebook, the facebook cookie remains when they visit my site and hence they are treated as logged into my site until the page is reloaded by the same js line I mentioned.

So my question is, is there a possible way to detect facebook login state without refreshing the page? And, is there a way to use facebook connect without using the javascript?

Thanks in advan开发者_如何学运维ce.


Perhaps it's the cookies from your site.

In my project that using facebook connect, logout from application will also logout facebook session. Logout from facebook, while in application is still logged on will only affect facebook. User in my application can still access protected page.

Facebook connect is only used when user visit page without website specific cookies. If normal cookies is not exist, but the facebook connect library have user_id > 0, then I can create a normal application cookies, if the facebook user_id is connected to existing application user. With this design, user that have login in facebook, then access my application is instantly logged on.

My application is written using CodeIgniter, and I use facebook connect library created by Elliot Haughin.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜