Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b07483457 | ||
|
|
bdc6a35cdc | ||
|
|
2ba4a6a8ee | ||
|
|
ff29cd60e7 | ||
|
|
d5e382128a | ||
|
|
86d85bd8aa |
19
api/pexels.php
Normal file
19
api/pexels.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
require_once __DIR__.'/../includes/pexels.php';
|
||||||
|
$q = isset($_GET['query']) ? $_GET['query'] : 'nature';
|
||||||
|
$orientation = isset($_GET['orientation']) ? $_GET['orientation'] : 'landscape';
|
||||||
|
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($q) . '&orientation=' . urlencode($orientation) . '&per_page=1&page=1';
|
||||||
|
$data = pexels_get($url);
|
||||||
|
if (!$data || empty($data['photos'])) { echo json_encode(['error'=>'Failed to fetch image']); exit; }
|
||||||
|
$photo = $data['photos'][0];
|
||||||
|
$src = $photo['src']['large2x'] ?? ($photo['src']['large'] ?? $photo['src']['original']);
|
||||||
|
$target = __DIR__ . '/../assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
download_to($src, $target);
|
||||||
|
// Return minimal info and local relative path
|
||||||
|
echo json_encode([
|
||||||
|
'id' => $photo['id'],
|
||||||
|
'local' => 'assets/images/pexels/' . $photo['id'] . '.jpg',
|
||||||
|
'photographer' => $photo['photographer'] ?? null,
|
||||||
|
'photographer_url' => $photo['photographer_url'] ?? null,
|
||||||
|
]);
|
||||||
203
assets/css/custom.css
Normal file
203
assets/css/custom.css
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
/*-- Google Fonts --*/
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;800&family=Lato:wght@400;700&display=swap');
|
||||||
|
|
||||||
|
/*-- Variables --*/
|
||||||
|
:root {
|
||||||
|
--primary-color: #FF6B6B; /* Vibrant Coral */
|
||||||
|
--secondary-color: #4ECDC4; /* Aqua */
|
||||||
|
--background-color: #F7FFF7;
|
||||||
|
--surface-color: #FFFFFF;
|
||||||
|
--text-color: #2C3E50; /* Dark Slate Blue */
|
||||||
|
--light-gray-color: #f8f9fa;
|
||||||
|
--border-radius: 12px;
|
||||||
|
--font-family-headings: 'Nunito', sans-serif;
|
||||||
|
--font-family-body: 'Lato', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- General Styles --*/
|
||||||
|
body {
|
||||||
|
font-family: var(--font-family-body);
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: var(--font-family-headings);
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding: 12px 30px;
|
||||||
|
font-weight: 700;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #E55B5B; /* Darker coral */
|
||||||
|
border-color: #E55B5B;
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 7px 20px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: var(--secondary-color);
|
||||||
|
border-color: var(--secondary-color);
|
||||||
|
color: var(--surface-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background-color: #3DB8AF; /* Darker aqua */
|
||||||
|
border-color: #3DB8AF;
|
||||||
|
color: var(--surface-color);
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 7px 20px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- Header --*/
|
||||||
|
.navbar {
|
||||||
|
transition: background-color 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transparent-nav {
|
||||||
|
background-color: transparent !important;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.transparent-nav .navbar-brand,
|
||||||
|
.transparent-nav .nav-link {
|
||||||
|
color: var(--surface-color) !important;
|
||||||
|
text-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrolled {
|
||||||
|
background-color: var(--surface-color) !important;
|
||||||
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrolled .navbar-brand,
|
||||||
|
.scrolled .nav-link {
|
||||||
|
color: var(--text-color) !important;
|
||||||
|
text-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-family: var(--font-family-headings);
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- Hero Section --*/
|
||||||
|
.hero-section {
|
||||||
|
padding: 150px 0;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
position: relative;
|
||||||
|
color: white;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section .container {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section h1 {
|
||||||
|
font-size: 4.5rem;
|
||||||
|
font-weight: 800;
|
||||||
|
text-shadow: 0 2px 4px rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section .lead {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
max-width: 650px;
|
||||||
|
margin: 20px auto 40px;
|
||||||
|
text-shadow: 0 1px 3px rgba(0,0,0,0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- Sections --*/
|
||||||
|
.section {
|
||||||
|
padding: 100px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 60px;
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- How it works --*/
|
||||||
|
.how-it-works-icon {
|
||||||
|
font-size: 4rem;
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- Features --*/
|
||||||
|
.feature-card {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
border: none;
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
padding: 40px;
|
||||||
|
box-shadow: 0 10px 30px rgba(0,0,0,0.07);
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card:hover {
|
||||||
|
transform: translateY(-10px);
|
||||||
|
box-shadow: 0 15px 40px rgba(0,0,0,0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card .icon {
|
||||||
|
font-size: 3rem;
|
||||||
|
color: var(--secondary-color);
|
||||||
|
margin-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-- Search Widget --*/
|
||||||
|
#search-widget {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
padding: 50px;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 15px 40px rgba(0,0,0,0.1);
|
||||||
|
margin-top: -80px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-- Footer --*/
|
||||||
|
.footer {
|
||||||
|
background-color: #2C3E50; /* Dark Slate Blue */
|
||||||
|
color: var(--surface-color);
|
||||||
|
padding: 50px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
color: #4ECDC4; /* Aqua */
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a:hover {
|
||||||
|
color: var(--surface-color);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
BIN
assets/images/pexels/1128318.jpg
Normal file
BIN
assets/images/pexels/1128318.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 229 KiB |
BIN
assets/images/pexels/60504.jpg
Normal file
BIN
assets/images/pexels/60504.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
BIN
assets/images/pexels/821754.jpg
Normal file
BIN
assets/images/pexels/821754.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
10
assets/js/main.js
Normal file
10
assets/js/main.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const findCaregiverBtn = document.querySelector('a[href="#search-widget"]');
|
||||||
|
if (findCaregiverBtn) {
|
||||||
|
findCaregiverBtn.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
document.querySelector('#search-widget').scrollIntoView({ behavior: 'smooth' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
BIN
assets/pasted-20251209-170359-0530c7e3.jpg
Normal file
BIN
assets/pasted-20251209-170359-0530c7e3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
assets/pasted-20251209-173018-34888b32.png
Normal file
BIN
assets/pasted-20251209-173018-34888b32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 313 KiB |
BIN
assets/vm-shot-2025-12-09T17-03-51-445Z.jpg
Normal file
BIN
assets/vm-shot-2025-12-09T17-03-51-445Z.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
169
contact.php
Normal file
169
contact.php
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
require_once 'includes/pexels.php';
|
||||||
|
$query = 'contact';
|
||||||
|
$orientation = 'landscape';
|
||||||
|
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($query) . '&orientation=' . urlencode($orientation) . '&per_page=1&page=1';
|
||||||
|
$data = pexels_get($url);
|
||||||
|
$hero_image_url = '';
|
||||||
|
if ($data && !empty($data['photos'])) {
|
||||||
|
$photo = $data['photos'][0];
|
||||||
|
$src = $photo['src']['large2x'] ?? ($photo['src']['large'] ?? $photo['src']['original']);
|
||||||
|
$target = __DIR__ . '/assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
download_to($src, $target);
|
||||||
|
$hero_image_url = 'assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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>
|
||||||
|
<!-- SEO and Meta Tags -->
|
||||||
|
<meta name="description" content="Get in touch with us for any questions or feedback.">
|
||||||
|
<meta name="keywords" content="contact, support, feedback, help">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
|
||||||
|
<!-- Custom CSS -->
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.hero-section {
|
||||||
|
background-image: url('<?php echo $hero_image_url; ?>');
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light fixed-top transparent-nav">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">👵 Grandma's Getaway</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto align-items-center">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="index.php#how-it-works">How It Works</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="index.php#features">For Parents</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="index.php#features">For Caregivers</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" href="contact.php">Contact</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item ms-lg-3">
|
||||||
|
<a class="nav-link" href="register.php">Register</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="login.php">Sign In</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section class="hero-section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-10 offset-md-1">
|
||||||
|
<h1>Get In Touch</h1>
|
||||||
|
<p class="lead">We'd love to hear from you. Send us a message and we'll respond as soon as possible.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 offset-md-2">
|
||||||
|
<div class="card p-5 shadow-lg border-0" style="border-radius: 15px;">
|
||||||
|
<h2 class="text-center mb-4">Contact Form</h2>
|
||||||
|
<?php if ($message) echo $message; ?>
|
||||||
|
<form action="contact.php" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Name</label>
|
||||||
|
<input type="text" class="form-control form-control-lg" id="name" name="name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control form-control-lg" id="email" name="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="message" class="form-label">Message</label>
|
||||||
|
<textarea class="form-control form-control-lg" id="message" name="message" rows="5" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid gap-2 d-md-flex justify-content-md-between">
|
||||||
|
<a href="index.php" class="btn btn-secondary btn-lg">Back to Home</a>
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>© <?php echo date("Y"); ?> <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Grandma\'s Getaway'); ?>. All Rights Reserved.</p>
|
||||||
|
<p>
|
||||||
|
<a href="#">Privacy Policy</a> |
|
||||||
|
<a href="#">Terms of Service</a> |
|
||||||
|
<a href="contact.php">Contact Us</a>
|
||||||
|
p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('scroll', function() {
|
||||||
|
const header = document.querySelector('.transparent-nav');
|
||||||
|
if (window.scrollY > 50) {
|
||||||
|
header.classList.add('scrolled');
|
||||||
|
} else {
|
||||||
|
header.classList.remove('scrolled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
31
db/migrate.php
Normal file
31
db/migrate.php
Normal 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();
|
||||||
|
|
||||||
12
db/migrations/001_create_users_table.sql
Normal file
12
db/migrations/001_create_users_table.sql
Normal 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;
|
||||||
25
includes/pexels.php
Normal file
25
includes/pexels.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
function pexels_key() {
|
||||||
|
$k = getenv('PEXELS_KEY');
|
||||||
|
return $k && strlen($k) > 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18';
|
||||||
|
}
|
||||||
|
function pexels_get($url) {
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt_array($ch, [
|
||||||
|
CURLOPT_URL => $url,
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ],
|
||||||
|
CURLOPT_TIMEOUT => 15,
|
||||||
|
]);
|
||||||
|
$resp = curl_exec($ch);
|
||||||
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function download_to($srcUrl, $destPath) {
|
||||||
|
$data = file_get_contents($srcUrl);
|
||||||
|
if ($data === false) return false;
|
||||||
|
if (!is_dir(dirname($destPath))) mkdir(dirname($destPath), 0775, true);
|
||||||
|
return file_put_contents($destPath, $data) !== false;
|
||||||
|
}
|
||||||
327
index.php
327
index.php
@ -1,150 +1,211 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
ini_set('display_errors', 1);
|
||||||
@ini_set('display_errors', '1');
|
ini_set('display_startup_errors', 1);
|
||||||
@error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
require_once 'includes/pexels.php';
|
||||||
$now = date('Y-m-d H:i:s');
|
$query = 'family';
|
||||||
|
$orientation = 'landscape';
|
||||||
|
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($query) . '&orientation=' . urlencode($orientation) . '&per_page=1&page=1';
|
||||||
|
$data = pexels_get($url);
|
||||||
|
$hero_image_url = '';
|
||||||
|
if ($data && !empty($data['photos'])) {
|
||||||
|
$photo = $data['photos'][0];
|
||||||
|
$src = $photo['src']['large2x'] ?? ($photo['src']['large'] ?? $photo['src']['original']);
|
||||||
|
$target = __DIR__ . '/assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
download_to($src, $target);
|
||||||
|
$hero_image_url = 'assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
|
||||||
<?php
|
<!-- SEO and Meta Tags -->
|
||||||
// Read project preview data from environment
|
<title><?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Grandma\'s Getaway'); ?></title>
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta name="description" content="<?php echo htmlspecialchars(getenv('PROJECT_DESCRIPTION') ?: 'Connecting parents with amazing grandparent-like caregivers for your children.'); ?>">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta name="keywords" content="child care, babysitting, grandparents, caregivers, vacation, family">
|
||||||
?>
|
<meta name="author" content="Flatlogic">
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
<!-- Open Graph / Facebook -->
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
<meta property="og:type" content="website">
|
||||||
<!-- Open Graph meta tags -->
|
<meta property="og:title" content="<?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Grandma\'s Getaway'); ?>">
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<meta property="og:description" content="<?php echo htmlspecialchars(getenv('PROJECT_DESCRIPTION') ?: 'Connecting parents with amazing grandparent-like caregivers for your children.'); ?>">
|
||||||
<!-- Twitter meta tags -->
|
<meta property="og:image" content="<?php echo htmlspecialchars(getenv('PROJECT_IMAGE_URL') ?: ''); ?>">
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
<!-- Twitter -->
|
||||||
<?php if ($projectImageUrl): ?>
|
<meta property="twitter:card" content="summary_large_image">
|
||||||
<!-- Open Graph image -->
|
<meta property="twitter:title" content="<?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Grandma\'s Getaway'); ?>">
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<meta property="twitter:description" content="<?php echo htmlspecialchars(getenv('PROJECT_DESCRIPTION') ?: 'Connecting parents with amazing grandparent-like caregivers for your children.'); ?>">
|
||||||
<!-- Twitter image -->
|
<meta property="twitter:image" content="<?php echo htmlspecialchars(getenv('PROJECT_IMAGE_URL') ?: ''); ?>">
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
<!-- Favicon -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👵</text></svg>">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<!-- Bootstrap CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
|
||||||
|
<!-- Custom CSS -->
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:root {
|
.hero-section {
|
||||||
--bg-color-start: #6a11cb;
|
background-image: url('<?php echo $hero_image_url; ?>');
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light fixed-top transparent-nav">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="#">👵 Grandma's Getaway</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto align-items-center">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#how-it-works">How It Works</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#features">For Parents</a>
|
||||||
|
</li>
|
||||||
|
<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="nav-link" href="register.php">Register</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="login.php">Sign In</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="card">
|
<section class="hero-section">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="row">
|
||||||
<span class="sr-only">Loading…</span>
|
<div class="col-md-10 offset-md-1">
|
||||||
|
<h1>Vacation for you. A joy for them.</h1>
|
||||||
|
<p class="lead">Connect with experienced, loving grandparent-like figures for your children's care. Peace of mind for you, unforgettable moments for them.</p>
|
||||||
|
<a href="#search-widget" class="btn btn-primary btn-lg me-2">Find a Caregiver</a>
|
||||||
|
<a href="#" class="btn btn-secondary btn-lg">Become a Caregiver</a>
|
||||||
</div>
|
</div>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="how-it-works" class="section">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="section-title">How It Works</h2>
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="how-it-works-icon"><i class="bi bi-search"></i></div>
|
||||||
|
<h3>1. Search</h3>
|
||||||
|
<p>Browse profiles of trusted caregivers in your destination. Read reviews and find the perfect match for your family.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="how-it-works-icon"><i class="bi bi-calendar-check"></i></div>
|
||||||
|
<h3>2. Book</h3>
|
||||||
|
<p>Select your dates and send a booking request. Communicate directly and securely with your chosen caregiver.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="how-it-works-icon"><i class="bi bi-balloon-heart"></i></div>
|
||||||
|
<h3>3. Relax</h3>
|
||||||
|
<p>Enjoy your vacation knowing your children are in safe, caring hands, making happy memories.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="features" class="section bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="section-title">A Perfect Match for Everyone</h2>
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="feature-card">
|
||||||
|
<div class="icon"><i class="bi bi-people"></i></div>
|
||||||
|
<h4>For Parents</h4>
|
||||||
|
<p>Find vetted, experienced, and insured caregivers who bring warmth and wisdom. Enjoy flexible booking and secure payments for a worry-free vacation.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="feature-card">
|
||||||
|
<div class="icon"><i class="bi bi-person-heart"></i></div>
|
||||||
|
<h4>For Caregivers</h4>
|
||||||
|
<p>Share your love and experience with children. Earn extra income on your own schedule and create joyful connections with families.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="search-widget" class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 offset-md-2">
|
||||||
|
<h2 class="section-title">Find Your Perfect Caregiver</h2>
|
||||||
|
<form>
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input type="text" class="form-control form-control-lg" placeholder="Location (e.g., 'Paris, France')">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input type="text" class="form-control form-control-lg" placeholder="Dates (e.g., 'Dec 20 - Jan 3')">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg w-100">Search</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>© <?php echo date("Y"); ?> <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: 'Grandma\'s Getaway'); ?>. All Rights Reserved.</p>
|
||||||
|
<p>
|
||||||
|
<a href="#">Privacy Policy</a> |
|
||||||
|
<a href="#">Terms of Service</a> |
|
||||||
|
<a href="contact.php">Contact Us</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('scroll', function() {
|
||||||
|
const header = document.querySelector('.transparent-nav');
|
||||||
|
if (window.scrollY > 50) {
|
||||||
|
header.classList.add('scrolled');
|
||||||
|
} else {
|
||||||
|
header.classList.remove('scrolled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
161
login.php
Normal file
161
login.php
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
require_once 'includes/pexels.php';
|
||||||
|
|
||||||
|
// --- Login Logic ---
|
||||||
|
$message = '';
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
$username = $_POST['username'];
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
if (empty($username) || empty($password)) {
|
||||||
|
$message = 'Please fill in all fields.';
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$db = db();
|
||||||
|
$stmt = $db->prepare("SELECT * FROM users WHERE username = ?");
|
||||||
|
$stmt->execute([$username]);
|
||||||
|
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password_hash'])) {
|
||||||
|
$_SESSION['user_id'] = $user['id'];
|
||||||
|
$_SESSION['username'] = $user['username'];
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$message = 'Invalid username or password.';
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$message = 'Error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Pexels Hero Image ---
|
||||||
|
$query = 'secure';
|
||||||
|
$orientation = 'landscape';
|
||||||
|
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($query) . '&orientation=' . urlencode($orientation) . '&per_page=1&page=1';
|
||||||
|
$data = pexels_get($url);
|
||||||
|
$hero_image_url = '';
|
||||||
|
if ($data && !empty($data['photos'])) {
|
||||||
|
$photo = $data['photos'][0];
|
||||||
|
$src = $photo['src']['large2x'] ?? ($photo['src']['large'] ?? $photo['src']['original']);
|
||||||
|
$target = __DIR__ . '/assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
download_to($src, $target);
|
||||||
|
$hero_image_url = 'assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Login - <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: "Grandma's Getaway"); ?></title>
|
||||||
|
|
||||||
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👵</text></svg>">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.hero-section {
|
||||||
|
background-image: url('<?php echo $hero_image_url; ?>');
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light fixed-top transparent-nav">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">👵 Grandma's Getaway</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto align-items-center">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="index.php#how-it-works">How It Works</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="nav-link" href="register.php">Register</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="login.php">Sign In</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<!-- Hero Section -->
|
||||||
|
<section class="hero-section">
|
||||||
|
<div class="container">
|
||||||
|
<h1>Secure Login</h1>
|
||||||
|
<p class="lead">Welcome back! Access your account below.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Login Form Section -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-5 col-md-8">
|
||||||
|
<div class="card shadow-lg border-0 rounded-lg">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<h2 class="card-title text-center mb-4">Sign In</h2>
|
||||||
|
<?php if (!empty($message)): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?php echo htmlspecialchars($message); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="login.php" method="post">
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="username" class="form-label">Username</label>
|
||||||
|
<input type="text" class="form-control form-control-lg" id="username" name="username" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control form-control-lg" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Login</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<a href="index.php" class="text-decoration-none">← Back to Home</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>© <?php echo date("Y"); ?> <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: "Grandma's Getaway"); ?>. All Rights Reserved.</p>
|
||||||
|
<p>
|
||||||
|
<a href="#">Privacy Policy</a> |
|
||||||
|
<a href="#">Terms of Service</a> |
|
||||||
|
<a href="contact.php">Contact Us</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('scroll', function() {
|
||||||
|
const header = document.querySelector('.transparent-nav');
|
||||||
|
if (window.scrollY > 50) {
|
||||||
|
header.classList.add('scrolled');
|
||||||
|
} else {
|
||||||
|
header.classList.remove('scrolled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
169
register.php
Normal file
169
register.php
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
require_once 'includes/pexels.php';
|
||||||
|
|
||||||
|
// --- Registration Logic ---
|
||||||
|
$message = '';
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$username = trim($_POST['username']);
|
||||||
|
$email = trim($_POST['email']);
|
||||||
|
$password = $_POST['password'];
|
||||||
|
|
||||||
|
if (empty($username) || empty($email) || empty($password)) {
|
||||||
|
$message = 'Please fill in all fields.';
|
||||||
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$message = 'Invalid email format.';
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username OR email = :email");
|
||||||
|
$stmt->execute(['username' => $username, 'email' => $email]);
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
$message = 'Username or email already taken.';
|
||||||
|
} else {
|
||||||
|
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO users (username, email, password_hash) VALUES (:username, :email, :password_hash)");
|
||||||
|
if ($stmt->execute(['username' => $username, 'email' => $email, 'password_hash' => $password_hash])) {
|
||||||
|
$message = 'Registration successful! You can now <a href="login.php">log in</a>.';
|
||||||
|
} else {
|
||||||
|
$message = 'An error occurred. Please try again.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log('Registration failed: ' . $e->getMessage());
|
||||||
|
$message = 'An error occurred. Please try again later.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Pexels Hero Image ---
|
||||||
|
$query = 'join us';
|
||||||
|
$orientation = 'landscape';
|
||||||
|
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($query) . '&orientation=' . urlencode($orientation) . '&per_page=1&page=1';
|
||||||
|
$data = pexels_get($url);
|
||||||
|
$hero_image_url = '';
|
||||||
|
if ($data && !empty($data['photos'])) {
|
||||||
|
$photo = $data['photos'][0];
|
||||||
|
$src = $photo['src']['large2x'] ?? ($photo['src']['large'] ?? $photo['src']['original']);
|
||||||
|
$target = __DIR__ . '/assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
download_to($src, $target);
|
||||||
|
$hero_image_url = 'assets/images/pexels/' . $photo['id'] . '.jpg';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Register - <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: "Grandma's Getaway"); ?></title>
|
||||||
|
|
||||||
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>👵</text></svg>">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.hero-section {
|
||||||
|
background-image: url('<?php echo $hero_image_url; ?>');
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- Header -->
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light fixed-top transparent-nav">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">👵 Grandma's Getaway</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto align-items-center">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="index.php#how-it-works">How It Works</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="nav-link" href="register.php">Register</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="login.php">Sign In</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<!-- Hero Section -->
|
||||||
|
<section class="hero-section">
|
||||||
|
<div class="container">
|
||||||
|
<h1>Join Us</h1>
|
||||||
|
<p class="lead">Create your account to get started.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Registration Form Section -->
|
||||||
|
<section class="section">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-6 col-md-8">
|
||||||
|
<div class="card shadow-lg border-0 rounded-lg">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<h2 class="card-title text-center mb-4">Create an Account</h2>
|
||||||
|
<?php if ($message): ?>
|
||||||
|
<div class="alert alert-info"><?php echo $message; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<form action="register.php" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="username" class="form-label">Username</label>
|
||||||
|
<input type="text" class="form-control form-control-lg" id="username" name="username" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control form-control-lg" id="email" name="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control form-control-lg" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Register</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="text-center mt-4">
|
||||||
|
<p>Already have an account? <a href="login.php">Sign In</a></p>
|
||||||
|
<a href="index.php" class="text-decoration-none">← Back to Home</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p>© <?php echo date("Y"); ?> <?php echo htmlspecialchars(getenv('PROJECT_NAME') ?: "Grandma's Getaway"); ?>. All Rights Reserved.</p>
|
||||||
|
<p>
|
||||||
|
<a href="#">Privacy Policy</a> |
|
||||||
|
<a href="#">Terms of Service</a> |
|
||||||
|
<a href="contact.php">Contact Us</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('scroll', function() {
|
||||||
|
const header = document.querySelector('.transparent-nav');
|
||||||
|
if (window.scrollY > 50) {
|
||||||
|
header.classList.add('scrolled');
|
||||||
|
} else {
|
||||||
|
header.classList.remove('scrolled');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user