0
I’m not being able to include pages in my file controle_login.php, as it generates the following errors:
Notice: Use of Undefined Constant ABSPATH - assumed 'ABSPATH' in C: xampp htdocs Modelo_mvc controlles controle_login.php on line 2
Warning: require_once(ABSPATH/models/model_login): failed to open stream: No such file or directory in C: xampp htdocs Modelo_mvc controlles controle_login.php on line 2
Fatal error: require_once(): Failed Opening required 'ABSPATH/models/model_login' (include_path='C: xampp php PEAR') in C: xampp htdocs Modelo_mvc controlles controle_login.php on line 2
I’m gonna post the codes 'cause there’s weeks that I can’t figure out what’s going on.
config.php file
Filing cabinet controle_login.php (this file is inside a folder called controlles)
<?php
require_once ABSPATH.'/models/model_login.php';
class Controlador extends Controle_login{
    public function __construct(){
        $obj = new Controle_login;
    }
Filing cabinet model_login.php (this file is inside the models folder)
<?php
require_once ABSPATH.'conexao.php';
class Controle_login{
    private $con;
    public function __construct {
        $con = new Conexao();
    }
    public function controle_acesso($usuario, $senha){
        $this->setUsuario($usuario);
        $this->setSenha($senha);
        $consulta = $this->con->conectar()->prepare("SELECT COUNT(*) AS total FROM login WHERE usuario=:usuario AND senha=:senha");
        $consulta->bindParam(":usuario", $this->usuario);
        $consulta->bindParam(":senha", $this->senha);
        $consulta->execute();
        $linha = $consulta->fetch(PDO::FETCH_ASSOC);
        return $linha['total'];
    }
}



I did exactly as you explained and it worked :) Thanks for your help
– sol25lua