There's an indication from these two lines:
$this->Usuario_model->usuario = $this->input->post('usuario');
$this->Usuario_model->senha = sha1($this->input->post('senha'));
that there are variables inside of the Usuario-model that you have accessed and stored, but the login() function is trying to access variables inside of the scope of the function, not the scope of the model. Using $this-> will allow you to access the private, public, or protected variables of the class that the function lives in. Make sure you try:
public function login(){
$query = $this->db->query("SELECT * FROM usuario WHERE login = '".$this->usuario."' AND senha = '".$this->senha."'");
$query = $query->result();
return $query;
}
To use a PDO-like approach, as per the CI docs, you should instead do:
public function login() {
$query = $this->db->query(
'SELECT * FROM usuario WHERE login = ? AND senha = ?',
array($this->usuario, $this->senha)
)
$query = $query->result();
return $query;
}
This will give you safer queries with escaped user values.
{}button (not the""button).$usuarioand$senhato thelogin()function as parameters.