Part of the EllisLab Network
   
 
Problem while loding page
Posted: 04 July 2009 05:55 AM   [ Ignore ]  
Summer Student
Total Posts:  16
Joined  06-20-2009

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?

Profile
 
 
Posted: 04 July 2009 06:59 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  119
Joined  03-19-2008

Check the following.

/application/config/config.php

$config['index_page'] = "index.php";

Should be

$config['index_page'] = "";

in future please wrap code in the proper bbcode code tags smile

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120614 Total Logged-in Users: 60
Total Topics: 126649 Total Anonymous Users: 2
Total Replies: 665775 Total Guests: 537
Total Posts: 792424    
Members ( View Memberlist )