Auto commit: 2025-12-09T17:21:30.844Z

This commit is contained in:
Flatlogic Bot 2025-12-09 17:21:30 +00:00
parent ff29cd60e7
commit 2ba4a6a8ee
4 changed files with 95 additions and 1 deletions

48
contact.php Normal file
View File

@ -0,0 +1,48 @@
<?php
$message = '';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
require_once __DIR__ . '/mail/MailService.php';
$name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$body = filter_var($_POST['message'], FILTER_SANITIZE_STRING);
$result = MailService::sendContactMessage($name, $email, $body);
if (!empty($result['success'])) {
$message = '<div class="alert alert-success">Thank you for your message. We will get back to you shortly.</div>';
} else {
$message = '<div class="alert alert-danger">Sorry, there was an error sending your message. Please try again later.</div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contact Us</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h1>Contact Us</h1>
<p>Fill out the form below to get in touch with us.</p>
<?php if ($message) echo $message; ?>
<form action="contact.php" method="post">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</body>
</html>

31
db/migrate.php Normal file
View File

@ -0,0 +1,31 @@
<?php
require_once __DIR__ . '/config.php';
function run_migrations() {
$pdo = db();
$migrations_dir = __DIR__ . '/migrations';
$files = glob($migrations_dir . '/*.sql');
if (empty($files)) {
echo "No migration files found.\n";
return;
}
sort($files);
foreach ($files as $file) {
echo "Running migration: " . basename($file) . "...\n";
$sql = file_get_contents($file);
try {
$pdo->exec($sql);
echo "Success.\n";
} catch (PDOException $e) {
echo "Error running migration: " . $e->getMessage() . "\n";
// Exit on first error
return;
}
}
}
run_migrations();

View File

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS `users` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`password_hash` VARCHAR(255) NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -59,6 +59,9 @@ error_reporting(E_ALL);
<li class="nav-item">
<a class="nav-link" href="#features">For Caregivers</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.php">Contact</a>
</li>
<li class="nav-item ms-lg-3">
<a class="btn btn-outline-secondary btn-sm" href="#">Sign In</a>
</li>
@ -163,7 +166,7 @@ error_reporting(E_ALL);
<p>
<a href="#">Privacy Policy</a> |
<a href="#">Terms of Service</a> |
<a href="#">Contact Us</a>
<a href="contact.php">Contact Us</a>
</p>
</div>
</footer>