(Sem Título)
(Sem Título)
// Iniciar a sessão session_start(); // Verificar se o usuário já fez o login, redirecioná-lo se sim if (isset($_SESSION['username'])) { header("Location: painel.php"); // Altere "painel.php" para a página desejada após o login exit(); } // Verificar se o formulário de login foi enviado if ($_SERVER["REQUEST_METHOD"] == "POST") { // Aqui você deve incluir a lógica para verificar as credenciais do usuário $ $username = "usuario"; // Altere isso para o nome de usuário válido $password = "senha"; // Altere isso para a senha válida if ($_POST['username'] == $username && $_POST['password'] == $password) { // Iniciar a sessão e redirecionar o usuário para o painel $_SESSION['username'] = $username; header("Location: painel.php"); // Altere "painel.php" para a página desejada após o login exit(); } else { $ $error_message = "Credenciais incorretas. Por favor, tente novamente."; } } <!DOCTYPE html> <html> <head> <title>Login</title> </head> <body> <h2>Login</h2> <!DOCTYPE html> <html> <head> <title>Login</title> </head> <body> <h2>Login</h <!DOCTYPE html> <html> <head> <title>Login</title> </head> <body> <h2 <!DOCTYPE html> <html> <head> <title>Login</title> </head> <body> <!DOCTYPE html> <html> <head> <title>Login</title> </head <!DOCTYPE html> <html> <head> <title>Login</title <!DOCTYPE html> <html> <head> <title <!DOCTYPE html> <html> <!DOCTYPE html <! if (isset($error_message)) { echo "<p style='color: red;'>$error_message</p>"; } } <form method= < "post" action=""> <label <label for="username">Usuário:</label> <input type="text" id="username" name="username" required><br><br> <label for="password">Senha:</label> <input type= <input type "password" id="password" name="password" required><br><br> <input type= "submit" value="Login"> </form> </body> </html> </form> </body> </form