Welcome Guest, Not a member yet? Register   Sign In
Header Issue
#1

[eluser]eabihaydar[/eluser]
I have this Error:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/validation/system/application/controllers/login.php:72)

Filename: libraries/Session.php

Line Number: 662



My Controller's Code is:

Code:
<?php

class Login extends Controller {


    function __construct()
    {
       parent::Controller();
       $this->load->helper('url');
      
       $this->load->model('verify');
    }
    
    
    function index()
    {
        
    
        if ($this->session->userdata('logged_in') == TRUE)
         {
            redirect('gallery');
        }
        
        $this->load->view('myform');
    }
    
    
    
    
    function plogin()
    {
    
    
       $view_data = array();
    
        
        $user = $this->input->post('username');
        $pass = $this->input->post('password');
    
    
        if( ! $this->verify->is_valid($user, $pass))
        {
            $view_data['error'] = "Invalid username or password";
                $this->load->view('myform', $view_data);
            return;
            
        }
        
        $newdata = array(
                        'username' => $user,
                        'logged_in' => TRUE
                        );
                                        
        $this->session->set_userdata($newdata);
    
        
        


    }
    
    function logout()
    {
        $this->session->sess_destroy();
    }
        
    
    
}
?>


How can I solve it?
Many Thanks
#2

[eluser]GSV Sleeper Service[/eluser]
99% of the time this problem is caused by whitespace after the closing php tag, just remove the closing php tag and see if that fixes it.
#3

[eluser]Stefano G[/eluser]
I agree with the previous comment, even because the script is 71 lines long and the error is on the line no.72 Wink

Stefano




Theme © iAndrew 2016 - Forum software by © MyBB