[eluser]IEDani[/eluser]
Hi,
I am searching the error but I don´t find it...
----------------
This is the error:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/x.com/httpsdocs/CodeIgniter/system/application/models/acceso_model.php:23)
Filename: libraries/Session.php
Line Number: 662
----------------
This is the code of acceso_model.php, the document that sent the headers (¿?):
<?php
class Acceso_Model extends Model {
function Acceso_Model(){
// Call the Model constructor
parent::Model();
}
function esValido($usuario,$contrasenia){
//compruebo que el usuario existe
$sql='SELECT * FROM Usuarios WHERE usuario=?';
$query = $this->db->query($sql,array($usuario));
$acceso=($query->num_rows() > 0);
//si el usuario existe compruebo que su clave es correcta
if ($acceso){
$row = $query->row();
$acceso= $row->contrasenia == md5($contrasenia);
}
return $acceso;
}
}
?>
----------------
This is a piece of the code of acceso.php, that fix the session and call to acceso_model.php
.......
$this->load->model("Acceso_Model");
if ($this->Acceso_Model->esValido($usuario,$contrasenia)){
$this->load->library('session');
$datosAcceso = array(
'usuario' => $usuario,
'logado' => TRUE
);
$this->session->set_userdata($datosAcceso);
............
--------------------------
I am sure that we can solve it!
Thaks you so much!
Dani