[eluser]Arivusudar[/eluser]
Hi..
I have created three separate pages for login to the home. first page checking error and validation. and second page for insert some login info in database and third page is my home page.
1. homepage.php
2. login.php
3. home.php
Problem is giving login info to 1st page after confirmation it will go to the 2nd page and 3rd page from 2nd page.. while loading file it contains middle automatically getting index.php but i dont want show.. am using .htaccess file too..
homepage:
<?php
ob_start();
class Homepage extends Controller {
function Homepage()
{
parent::Controller();
}
function index()
{
//$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() == FALSE)
{
//
}
else
{
$username=$_REQUEST['username'];
$password=$_REQUEST['password'];
$this->load->model('excute');
$rec=$this->excute->check_user($username,$password);
if($rec=="yes")
{
$this->load->library('session');
$data = array(
'username' => $username,
'logged_in' => TRUE
);
$this->session->set_userdata($data);
header('Location:login');
}
else
{
$data['err']=$rec;
$data['username']=$_REQUEST['username'];
$data['success']='';
$this->load->view('homepage',$data);
}
}
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */
login:
<?php
class Login extends Controller {
function Login()
{
parent::Controller();
}
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->database();
$this->load->model('excute');
$this->excute->entry_insert();
header("Location:".base_url()."home");
}
}
/* End of file login.php */
/* Location: ./system/application/controllers/login.php */
home:
<?php
ob_start();
putenv("TZ=Asia/Calcutta");
class Home extends Controller {
function Home()
{
parent::Controller();
$this->load->helper(array('form'));
}
function index()
{
$this->load->library('session');
if($this->session->userdata('logged_in')==TRUE)
{
$this->load->helper(array('form', 'url'));
$this->load->database();
$this->load->library('validation');
$this->load->view('header',$data);
$this->load->view('contentleft');
$this->load->view('home',$data);
$this->load->view('footer');
}
else
{
$this->load->helper(array('form', 'url'));
redirect('homepage');
}
}
}
/* End of file home.php */
/* Location: ./system/application/controllers/welcome.php */
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
3rd home page not loading.. 1st file has been reloading..
how to do?