1
<?php
if($_POST){
$nome = $_POST['nome'];
$pass = $_POST['pass'];
require_once 'connect.php';
$cons = "SELECT * FROM usuario;";
$execute = $mysqli->query($cons) or die ($mysqli->error);
if($execute){
while($rows = $execute->fetch_assoc()){
$regist[] = $rows;
}
}else{
$regist=[];
}
if($nome === $regist['nome'] && $pass === $regist['senha']){
if($_POST['continuar']){
setcookie('nome', $nome, time()+60*60*12);
setcookie('pass', $pass, time()+60*60*12);
}
session_start();
$_SESSION['nome'] = $nome;
}else{
$men = "Nome ou Senha incorreto(s)!";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
</head>
<body>
<div class="container">
<div class="row">
<h3>Login</h3>
<form method="post">
<div class="form-group">
<label>Nome: </label>
<input type="text" name="nome">
</div>
<div class="form-group">
<label>Senha: </label>
<input type="password" name="pass">
</div>
<div class="form-group">
<label>Continuar Conectado: </label>
<input type="checkbox" name="continuar">
</div>
<div class="form-group">
<button class="btn btn-success" name="loga">Login</button>
</div>
</form>
</div>
</div>
</body>
</html>
What is line 18?
– Giancarlo Abel Giulian
from what I count, line 18 is
$_POST['continuar']
this error indicates that the array position does not exist. To verify the existence, do the following:if (isset($_POST['continuar'])) {
– marcusagm
Has been resolved
– Mickael Souza