diff --git a/.perm_test_apache b/.perm_test_apache new file mode 100644 index 0000000..e69de29 diff --git a/.perm_test_exec b/.perm_test_exec new file mode 100644 index 0000000..e69de29 diff --git a/admin/index.php b/admin/index.php new file mode 100644 index 0000000..100c2d3 --- /dev/null +++ b/admin/index.php @@ -0,0 +1,6 @@ + + +
Bem-vindo ao painel administrativo. Use o menu à esquerda para gerenciar o conteúdo do seu site.
+ + diff --git a/admin/login.php b/admin/login.php new file mode 100644 index 0000000..14f917b --- /dev/null +++ b/admin/login.php @@ -0,0 +1,69 @@ +prepare("SELECT * FROM users WHERE username = ?"); + $stmt->execute([$username]); + $user = $stmt->fetch(PDO::FETCH_ASSOC); + + if ($user && password_verify($password, $user['password'])) { + // Login bem-sucedido + $_SESSION['user_id'] = $user['id']; + $_SESSION['username'] = $user['username']; + header("Location: index.php"); + exit; + } else { + // Credenciais inválidas + $error_message = "Usuário ou senha inválidos."; + } + } catch (PDOException $e) { + $error_message = "Erro no banco de dados. Se você acabou de criar o painel, execute o script /db/migrate_users.php"; + } + } +} +?> + + + + + +