30971-vm/index.php
Flatlogic Bot f2c0bb39c0 v1
2025-10-16 13:19:27 +00:00

194 lines
9.8 KiB
PHP

<?php
require_once __DIR__ . '/db/config.php';
// Run migrations on initial load
try {
run_migrations();
} catch (Exception $e) {
error_log('Could not run migrations: ' . $e->getMessage());
// Optional: add a user-facing error message if the DB is critical for the page to load.
}
// Fetch all site content
$pdo = db();
$content = [];
try {
$stmt = $pdo->query("SELECT section_key, section_value FROM site_content");
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$content[$row['section_key']] = $row['section_value'];
}
} catch (PDOException $e) {
error_log('Could not fetch site content: ' . $e->getMessage());
}
$about_me_content = $content['about_me'] ?? 'Welcome to your portfolio! You can edit this text in the admin panel.';
$hero_title = $content['hero_title'] ?? 'Creative Developer & Designer';
$hero_subtitle = $content['hero_subtitle'] ?? 'I build beautiful and functional websites.';
// Fetch portfolio items
$portfolio_items = [];
try {
$portfolio_items = $pdo->query("SELECT * FROM portfolio_items ORDER BY sort_order ASC, created_at DESC")->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
error_log('Could not fetch portfolio items: ' . $e->getMessage());
}
$project_name = "Personal Portfolio";
$project_description = "Showcase Your Work and Connect: A Personal Portfolio to Impress and Engage with Potential Clients.";
$project_keywords = "personal portfolio, creative portfolio, web developer portfolio, designer portfolio, online resume, contact form, project showcase, freelance portfolio";
$project_image_url = "https://project-screens.s3.amazonaws.com/screenshots/30971/app-hero-20251016-105317.png";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlspecialchars($project_name); ?></title>
<meta name="description" content="<?php echo htmlspecialchars($project_description); ?>">
<meta name="keywords" content="<?php echo htmlspecialchars($project_keywords); ?>">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content="<?php echo htmlspecialchars($project_name); ?>">
<meta property="og:description" content="<?php echo htmlspecialchars($project_description); ?>">
<meta property="og:image" content="<?php echo htmlspecialchars($project_image_url); ?>">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:title" content="<?php echo htmlspecialchars($project_name); ?>">
<meta property="twitter:description" content="<?php echo htmlspecialchars($project_description); ?>">
<meta property="twitter:image" content="<?php echo htmlspecialchars($project_image_url); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body data-bs-spy="scroll" data-bs-target="#navbarNav" data-bs-offset="100">
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#home">Your Name</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">
<li class="nav-item"><a class="nav-link active" href="#home">Home</a></li>
<li class="nav-item"><a class="nav-link" href="#about">About</a></li>
<li class="nav-item"><a class="nav-link" href="#portfolio">Portfolio</a></li>
<li class="nav-item"><a class="nav-link" href="blog.php">Blog</a></li>
<li class="nav-item"><a class="nav-link" href="#contact">Contact</a></li>
<li class="nav-item"><a class="nav-link" href="/admin" target="_blank">Admin</a></li>
</ul>
</div>
</div>
</nav>
<header id="home" class="hero text-center">
<div class="container">
<h1 class="display-4"><?php echo htmlspecialchars($hero_title); ?></h1>
<p class="lead"><?php echo htmlspecialchars($hero_subtitle); ?></p>
<a href="#portfolio" class="btn btn-primary btn-lg mt-3">View My Work</a>
</div>
</header>
<main>
<section id="about">
<div class="container">
<div class="glass-card">
<div class="row align-items-center">
<div class="col-lg-4 text-center">
<img src="https://picsum.photos/id/237/300/300" class="img-fluid rounded-circle mb-4 mb-lg-0" alt="Your Name">
</div>
<div class="col-lg-8">
<h2 class="section-title mb-4">About Me</h2>
<p class="lead"><?php echo nl2br(htmlspecialchars($about_me_content)); ?></p>
</div>
</div>
</div>
</div>
</section>
<section id="portfolio">
<div class="container">
<h2 class="section-title">Portfolio</h2>
<div class="row">
<?php if (empty($portfolio_items)): ?>
<div class="col-12 text-center">
<div class="glass-card">
<p>No portfolio items have been added yet. Check back soon!</p>
</div>
</div>
<?php else: ?>
<?php foreach ($portfolio_items as $item): ?>
<div class="col-md-4 portfolio-item">
<div class="card h-100">
<img src="<?php echo htmlspecialchars($item['image_url'] ?: 'https://picsum.photos/seed/'.htmlspecialchars($item['id']).'/600/400'); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($item['title']); ?>">
<div class="card-body d-flex flex-column">
<h5 class="card-title"><?php echo htmlspecialchars($item['title']); ?></h5>
<p class="card-text"><?php echo nl2br(htmlspecialchars($item['description'])); ?></p>
<?php if (!empty($item['project_url'])): ?>
<a href="<?php echo htmlspecialchars($item['project_url']); ?>" class="btn btn-sm btn-outline-primary mt-auto" target="_blank" rel="noopener noreferrer">Learn More</a>
<?php endif; ?>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</section>
<section id="contact">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="glass-card">
<h2 class="section-title">Get In Touch</h2>
<form id="contactForm" novalidate>
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Your 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" placeholder="Your Email" required>
</div>
<div class="mb-3">
<label for="message" class="form-label">Message</label>
<textarea class="form-control" id="message" name="message" rows="5" placeholder="Your Message" required></textarea>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary">Send Message</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
</main>
<footer class="text-center">
<div class="container">
<div class="mb-3">
<a href="#" class="text-white mx-2"><i data-feather="twitter"></i></a>
<a href="#" class="text-white mx-2"><i data-feather="linkedin"></i></a>
<a href="#" class="text-white mx-2"><i data-feather="github"></i></a>
</div>
<p>&copy; <?php echo date("Y"); ?> Your Name. All Rights Reserved. | <a href="privacy.php">Privacy Policy</a></p>
</div>
</footer>
<div id="toast-container" class="toast-container"></div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
<script>
feather.replace();
</script>
</body>
</html>