PHP codes register but not login

1

I have 6 pages in PHP, two of which present me with problems:

  • entry.php (where the database connection data is)
  • client.php (this is the login page, html formatting only)
  • login.php (file that checks and logs in)
  • vip.php (this page is restricted to registered users)
  • cadastro.php (it's a registration page, just html formatting)
  • cadastrar.php (file that confers and registers)

The connection page input.php is working, I say this because the registration system works perfectly ( cadastro.php and cadastrar.php )

The problem is to log in, it used to work normally, but after updating the styles (!), that part stopped working, I tried other codes, but I could not get my inexperience in php, follow the problematic codes parts):

vip.php - Session Page

    <?php
session_start();

if(!isset($_SESSION['documentoSession']) AND !isset($_SESSION['contratoSession'])){
    header("Location: cliente.php");
    exit;
}
   ?>

client.php - What does, or should I do, login

   <?php

//Conexão com o banco de dados
include "entrada.php";

// Inicia a sessão
session_start(); 

//Dados preenchidos no formulário
$documento = $_POST['documento'];
$contrato = $_POST['contrato'];

//Comparação e validação dos dados
$sql_acesso = mysql_query("SELECT * FROM iAzulDataBase WHERE Documento = '$documento' AND Contrato = '$contrato'");

if(mysql_num_rows($sql_acesso) == 1){

    $_SESSION['documentoSession'] = $documento;
    $_SESSION['contratoSession'] = $contrato;
    include "iAzulVIP.php";

}else{

    unset($_SESSION['documentoSession']);
    unset($_SESSION['contratoSession']);
    include "cliente.php";
}
?>

client.php - html login code (for being a private code, part was removed)

<html>
<head>
</head>  

<body class="metro" onLoad="setFocus()">


    <div class="total">
    <div class="pagina">
    <div class="logotipo">
    <h1><a href="#"><img src="Lion/Logotipo.png" alt="x" width="300px"></a></h1></div>
            <div class="acessorapido">
        <h2 class="text-info"><i class="fa fa-user-plus"></i>&nbsp;|&nbsp;Área do Cliente</h2>
        <h4 class="text-info">Acesse aqui sua página exclusiva x</h4></div><br>

    <div class="acessorapido">
    <div class="database_center">
        <form action="login.php" method="post">
        <fieldset><br>

            <strong>CPF ou CNPJ:</strong><br>
            <div class="input-control text size4">
            <input type="number" name="documento" id="documento" />
            </div><br>

            <strong>Nº do Contrato:</strong><br>
            <div class="input-control text size4">
            <input type="number" name="contrato" />
            </div><br>

            <div class="alinharbutao">
            <button type="submit" class="large button info" name="login">Acessar</button>
            </div><br>

        </fieldset>
        </form>

    </div></div><!--Fim do Formulário de Cadatro-->

</body>
</html>
    
asked by anonymous 28.02.2015 / 19:47

1 answer

1

Make a test where you put it to give include if login is successful remove the include and put

echo "
<script>
    window.location = 'iAzulVIP.php';
</script>
";

See and say the result

    
28.02.2015 / 20:03