1
I have 6 pages in PHP, two of them present me problems:
- php entry. (where are the database connection data)
- php client. (is the login page, only html formatting)
- login.php (file that checks and logs in)
- vip.php (is the page restricted to registered users)
- php. (is a registration page, only html formatting)
- register.php (file that checks and performs the registration)
The connection page php entry. is working, I say this because the registration system works perfectly (php. and register.php)
The problem is in logging in, it used to work normally, but after updating the styles (!) simply this part stopped working, I tried other codes, but I could not by my inexperience in php, follows the problematic codes (in parts):
vip.php - Page with the Session
<?php
session_start();
if(!isset($_SESSION['documentoSession']) AND !isset($_SESSION['contratoSession'])){
header("Location: cliente.php");
exit;
}
?>
php client. - Who logs in, or should log in
<?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";
}
?>
php client. - html login code (because it is 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> | Á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>
The file login.php ? Enter the login form code
– César Sousa
is named as.php input
– The Guilherme Henrique
Enter the login form code
– César Sousa
Make a mistake ? what happens ?
– César Sousa
put the code, no error appears, just back to the login screen, as you should do if the document or contract (user and password of this scheme) was wrong, but this is not the problem...
– The Guilherme Henrique
in.php client use session_start() at the beginning of the page, just below the php opening tag. I do not know if it will be the solution of the problem, but it is a good practice.
– zwitterion