1
This commit is contained in:
parent
92dd1173f1
commit
cdea76c2a4
86
contact.php
Normal file
86
contact.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/mail/MailService.php';
|
||||
|
||||
$success_message = '';
|
||||
$error_message = '';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$name = strip_tags(trim($_POST["name"]));
|
||||
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
|
||||
$message = trim($_POST["message"]);
|
||||
|
||||
if (empty($name) || empty($message) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$error_message = "Por favor, preencha todos os campos corretamente.";
|
||||
} else {
|
||||
$to = getenv('MAIL_TO') ?: 'support@flatlogic.com'; // Fallback email
|
||||
$subject = "Nova mensagem de contato de $name";
|
||||
|
||||
$res = MailService::sendContactMessage($name, $email, $message, $to, $subject);
|
||||
|
||||
if (!empty($res['success'])) {
|
||||
$success_message = "Obrigado! A sua mensagem foi enviada com sucesso.";
|
||||
} else {
|
||||
$error_message = "Ocorreu um erro ao enviar a sua mensagem. Tente novamente mais tarde.";
|
||||
// Optional: Log the detailed error: error_log($res['error']);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Contato - Gestão Imobiliária</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
.contact-form {
|
||||
max-width: 600px;
|
||||
margin: 50px auto;
|
||||
padding: 30px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="contact-form">
|
||||
<h2 class="text-center mb-4">Entre em Contato</h2>
|
||||
|
||||
<?php if(!empty($success_message)): ?>
|
||||
<div class="alert alert-success"><?php echo $success_message; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(!empty($error_message)): ?>
|
||||
<div class="alert alert-danger"><?php echo $error_message; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form action="contact.php" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nome</label>
|
||||
<input type="text" class="form-control" id="name" name="name" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" id="email" name="email" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="message" class="form-label">Mensagem</label>
|
||||
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
||||
</div>
|
||||
<div class="d-grid">
|
||||
<button type="submit" class="btn btn-primary">Enviar Mensagem</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="text-center mt-3">
|
||||
<a href="index.php">Voltar à página inicial</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -141,6 +141,7 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
<p><a href="contact.php" style="color: white;">Contact Us</a></p>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user