Twitter api redirect to empty page

Multi tool use
Multi tool use


Twitter api redirect to empty page



In this page: http://branding.cumedia.tv/login.php



There are four logging options. All works fine except twitter. They redirects to the profile page, but redirects to an empty page. Why is that?



Here is the code for the login page:


else if (isset($_GET['method']) && $_GET['method']=='twitter_brand'){

//Successful response returns oauth_token, oauth_token_secret, user_id, and screen_name

$connection = new TwitterOAuth($config_twitter_id, $config_twitter_secret, $_SESSION['token'] , $_SESSION['token_secret']);

$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);

if($connection->http_code == '200')

{

//Redirect user to twitter

$_SESSION['status'] = 'verified';

$_SESSION['request_vars'] = $access_token;


//Insert user into the database

$user_info = $connection->get('account/verify_credentials');

$name = explode(" ",$user_info->name);

$fname = isset($name[0])?$name[0]:'';

$lname = isset($name[1])?$name[1]:'';

//var_dump($user_info);

$UserData = array(

'oauth_provider'=> 'twitter',

'oauth_uid' => $user_info->id_str,

'first_name' => $fname,

'last_name' => $lname,

'picture' => $user_info->profile_image_url,

//'link' => $json['data']['link']

);

// put info in session

$_SESSION['UserData']['oauth_provider']=$UserData['oauth_provider'];

$_SESSION['UserData']['oauth_uid'] =$UserData['oauth_uid'];

$_SESSION['UserData']['oauth_email']=$UserData['email'];

$_SESSION['UserData']['picture']=$UserData['picture'];



//$db_user = new Users();

//$db_user->checkUser('twitter',$user_info->id,$user_info->screen_name,$fname,$lname,$user_info->lang,$access_token['oauth_token'],$access_token['oauth_token_secret'],$user_info->profile_image_url);



//Unset no longer needed request tokens

unset($_SESSION['token']);

unset($_SESSION['token_secret']);


//header('Location: index.php');

//die;

$dbobj->setTable('users');

if (!isset($userexist) )

$userexist = $dbobj->getAllData('*', 'oauth_uid', $_SESSION['UserData']['oauth_uid'], 'asc', 1, 'id');

//die;

if ($userexist == FALSE) {

header('Location:login.php?error=login');

}



else{

if (isset($UserData))

$dbobj->EditData($UserData,$userexist[0]['id']);

// set session and header to profile

setLog($userexist[0]['id']);

header('Location:profile.php');

}

}else{

die("error, try again later!");

}

include './view/register_form_brand.php';

}

else if (isset($_GET['method']) && $_GET['method']=='email'){



include './view/elogin_form.php';

}









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

te2442r2,ajdEzcvyrdaGGDX3gBZfu5,S5GZ,UlGjBMntboz7hOx,7WoDaZvPYVZpc2TPq8p zpI2hUJv
ol3uzdMH,JhI9xo,FzG131BfGQWR AgZ0ezLEK2 fJRyo33 3BbyT9f87CV mtk,IyZ TUEtwvcDfh,bFdUil2Wp7

Popular posts from this blog

Rothschild family

Cinema of Italy