0

please help me, I am in little trouble. I am familiar with codeigniter. but I struggling with Login in With Facebook button. I included all files like facebook.php and base_facebook. Its working in Localhost but not working on server. please help me to fix this issue. when I click login button it's responding blank. I given my controller coding below. Thanks in advance.

public function check_fb()
{
    $this->load->model('users/users_model');
    $appId = '************'; //Facebook App ID
    $appSecret = '************'; // Facebook App Secret
    $homeurl = 'Site URL';  //return to home
    $fbPermissions = 'email';  //Required facebook permissions

    parse_str($_SERVER['QUERY_STRING'],$_REQUEST);
    $this->load->library('Facebook', array("appId"=>"******", "secret"=>"*******"));

    $fbuser = $this->facebook->getUser();
    // Here it self I did't get any response. 
    if(!$fbuser){
        $fbuser = null;
        $loginUrl = $this->facebook->getLoginUrl(array('redirect_uri'=>$homeurl,'scope'=>$fbPermissions));
        //echo $loginUrl; exit;
        redirect($loginUrl);                
    }
    else
    {
        $user_profile = $this->facebook->api('/me?fields=id,first_name,last_name,email,gender,locale,picture');
        $user = new Users();
        //echo "<pre>"; print_r($user_profile); exit;
        if(!empty($user_profile)){

            if(!empty($user_profile['id']))
            {   

                $check=$this->users_model->check_login_facebook_id($user_profile['id']);
                if($check)
                {
                    echo 'already Exist';
                }
                else
                {
                    $result = $this->users_model->update_login_facebook_id($user_profile['id']);
                    redirect($this->config->item('base_url').'users/dashboard');    
                }
            }
        }
    }
}  
  • 1
    _“when I click login button it's responding blank”_ – that usually means there was a fatal error. Enable proper error reporting/logging, so that PHP can tell you about the cause: http://stackoverflow.com/questions/1475297/phps-white-screen-of-death – CBroe Dec 09 '15 at 15:45
  • sadly Nothing display.. does .htaccess file conflict this type of issues...? – user3879162 Dec 10 '15 at 07:43

1 Answers1

0

Above code is working pretty cool..! I made mistake in library folder. I renamed base_facebook.php as Base_facebook.php, its case sensitive. if anyone face like this problem, just check twice your library files name. Facebook.php ,base_facebook.php, Fb_ca_chain_bundle security certificate.