[Ajuda] ERROR PHP
#1

Oin gente,Boa Tarde
Entгo eu estou tendo um erro de autenticaзгo na hora de verificar a senha e o login.
Mais os dados estгo todos certos, pq eu testei com uma pagina com o sistema de login mais simples e foi. e quando testei com o novo fica dando erro.

Index.php
PHP код:
<?php
    session_start
();
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BPS:RPG | User Control Panel</title>
    <link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    
    <!-- Sweet Alert -->
    <link href="assets/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="assets/css/animate.css" rel="stylesheet">
    <link href="assets/css/style.css?rel=1" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="loginColumns animated fadeInDown">
        <div class="row">
            <div class="col-md-6" style="margin: 0 25% 0 25%">
                <div class="login-logo">
                    <a href="">Brasil Paradise <b style="color:#C1033B">Star</b></a>
                </div>
                <div class="ibox-content">
                    <center>Entre em sua conta</center>
                    <form action="config/autentica.php" method="post"  class="m-t" id="formlogin" role="form">
                        <div class="form-group">
                            <span class="fa fa-user"></span>
                            <input id="user-login" type="text" class="form-control" placeholder="Usuбrio" required="">
                        </div>
                        <div class="form-group">
                            <span class="fa fa-lock"></span>
                            <input id="user-senha" type="password" class="form-control" placeholder="Senha" required="">
                        </div>
                        <div class="row">
                            <div class="col-xs-8">
                            </div>
                            <div class="col-xs-4">
                                <button type="submit" class="btn btn-success btn-block btn-flat"><i class="fa fa-check"></i> Login</button>
                            </div>
                        </div>
                    </form><br>
                    <?php if(isset($_SESSION['loginError'])) {
                        echo 
$_SESSION['loginError'];
                        unset(
$_SESSION['loginError']);
                    }
                    
?></br>
                    <a href="#">Esqueci minha senha</a>
                    <center><a href="forum"><i class="fa fa-globe"></i> Fуrum</a> | <a href="#"><i class="fa fa-home"></i> Inнcio</a><br /><br />
                    <font size='-2'>Copyright &copy; 2017-2018 - Brasil Paradise Star<br /><a href="https://www.********.com/">Gabriel Silva</a></font></center>
                    <br />
                </div>
            </div>
        </div>
    </div>
    <!-- Mainly scripts -->
    <script src="assets/js/jquery-2.1.1.js"></script>
    <script src="assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="assets/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <!-- Custom and plugin javascript -->
    <script src="assets/js/inspinia.js"></script>
    <script src="assets/plugins/pace/pace.min.js"></script>
    <!-- Sweet alert -->
    <script src="assets/plugins/sweetalert/sweetalert.min.js"></script>
    </script>
</body>
</html>
autentica.php
PHP код:
<?php
    session_start
();
    include_once(
"conexao.php");
    
    if((isset(
$_POST['username'])) && (isset($_POST['password']))) {
        
$usuario mysqli_real_escape_string($conn$_POST['username']); // Prevenзгo de SQL Injection
        
$senha strtoupper(hash("sha256"$_POST['password'] . "pcacc"));
        
        
$sql "SELECT * FROM users WHERE username = '$usuario' && password = '$senha' LIMIT 1";
        
$result mysqli_query($conn$sql);
        
$resultado mysqli_fetch_assoc($result);
        
        if(empty(
$resultado)) {
            
$_SESSION['loginError'] = "Usuбrio ou senha invбlidos";
            
header("Location: ../index1.php");
        } elseif(isset(
$resultado)) {
            
$_SESSION['username'] = $resultado['username'];
            
$_SESSION['password'] = $resultado['password'];
            
$_SESSION['email'] = $resultado['email'];
            
header("Location: ../pages/inicio.php");
        } else {
            
$_SESSION['loginError'] = "Usuбrio ou senha invбlidos"
            
header("Location: ../index1.php");
        }
        
    } else {
        
$_SESSION['loginError'] = "Usuбrio ou senha invбlidos";
        
header("Location: ../index1.php");
    }
?>
Reply
#2

PHP код:
<form action="config/autentica.php" method="post"  class="m-t" id="formlogin" role="form"
    <
div class="form-group"
        <
span class="fa fa-user"></span
        <
input id="user-login" type="text" class="form-control" placeholder="Usuбrio" required name="username"
    </
div
    <
div class="form-group"
        <
span class="fa fa-lock"></span
        <
input id="user-senha" type="password" class="form-control" placeholder="Senha" required name="password"
    </
div
    <
div class="row"
        <
div class="col-xs-8"
        </
div
        <
div class="col-xs-4"
            <
button type="submit" class="btn btn-success btn-block btn-flat"><class="fa fa-check"></iLogin</button
        </
div
    </
div
</
form
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)