Ben denemek ve mümkün olduğunca az aşağı neler damıtmak için gidiyor, ama yine de tüm ilgili kodu vereceğim. Bu bir fark değil, ama ben Zend Framework kullanıyorum. Bu kod kullanıcı giriş değilse, bu bir PreDispatch denetleyici eklenti yangınları yürütür:
Zend_Loader::loadClass('Users');
$users = new Users(Zend_Registry::get('dbAdapter'));
if($users->is_facebook_user())
{
$result = $users->login_facebook_user();
if($result == 'success')
$role = $users->role_id;
}
Bu kontrol ve Facebook'ta oturum açmış olup olmadığını görmek için yapar onlar içeri giriş değilseniz Şimdi bu yukarıdaki kodu yalnızca denir.
İşte is_facebook_user () yöntemi:
public function is_facebook_user()
{
$this->fb_userid = $this->fb->get_loggedin_user();
if($this->fb_userid != '')
{
$this->load_user_by_facebook_id($this->fb_userid);
return true;
}
else
return false;
}
$ Fb değişken ben Facebook indirilen resmi Facebook PHP API sınıftır. Bu yöntem temelde Facebook Kullanıcı kimliği döndürür. Daha sonra veritabanından kullanıcıların bilgi çeker bir yöntemini çağırır. Eğer kod ilk blokta kadar geriye bakarsanız ben sonra içeri o kullanıcı oturum açmak için bir yöntem dediğimiz görebilirsiniz
Now, if I watch the traffic using fiddler I see the following series of events: 1. logout url is called, which calls Zend_Auth::getInstance()->clearIdentity(); 2. This then calls the Facebook Logout method, which basically redirects to there site and logs the user out. 3. It then redirects back to the return url that's passed to the Facebook logout method 4. I then see it call the get_loggedin_user again because when it hits back at my site they are logged out.
Here is the problem. I can see that the get_loggedin_user returns a non logged in user, which is the result of this method $this->fb_userid = $this->fb->get_loggedin_user(); but I do get a userid back. So how can my code get this ID, even if I set it to null right before I call this, so there's no way it can be in the code still, and yet somehow watching the traffic I can see it returns a null for the user id, but I somehow get a userid.