-1
I am creating a login and constantly gives the page error not found. I have here the code:
<?php
//iniciar sessão
session_start();
include('includes/config.php');
$LoginErro = "Não existe utilizador com esses dados<br><a href=.../index.php>Login</a>";
if((isset($_POST['UserName']) && isset($_POST['Password'])) || (isset($_SESSION['UserEntrou']))){ #Valida se o usuário está logando ou já está logado
require('includes/config.php'); #conexão com o Banco de Dados
if(isset($_POST['UserName']) && isset($_POST['Password'])){ #Caso o usuário esteja logando
$queryUser1 = mysqli_query($mysqli, "SELECT * FROM admin WHERE UserName = '$_POST[UserName]' AND Password = '$_POST[Password]' LIMIT 1");
if(mysqli_num_rows($queryUser1) != 0){
if($queryUser = mysqli_fetch_assoc($queryUser1)){
//echo $queryUser['UsrNome'].', você conseguiu completar todo o passo a passo do sistema de Login!<br>Parabéns!!!'; #Nào vamos mais usar essa linha, somente na v1
$_SESSION['UserEntrou'] = $queryUser['admin_ID']; #Salva em uma variável de Sessão a ID do usuário que está logado
header('Location: paginainicial.php');
}else{
echo $LoginErro;
}
}else{
echo $LoginErro;
}
}else{ #Caso o usuário já esteja logado
$QueryLogado = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT admin_ID, Password, UserName, PerfilID FROM admin INNER JOIN TipoPerfil ON TipoPerfil = PerfilID;"));
echo "<script type='text/javascript'> document.location = 'paginainicial.php'; </script>";
}
}else{
//return false;
header('Location: ../index.php');
}
?>
When I enter the program to log in, nothing appears except the warning: NOT FOUND 404.