Login with mysql always gives the error Not Found - 404

-1

I'm creating a login and it constantly gives the page error not found. I have the code here:

<?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 to say: NOT FOUND 404.

    
asked by anonymous 08.09.2018 / 18:34

1 answer

-1

Hit the quotation marks of this line and see if it solves: $ LoginErro="There is no user with this data
Login"; When I checked your code I noticed that there were missing 'single quotes' to close the path to index.php

    
09.09.2018 / 06:56