I am using the latest version of Codeigniter, the NetBeans program for the code and XAMPP.
In the controller I have the following code (it's called Sesion.php):
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Sesion extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('url');
$this->load->library('session');
$this->load->model('usuario');
}
public function index()
{
if (!$this->input->post()) { //SI NO HAY POST
$cuerpo['c1'] = $this->load->view('form_sesion', '', true); //CARGA LA VISTA
$this->load->view('plantilla', array('cuerpo' => $cuerpo));
} else { //SI HAY POST
$usuario = $this->usuario->ExisteUsuario($this->input->post('user'), $this->input->post('pass'));
//MIRAR SI EXISTE EL USUARIO DE QUE TIPO ES
$this->Entrar($usuario); //MANDA A SU CONTROLADOR
}
}
In the model (it's called Usuario.php):
PHP Code:
<?php
class Usuario extends CI_Model{
public function __construct() {
parent::__construct();
}
public function ExisteUsario($user, $pass){
if($user === "usuario" && $pass == "admin") {
return "vale";}
}
}
The error:
PHP Code:
An uncaught Exception was encountered
Type: Error
Message: Call to undefined method Usuario::ExisteUsuario()
Filename: C:\xampp2\htdocs\matsa\application\controllers\Sesion.php
Line Number: 24
Backtrace:
File: C:\xampp2\htdocs\matsa\index.php
Line: 315
Function: require_once
Note: the function receives the two variables perfectly
I think that it should work but I do not know what happens, I hope you can help me. Regards!