<?php
if (!$C->LOGIN_WITH_TWITTER) {
	$this->redirect($C->SITE_URL);	
} else {	
	require_once("twitter/twitteroauth.php");
	
	$twitteroauth = new TwitterOAuth($C->TW_APPID, $C->TW_SECRET);
	
	$callBack = $C->SITE_URL.'oauthtwitterData';
	$request_token = $twitteroauth->getRequestToken($callBack);
	
	$_SESSION['oauth_token'] = $request_token['oauth_token'];
	$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
	
	if ($twitteroauth->http_code != 200) {
		die('Ups. Looks like there was an error.');
	} else {
		$url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']);
		header('Location: ' . $url);
	}
}
?>