1
Hello, when I log in I redirect to a file called 'config.php' which in turn includes a file called 'usuario_dao.php'. The problem is that I get the following error:
Warning: include(/opt/lampp/htdocs/projects/centraljogos/config/dao/usuario_dao.php): failed to open stream: File or directory not found in /opt/lampp/htdocs/projects/centraljogos/config/valida_login.php on line 9
Warning: include(): Failed opening '/opt/lampp/htdocs/projetos/centraljogos/config/dao/usuario_dao.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/projetos/centraljogos/config/valida_login.php on line 9
Fatal error: Call to Undefined Function seleciona_usuario() in /opt/lampp/htdocs/projects/centraljogos/config/valida_login.php on line 11
But 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/usuario_dao.php".
Ahh and that "dirname(__FILE__)
" i am using justly because I have been told that I would avoid errors when including directories. If anyone can help me I would appreciate it very much.
missing a directory in the middle, the folder "config":
/opt/lampp/htdocs/projetos/centraljogos/config/dao/usuario_dao.php
– William Novak
Thanks for the help.
– Guilherme Ramalho