I am trying to create login with facebook with my application.The problem is I'm able to access the application with my facebook userid but not with the others.It say am error occured. Below is my code,Could anyone please check upon it and let me know what I am doing wrong?
public function fbverifyAction(){
$facebook = new Facebook(array(
'appId' => 'xxxxxx',
'secret' => 'xxxxxxxxx',
'cookie' => false,
));
$user = $facebook->getUser();
if ($user) {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
$db = Zend_Registry::get('dbadapter');
$select = new Zend_Db_Select($db);
$select = $db->select();
$select = $db->select();
$select->from(array('owner' => 'owner'),array ('idowner','username','firstname','password','fb_config'));
$select->where('owner.fb_config = ?',$me['id']);
$stmt = $select->query();
$result = $stmt->fetchAll();
if(count($result) > 0)
{
$usr = $result[0]['username'];
$pass = $result[0]['password'];
$url1 = $this->address."access/verify? username=$usr&password=$pass";
}
else
{
$uid = $facebook->getUser();
$permissions = $facebook->api(
'/me/permissions ',
'GET',
array(
'access_token' => $facebook->getAccessToken()
));
$perdetails['firstname'] =$permissions['first_name'];
$perdetails['lastname']=$permissions['last_name'];
$perdetails['username']=$permissions['username'];
$perdetails['fb_config']=$permissions['id'];
$db->insert('owner', $perdetails);
}
echo "<script type='text/javascript'>top.location.href = '$url1';</script>";
}
else {
echo '<script>top.location.href="'.$facebook->getLoginUrl().'";</script>';
}
}