Welcome Guest, Not a member yet? Register   Sign In
header output and session error
#1

[eluser]mriso[/eluser]
I´m trying to use SESSION library and URL helper, but always get HEADER ERROR

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\Arquivos de programas\xampp\htdocs\ncomp\system\application\controllers\login.php:1)

Filename: libraries/Session.php

Line Number: 662


AND

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\Arquivos de programas\xampp\htdocs\ncomp\system\application\controllers\login.php:1)

Filename: libraries/Session.php

Line Number: 662


I SINCERELY DONT KNOW WHY SINCE I DONT OUTPUTED ANYTHING

<?php

class Login extends Controller {

function Login()
{
parent::Controller();
}

function index()
{
$this->load->helper('url');
$this->load->library('session');

$this->load->model('Do_Login');
$query = $this->Do_Login->checkLogin();

$num_rows = $this->db->affected_rows($query);

if($num_rows > 0){

$row = $query->row();

$newdata = array(
'user' => $row->nome,
'empresa' => $row->empresa,
'email' => $row->email,
'logged_in' => TRUE
);

$this->session->set_userdata($newdata);

}else{
$newdata = array(
'user' => 'failed',
'empresa' => 'failed',
'email' => 'failed',
'logged_in' => FALSE
);

$this->session->set_userdata($newdata);
}

if($this->session->userdata('logged_in') == TRUE){
redirect('index.php/environment/'); # index.php/login/
}else{
redirect('index.php/welcome/'); #index.php/welcome/
}
}
}



?>
#2

[eluser]mriso[/eluser]
i also noted that two "dots" appears on the top of my page. I cant imagine WHERE they came from
#3

[eluser]brianw1975[/eluser]
check every file that gets loaded automatically, and any file you may have edited. like config.php, database.php, index.php
#4

[eluser]mriso[/eluser]
i checked! there is nothing being autoloaded, and on my files. The two dots only appears on google chrome, not in FF
#5

[eluser]mriso[/eluser]
my form is calling the controller i put above:

action="index.php/login/"
#6

[eluser]wiredesignz[/eluser]
Check for whitespace outside of the <?php ... ?> tags in login.php.
#7

[eluser]mriso[/eluser]
i did... but still not working!
#8

[eluser]mriso[/eluser]
in fact, this error appears even if I autoload

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\Arquivos de programas\xampp\htdocs\ncomp\system\application\controllers\welcome.php:1)

Filename: libraries/Session.php

Line Number: 662

in the welcome page
#9

[eluser]mriso[/eluser]
FOR GOD´S SAKE

my documents were all with "BOM UTF-8 signature"
so thats why were not working ... púff

hours lost to this ... ;(

now it is ok

THX!!!!




Theme © iAndrew 2016 - Forum software by © MyBB