problem on retrieving session userdata

#2
[eluser]Yogesh_89[/eluser]
this is code in Model

function match_info()
{
$this->db->where('user_name', $this->input->post('user_name'));
$this->db->where('password', md5($this->input->post('password')));
$query = $this->db->get('user_login');
if($query->num_rows >=1)
{
return true;
}
}


this is code for welcome page after login

Controller Code

class User extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('form');
$this->load->helper('url');
$this->load->library('session');
$this->is_logged_in();
}
function is_logged_in()
{
$u_name = $this->session->userdata('is_logged_in');
if(!isset($u_name) || $u_name!=true)
{
echo 'You dont have permission to access this page'.anchor('welcome/index', 'Login now');
die();
}
}
function index()
{
$this->load->view('user_welcome');
}
}
I am entering right id and password but i am getting 'You dont have permission to access this page'.anchor('welcome/index', 'Login this line always.

but if i changed config file $config[‘sess_use_database’] = false;
then it working fine. tell me where i am using wrong coding in my code.

Thanks


Messages In This Thread
problem on retrieving session userdata - by El Forum - 10-17-2012, 09:44 AM
problem on retrieving session userdata - by El Forum - 10-17-2012, 09:50 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.