here, home.php is one controller file and i want to redirect into another controller file login.php but this code is not working. if you have any idea then plz help me...
home.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller{
function __construct(){
parent::__construct();
$this->check_isvalidated();
}
public function index(){
echo 'Congratulations, you are logged in.';
echo "<br /><a href=''.base_url().'home/do_logout'>Logout</a>";
}
private function check_isvalidated(){
if(! $this->session->userdata('validated')){
redirect('login');
}
}
public function do_logout(){
$this->session->sess_destroy();
redirect('login');
}
}
?>