I need to make a query if the user is active. Ex.
My client logs in to the panel, if my status is disabled, it shows me a message, if my status is active on the page.
follow my code
<?php
// inclui o arquivo de inicialização
include_once('assets/conn/init.php');
// resgata variáveis do formulário
$email = isset($_POST['email']) ? $_POST['email'] : '';
$password = isset($_POST['senha']) ? $_POST['senha'] : '';
// cria o hash da senha
$passwordHash = make_hash($password);
$PDO = db_connect();
$sql = "SELECT * FROM usuarios WHERE email = :email AND senha = :password";
$stmt = $PDO->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':password', $passwordHash);
$stmt->execute();
$users = $stmt->fetchAll(PDO::FETCH_OBJ);
//Se o email não existir na base de dados gera um alerta
if (count($users) <= 0):
header('Location: index.php?msg=1');
exit;
endif;
// pega o primeiro usuário
$user = $users[0];
session_start();
$_SESSION['logged_in'] = true;
$_SESSION['user_id'] = $user['usuario_id'];
$_SESSION['nome'] = $user['nome'];
$_SESSION['email'] = $user['email'];
$_SESSION['nivel_usuario'] = $user['nivel_usuario'];
header('Location: home.php');