What can I do if I am making a web page and I want to avoid that when the session is started it allows access to the log, but it throws me an error?
Log code
<head>
<meta charset="UTF-8">
<title>Frutillas</title>
</head>
<body>
<?php
session_start();
if ($_SESSION["sessionOK"]=="si"){
header('location:exclusivoSesion.php');
}
?>
<form action="comparacion.php" method="post">
Correo Electronico:
<input type="email" name="email" required>
<br>
<br>
Contraseña:
<input type="password" name="password" required>
<br>
<br>
<input type="submit" value="Enviar">
</form>
</body>
Comparison.php
<?php
$email = filter_input(INPUT_POST, 'email');
$contrasena = filter_input(INPUT_POST, 'password');
include ('acceso.php');
$sql = "select password from usuarios where email='".$email."';";
$sql2 = "select nombre from usuarios where email='".$email."';";
$resultado = $dp->query($sql);
$nombre = $dp->query($sql2);
$row = $resultado->fetch_assoc();
$row2 = $nombre->fetch_assoc();
if ($row['password'] == $contrasena)
{
session_start();
$_SESSION["sessionOK"]="si";
$_SESSION["correo"]=$email;
$_SESSION["nombre"]=$row2['nombre'];
header ('location:exclusivoSesion.php');
}
else {
echo 'usuario o contraseña incorrecta';
echo '<a href="login.php">Ir a login</a>';
}
mysql_free_result($resultado);
mysqli_close($dp);
? >