Bunch of Errors [Undefined Inded]

Alright, so I’m getting this on my page:

“Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Notice: Undefined index: HTTP_REFERER in /home/paulmc1/domains/kuarrel.tk/public_html/index.php on line 16 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Fatal error: Class ‘MongoClient’ not found in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/Log.php on line 29”

SessionData.PHP

[php]<?PHP

//Error Checking
ini_set(‘display_errors’,1);
error_reporting(E_ALL);

class SessionData{

function __construct($page = 'default'){
	$this->SetSession($page);
}


public function SetSession($page = 'default'){
		$currentCookieParams = session_get_cookie_params(); 

	$rootDomain = 'kuarrel.tk'; 

	session_set_cookie_params( 
		$currentCookieParams["lifetime"], 
		$currentCookieParams["path"], 
		$rootDomain, 
		$currentCookieParams["secure"], 
		$currentCookieParams["httponly"] 
	); 
	session_start();
	$this->authData = $_SESSION['authData'];

	if($_SESSION['authData']['accountstatus']=="-1" && $page=="default")
	echo $page;
		header("Location: account.php");
		exit();
	}
		/*
		Currently Known Values
		
		$this->authData['email']        
 		$this->authData['id']              
 		$this->authData['name']       

		*/

}				

public function Retrieve($name){
	if( in_array($name,$this->validSessVars()) && isset($this->authData[$name]) ){
			return($this->authData[$name]);
	}
	return(FALSE);
}		

public function RetrieveAll(){
	return($this->authData);
}

private function validSessVars(){
	$valid=array();
	$count=0;
	if(is_array($this->authData))
	foreach($this->authData as $key => $value){
		$valid[$count]=$key;
		$count++;
	}
	return($valid);	
}
	
	
public function Logout(){
		unset($authData);
		$_SESSION['authData'] = $authData;
		header("Location: http://".$_SERVER["HTTP_HOST"]."/index.php");
		exit();
}

public function Login(){
			unset($authData);
			$_SESSION['authData'] = $authData;
			header("Location: http://".$_SERVER["HTTP_HOST"]."/login.php");
			exit();
	}	

public function CheckValidSession(){
	if(is_array($this->authData)&&$this->authData['id']>0){
		return(TRUE);
	}
	return(FALSE);
}	

public function CheckValidFBSession(){
	if (!$this->CheckValidSession()){
		header('location: bind.php');
	}

}	


public function CheckValidAdminSession(){
	if($this->authData['accountstatus']==9){
		return(TRUE);
	}
	return(FALSE);
}	

}

?>
[/php]

Index.PHP

[php]<?php

//Error Checking
ini_set(‘display_errors’,1);
error_reporting(E_ALL);

include($_SERVER[“DOCUMENT_ROOT”].’/admin/classes/classes.php’); // Include local class lib

$sess = new SessionData(); // Creates session object
//$sess->CheckValidFBSession();

if($sess->CheckValidSession()){
header(‘Location: home.php’);
}

$log= new log($_SERVER[“PHP_SELF”], $_GET, $_POST, $_SERVER[‘HTTP_REFERER’] );
$stats=new Statistics();
$totalusers=$stats->totalscope();

?>

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId   : '<?php echo $sess->fbappid; ?>',
      session : <?php echo json_encode($sess->fbsession); ?>, // don't refetch the session when PHP already has it
      status  : true, // check login status
      cookie  : true, // enable cookies to allow the server to access the session
     xfbml   : true // parse XFBML
    });

  };

  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
  }());
</script>
Kuarrel | Welcome to Kuarrel!
Register  
<?PHP
		if(!$sess->CheckValidSession()){			
			include('modules/default/topnav.php');
		}else{
			include('modules/loggedin/topnav.php');		  
		}
		?>                   <td bgcolor=#3B5998 width=100%>&nbsp;</td> 
      </tr></table></td> 
      </tr></table> 
  </td></tr></table> 
<?PHP
		if(!$sess->CheckValidSession()){			
			include('modules/default/leftnav.php');
		}else{
			include('modules/loggedin/leftnav.php');		  
		}
		?>
                  </td></tr>  
  </table> 
  </td><td width=595 valign=top> 
    <table class="bordertable" cellspacing=0 cellpadding=0 border=1 width=100%><tr><td> 
Welcome to Kuarrel!

[ Welcome to Kuarrel ]
 

<?=(!empty($_GET['error']));?>"Facebook login has been disabled for today, please try again tomorrow.

Kuarrel is an online directory that connects people from Facebook through social networks.

We have opened up Kuarrel for popular consumption at all colleges and universities. If you are not part of a college or university, you will be added to the default Kuarrel network.

Your account is limited to your own college or university.

You can use Kuarrel to:
   Search for people at your school
   Find out who are in your classes
   Look up your friends' friends
   See a visualization of your social network

To get started, click below to register with your facebook account. <?php if(strlen($_SESSION['notpartofacollege'])>2){ echo "".$_SESSION['notpartofacollege'].""; } ?>

  
 
<?PHP include('modules/default/bottomnav.php'); ?>

[/php]

Log.PHP

[php]<?PHP

//Error Checking
ini_set(‘display_errors’,1);
error_reporting(E_ALL);

class log{

public function __construct($page, $get= '', $post = '', $ref = '') {

	$sess = new SessionData('account');	
	if($sess->CheckValidSession()){	
		$userid=$sess->Retrieve('id');
	}else{
		$userid="0";
	}
	
	if($userid=='45403199'){
		return false;
	}
	
	
	if(!$ref) $ref="";
	
	$ip=$_SERVER["REMOTE_ADDR"];
	

	$values=array('page'=>$page,'ip'=>$ip,'userid'=>$userid, 'timestamp'=>(int) time(), 'gets'=>$get, 'posts'=>$post, 'referral'=>$ref); 
	$m = new MongoClient();
	$collection = $m->selectCollection('kuarrel', 'log');
	$collection->insert($values);

	if($ip=='202.94.191.47'||$ip=='202.94.191.13'||$ip=='202.94.191.183'){
		echo "Your address: ".$ip." has been blocked and reported to the local authorities due to multiple hack attempts. Please contact kuarrelhelpdesk@gmail if you feel this is an error.";
		die(); 
	}
}

function lastpage($userid){
	$m = new MongoClient();
		$collection = $m->selectCollection('thefacebook', 'log');
		$cursor = $collection->find(array('userid'=>$userid));
		$cursor->sort(array('timestamp'=>-1))->limit(2);
		$records = iterator_to_array($cursor);
		
		return($records[1]['page']);
}

}
?>[/php]

"Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Notice: Undefined index: HTTP_REFERER in /home/paulmc1/domains/kuarrel.tk/public_html/index.php on line 16 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 27 Notice: Undefined index: authData in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/SessionData.php on line 29 Fatal error: Class 'MongoClient' not found in /home/paulmc1/domains/kuarrel.tk/public_html/admin/classes/lib/Log.php on line 29"

In simple English…

Notice: Undefined index: authData

Means your accessing a session variable that was created or doesn’t exist, most people will wrap it the statement in ISSET to test if it was set…

[php]IF (ISSET($_SESSION[‘authData’])) { Do something;}[/php]

If it’s suppose to be set and it’s not, that’s a different problem

Class 'MongoClient' not found

Means that you are created an object from the MongoClient class, but that class is not included in your log.php - Seems like you’re missing an include statement.

Sponsor our Newsletter | Privacy Policy | Terms of Service