Jump to content

Unexpect T_CLASS error


magic2goodil

Recommended Posts

Can anyone help me figure out why I am getting this error:

[code]Parse error: parse error, unexpected T_CLASS in /home/collegeb/public_html/registerAPI/cbx_facebookAPI.class.php on line 13[/code]

With this code:

[code]<? php

/***********************************************************
*  @CollegeBookX Facebook API
*  @Author:  Josh Robison
*  @Date:    Jan. 13, 2007
*
*  @Objectives:  To allow the registering user to click on the
*  facebook icon on the register.php page and pull in their
*  facebook info to fill in part of the registration form.
************************************************************/

class cbx_facebookAPI {

// ### Class Variables ###

var $config; // array to hold API variables
var $facebook; // holds Facebook object
var $session; // holds Facebook session
var $user_info; // array to hold Facebook User Info before fix
var $user; // array to hold fixed user information


// ### cbx_facebookAPI class construct ###

function __construct() {

// ##### INCLUDE CLASS #####

include('facebook.php');

// ### Registered API Variables ###

$this->config = array();
$this->config['api_key'] = "**********";
$this->config['secret'] = "**********";
$this->config['next'] = 'index.php';

} // ### End __construct() ###




// ### Make Connection and Pull User Info from Facebook ###

function doConnect() {


if (!empty($_REQUEST['auth_token'])) {

// ##### INITIATE FACEBOOK CLASS #####

$this->facebook = new Facebook ($config['api_key'], $config['secret'], null, false, false, false);

// ##### SET SESSION INFORMATION #####

$this->session = $facebook->auth_getSession ($_REQUEST['auth_token']);

// ##### SET COOKIES #####

setcookie('facebook_session_key', $this->session[0]['elements'][0]['text']);
setcookie('facebook_uid', $this->session[0]['elements'][1]['text'], time()+60*60*24);

// ##### REDIREC TO CHAT #####

header('Location: ' . $_SERVER['PHP_SELF']);
} // End IF



else {

// ##### CHECK FOR USER LOGGED IN #####

if (empty($_COOKIE['facebook_session_key'])) {

// ##### REQUIRE LOGIN #####

header('Location: http://api.facebook.com/login.php?api_key=' . $config['api_key'] . '&next=' . $config['next']);
} // End IF

// ##### INITIATE CLASS #####

$this->facebook = new Facebook ($config['api_key'], $config['secret'], $_COOKIE['facebook_session_key']);

// ##### PULL USER INFO #####

$this->user_info = $this->facebook->users_getInfo ($_COOKIE['facebook_uid'], 'first_name,last_name,current_location,affiliations');

$this->user = array();
$this->user['firstname'] = $this->user_info[0]['elements'][0]['elements'][0]['text'];
$this->user['lastname'] = $this->user_info[0]['elements'][0]['elements'][1]['text'];


// ##### CHECK FOR EXPIRED SESSION #####

if ($username == '102_Session key invalid or no longer valid') {

setcookie('facebook_session_key', '');
setcookie('facebook_uid', '');
header('Location: ' . $_SERVER['PHP_SELF']);
print_r($_COOKIE);
} // End IF



} // End Else


} // ### End doConnect() ###



// ### GET USER INFO FUNCTION ###

function get_userinfo() {

return $this->user;

}


} // End cbx_facebookAPI class


?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34063-unexpect-t_class-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.