34148-vm/job-details.php
2025-09-17 15:46:15 +00:00

186 lines
8.1 KiB
PHP

<?php
// Disable caching
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: 0");
require_once __DIR__ . '/db/config.php';
$job_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$job = null;
if ($job_id > 0) {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM jobs WHERE id = ?");
$stmt->execute([$job_id]);
$job = $stmt->fetch();
}
if ($job) {
$job['requirements'] = json_decode($job['requirements'], true);
$job['benefits'] = json_decode($job['benefits'], true);
}
// SEO and page metadata
$page_title = $job ? htmlspecialchars($job['title']) . ' - CosmicHire' : 'Job Not Found';
$page_description = $job ? 'Apply for the ' . htmlspecialchars($job['title']) . ' position at CosmicHire. Location: ' . htmlspecialchars($job['location']) : 'The job you are looking for could not be found.';
$page_keywords = 'jobs, careers, hiring, ' . ($job ? htmlspecialchars($job['title']) : '');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo $page_title; ?></title>
<meta name="description" content="<?php echo $page_description; ?>">
<meta name="keywords" content="<?php echo $page_keywords; ?>">
<link rel="icon" href="https://flatlogic.com/assets/favicon.ico">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://flatlogic.com/">
<meta property="og:title" content="<?php echo $page_title; ?>">
<meta property="og:description" content="<?php echo $page_description; ?>">
<meta property="og:image" content="https://flatlogic.com/assets/share.png">
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="https://flatlogic.com/">
<meta property="twitter:title" content="<?php echo $page_title; ?>">
<meta property="twitter:description" content="<?php echo $page_description; ?>">
<meta property="twitter:image" content="https://flatlogic.com/assets/share.png">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<?php if ($job): ?>
<script type="application/ld+json">
{
"@context" : "https://schema.org/",
"@type" : "JobPosting",
"title" : "<?php echo htmlspecialchars($job['title']); ?>",
"description" : "<?php echo htmlspecialchars($job['description']); ?>",
"hiringOrganization" : {
"@type" : "Organization",
"name" : "CosmicHire",
"sameAs" : "https://flatlogic.com/",
"logo" : "https://flatlogic.com/assets/logo.svg"
},
"datePosted" : "<?php echo date('Y-m-d', strtotime($job['created_at'])); ?>",
"employmentType" : "<?php echo strtoupper(str_replace('-', '_', $job['type'])); ?>",
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "<?php echo htmlspecialchars($job['location']); ?>"
}
}
}
</script>
<?php endif; ?>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container">
<a class="navbar-brand" href="index.php">
<img src="https://flatlogic.com/assets/logo.svg" alt="CosmicHire Logo">
</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" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="careers.php">Open Positions</a>
</li>
</ul>
</div>
</div>
</nav>
<?php if ($job): ?>
<header class="job-header text-center">
<div class="container">
<p class="mb-2"><span class="badge bg-light text-dark"><?php echo htmlspecialchars($job['department']); ?></span></p>
<h1><?php echo htmlspecialchars($job['title']); ?></h1>
<p class="lead">
<i data-feather="map-pin" class="me-1" style="width: 1em; height: 1em;"></i> <?php echo htmlspecialchars($job['location']); ?>
</p>
</div>
</header>
<main class="container mt-5">
<nav aria-label="breadcrumb" class="mb-4">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item"><a href="careers.php">Careers</a></li>
<li class="breadcrumb-item active" aria-current="page"><?php echo htmlspecialchars($job['title']); ?></li>
</ol>
</nav>
<div class="row">
<div class="col-lg-8">
<div class="card p-4 mb-4">
<h2 class="h4 mb-3">Job Description</h2>
<p><?php echo nl2br(htmlspecialchars($job['description'])); ?></p>
<h2 class="h4 mt-4 mb-3">Requirements</h2>
<ul class="list-group list-group-flush">
<?php foreach ($job['requirements'] as $requirement): ?>
<li class="list-group-item d-flex align-items-start">
<i data-feather="check-circle" class="me-2 mt-1" style="width: 1.2em; height: 1.2em;"></i>
<span><?php echo htmlspecialchars($requirement); ?></span>
</li>
<?php endforeach; ?>
</ul>
<h2 class="h4 mt-4 mb-3">Benefits</h2>
<ul class="list-group list-group-flush">
<?php foreach ($job['benefits'] as $benefit): ?>
<li class="list-group-item d-flex align-items-start">
<i data-feather="gift" class="me-2 mt-1" style="width: 1.2em; height: 1.2em;"></i>
<span><?php echo htmlspecialchars($benefit); ?></span>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="col-lg-4">
<div class="card p-4 sticky-top" style="top: 20px;">
<h3 class="h5 mb-3">Interested?</h3>
<p class="text-muted">Apply now to join our team and make an impact.</p>
<a href="apply.php?id=<?php echo $job['id']; ?>" class="btn btn-primary w-100">Apply Now</a>
</div>
</div>
</div>
</main>
<?php else: ?>
<main class="container mt-5 text-center">
<div class="card p-5">
<h1 class="display-4">Job Not Found</h1>
<p class="lead">Sorry, the job you are looking for does not exist or has been filled.</p>
<a href="careers.php" class="btn btn-primary mt-3">View All Open Positions</a>
</div>
</main>
<?php endif; ?>
<footer class="text-center text-muted">
<div class="container">
<p>&copy; <?php echo date('Y'); ?> CosmicHire. All rights reserved.</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
<script>
feather.replace();
</script>
</body>
</html>