Thank you for applying for the position of " . htmlspecialchars($job['title']) . " at CosmicHire.
"
+ . "
We have received your application and will be in touch shortly if your qualifications match our requirements.
"
+ . "
Best regards, The CosmicHire Team
";
+ $applicant_text_content = "Dear " . $name . ",\n\nThank you for applying for the position of " . $job['title'] . " at CosmicHire.\n\nWe have received your application and will be in touch shortly if your qualifications match our requirements.\n\nBest regards,\nThe CosmicHire Team";
+
+ MailService::sendMail($email, $applicant_subject, $applicant_html_content, $applicant_text_content);
+
+ $success_message = 'Your application has been submitted successfully! A confirmation email has been sent to you.';
+ } else {
+ $error_message = 'Your application was saved, but there was an error sending the notification email.';
+ // Optional: Log the detailed error: error_log($result['error']);
+ }
+ } catch (PDOException $e) {
+ $error_message = 'There was a database error. Please try again later.';
+ // Optional: Log the detailed error: error_log($e->getMessage());
+ }
+ } else {
+ $error_message = 'There was an error uploading your resume. Please try again.';
+ }
+ }
+}
+?>
+
+
+
+
+
+
+ Apply for - CosmicHire
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/job-details.php b/job-details.php
index 2a419a1..c4bf0ff 100644
--- a/job-details.php
+++ b/job-details.php
@@ -5,103 +5,21 @@ header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: 0");
-// Simulate fetching job data based on an ID from the URL
-$jobs = [
- [
- 'id' => 1,
- 'title' => 'Senior Product Manager',
- 'department' => 'Product',
- 'location' => 'Remote',
- 'description' => 'We are looking for an experienced Senior Product Manager to help us build the future of HR technology. You will be responsible for the product planning and execution throughout the Product Lifecycle, including: gathering and prioritizing product and customer requirements, defining the product vision, and working closely with engineering, sales, marketing and support to ensure revenue and customer satisfaction goals are met.',
- 'requirements' => [
- '5+ years of product management experience',
- 'Demonstrated success defining and launching excellent products',
- 'Excellent written and verbal communication skills',
- 'Bachelor’s degree (MBA preferred)',
- 'Technical background, with experience in SaaS',
- 'Excellent teamwork skills',
- ],
- 'benefits' => [
- 'Competitive salary and equity',
- 'Comprehensive health, dental, and vision insurance',
- 'Unlimited paid time off',
- 'Remote work stipend',
- 'Annual team offsites',
- ]
- ],
- [
- 'id' => 2,
- 'title' => 'Lead Software Engineer (Backend)',
- 'department' => 'Engineering',
- 'location' => 'New York, NY',
- 'description' => 'As a Lead Software Engineer, you will be a key member of our engineering team, responsible for designing, developing, and deploying our backend services. You will work with a modern tech stack and have a significant impact on our product's architecture and performance.',
- 'requirements' => [
- '8+ years of software development experience',
- 'Expertise in PHP, Python, or similar languages',
- 'Strong understanding of database design and SQL',
- 'Experience with cloud platforms (AWS, GCP, Azure)',
- 'Proven leadership and mentoring skills',
- ],
- 'benefits' => [
- 'Competitive salary and equity',
- 'Comprehensive health, dental, and vision insurance',
- '401(k) with company match',
- 'Commuter benefits',
- 'Catered lunches',
- ]
- ],
- [
- 'id' => 3,
- 'title' => 'UX/UI Designer',
- 'department' => 'Design',
- 'location' => 'Remote',
- 'description' => 'We are seeking a talented UX/UI Designer to create amazing user experiences. The ideal candidate should have an eye for clean and artful design, possess superior UX/UI skills and be able to translate high-level requirements into interaction flows and artifacts, and transform them into beautiful, intuitive, and functional user interfaces.',
- 'requirements' => [
- '3+ years of UX/UI design experience',
- 'A strong portfolio of design projects',
- 'Proficiency in Figma, Sketch, or other visual design and wire-framing tools',
- 'Experience in creating wireframes, storyboards, user flows, process flows and site maps',
- 'Excellent visual design skills with sensitivity to user-system interaction',
- ],
- 'benefits' => [
- 'Competitive salary',
- 'Flexible work hours',
- 'Health and wellness stipend',
- 'Remote work stipend',
- 'Opportunities for professional development',
- ]
- ],
- [
- 'id' => 4,
- 'title' => 'Marketing Manager',
- 'department' => 'Marketing',
- 'location' => 'San Francisco, CA',
- 'description' => 'We are looking for a results-driven Marketing Manager to join our growing team. You will be responsible for developing and implementing marketing strategies to increase brand awareness and drive lead generation. This is a great opportunity for someone who is passionate about marketing and technology.',
- 'requirements' => [
- '5+ years of marketing experience in the tech industry',
- 'Proven experience in developing and executing marketing campaigns',
- 'Strong understanding of digital marketing channels (SEO, SEM, social media, etc.)',
- 'Excellent analytical and communication skills',
- 'Bachelor's degree in Marketing or related field',
- ],
- 'benefits' => [
- 'Competitive salary and performance bonuses',
- 'Comprehensive health, dental, and vision insurance',
- 'Generous PTO and paid holidays',
- '401(k) with company match',
- 'A vibrant and collaborative work environment',
- ]
- ],
-];
+require_once __DIR__ . '/db/config.php';
$job_id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$job = null;
-foreach ($jobs as $j) {
- if ($j['id'] === $job_id) {
- $job = $j;
- break;
- }
+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
@@ -135,60 +53,32 @@ $page_keywords = 'jobs, careers, hiring, ' . ($job ? htmlspecialchars($job['titl
-
+ }
+ }
+
+
+
@@ -264,7 +154,7 @@ $page_keywords = 'jobs, careers, hiring, ' . ($job ? htmlspecialchars($job['titl