Hello, when I log in I redirect to a file called 'config.php' which in turn includes a file called 'user.dao.php'. The problem is that I get the following error:
Warning: include (/opt/lampp/htdocs/projects/centralgames/config/dao/user_us.php): failed to open stream: File or directory not found in / opt / lampp / htdocs / projects / central games / config /valida_login.php on line 9
Warning: include (): Failed opening '/opt/lampp/htdocs/projects/centralgames/config/dao/user_us.php' for inclusion (include_path = '.: / opt / lampp / lib / php') in /opt/lampp/htdocs/projects/centralgames/config/valida_login.php on line 9
Fatal error: Call to undefined function selects_user () in /opt/lampp/htdocs/projects/centralgames/config/valida_login.php on line 11
However, the file exists in the folder specified in the code. As you can see below:
<?php
session_start();
//Recebe os campos da página login
$input_usuario = $_POST['usuario'];
$input_senha = $_POST['senha'];
include (dirname(__FILE__) . '/dao/usuario_dao.php');
$usuario = seleciona_usuario($input_usuario, $input_senha);
//Se o resultado retornar vazio executa
if(empty($usuario))
{
//Mensagem de erro
$_SESSION['login_erro'] = "Usuário e/ou senha inválido(s)! Por favor, tente novamente.";
//Redireciona para a tela de login
header("Location: index.php");
}
else
{
//Sessions que recebem os valores dos campos do banco de dados
$_SESSION['nome_usuario'] = $aluno['nome'];
$_SESSION['acesso_usuario'] = $aluno['permissao'];
$_SESSION['login_usuario'] = $aluno['login'];
$_SESSION['permissao'];
if($_SESSION['acesso_usuario'] == 1)
{
$_SESSION['permissao'] = "Master";
header('Location: menu.php');
}
else
{
$_SESSION['permissao'] = "Usuário";
header("Location: menu_usuario.php");
}
}
The file is exactly in: "/opt/lampp/htdocs/projects/centralgames/dao/username.php".
Ahh and this " dirname(__FILE__)
" I'm using just because I was told to avoid errors when adding directories. If anyone can help me, I appreciate it.