<?php
if (!defined('BASEPATH')) die('No direct script access allowed');
class UserInfo {
var $CI;
var $userId;
var $userDisplayName;
var $userEmail;
var $userThumb;
public function __construct($params = array())
{
$this->CI =& get_instance();
$this->CI->load->helper('url');
$this->CI->config->item('base_url');
$this->CI->load->database(); //Optional if any database interaction needed
$this->getUser();
}
public function getUser(){
if(empty($this->CI->session->userdata('sessionUid'))){
redirect(base_url());
}else{
$this->userId = $this->CI->session->userdata('sessionUid');
$this->userEmail = $this->CI->session->userdata('sessionMail');
$this->userDisplayName = $this->CI->session->userdata('sessionDname');
$this->userThumb = $this->CI->session->userdata('sessionThumb');
}
}
}
?>
Above is my Code where i have created a new Library Class "UserInfo" and auto loading this library in autoload.php
$autoload['libraries'] = array('ActiveRecord','database','session','UserInfo');
However when a session is not exist(here i am checking the session "sessionUid") it should take me to the baseurl but it is throwing
500 error.
if i am commenting that redirect script the page is loading fine.
Any help will be highly appreciated.
Thanks
Smrutikant