📁 File Manager
Editing:
/home/wvl7mof7402e/public_html/remindyourdata.live/admin/ticket.php
<?php session_start(); include "dbconnect.php"; // Database Connection if ($_SERVER["REQUEST_METHOD"] == "POST") { $applicant_id = $_POST['applicant_id']; $from_location = $_POST['from_location']; $to_location = $_POST['to_location']; $distance = $_POST['distance']; $ticket_date = $_POST['ticket_date']; $amount = $_POST['amount']; $boarding_pass_path = null; if (isset($_FILES['boarding_pass']) && $_FILES['boarding_pass']['error'] == 0) { $boarding_pass_name = $_FILES['boarding_pass']['name']; $boarding_pass_tmp_name = $_FILES['boarding_pass']['tmp_name']; $boarding_pass_ext = pathinfo($boarding_pass_name, PATHINFO_EXTENSION); $allowed_extensions = ['jpg', 'jpeg', 'png', 'pdf']; if (in_array(strtolower($boarding_pass_ext), $allowed_extensions)) { $upload_dir = 'uploads/'; if (!file_exists($upload_dir)) { mkdir($upload_dir, 0777, true); // Create directory if not exists } $boarding_pass_path = $upload_dir . uniqid() . '_' . basename($boarding_pass_name); move_uploaded_file($boarding_pass_tmp_name, $boarding_pass_path); } else { echo "<script>alert('Invalid file type. Only JPG, PNG, and PDF allowed.');</script>"; exit; } } $sql = "INSERT INTO Ticketing (job_applicant_id, from_location, to_location, distance, ticket_date, boarding_pass_upload, amount) VALUES (?, ?, ?, ?, ?, ?, ?)"; $stmt = $con->prepare($sql); $stmt->bind_param("ississs", $applicant_id, $from_location, $to_location, $distance, $ticket_date, $boarding_pass_path, $amount); if ($stmt->execute()) { echo "<script>alert('Ticket record added successfully!'); window.location.href = 'ticket.php';</script>"; } else { echo "<script>alert('Error: " . $stmt->error . "');</script>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Add Ticket</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap CSS and Icons --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet"> <style> body { min-height: 100vh; margin: 0; padding: 0; font-family: 'Segoe UI', sans-serif; background: linear-gradient(135deg, #00c6ff, #0072ff, #00c6ff, #0072ff); background-size: 400% 400%; animation: gradientAnimation 15s ease infinite; } @keyframes gradientAnimation { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } } .container { max-width: 600px; margin: 90px auto 60px; background-color: #ffffff; padding: 30px 25px; border-radius: 16px; box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1); } h3 { text-align: center; font-weight: 700; margin-bottom: 30px; color: #0072ff; } .form-group label { font-weight: 600; } .form-control { border-radius: 10px; padding: 10px 15px; } .form-control:focus { border-color: #0072ff; box-shadow: 0 0 0 0.2rem rgba(0, 114, 255, 0.25); } .btn-primary { background-color: #0072ff; border: none; border-radius: 30px; padding: 10px 20px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; } .btn-primary:hover { background-color: #0056b3; } .logout-btn { position: fixed; top: 15px; right: 20px; z-index: 1000; } .logout-btn button { background-color: #dc3545; color: white; border: none; padding: 8px 16px; border-radius: 25px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 6px; } .logout-btn button:hover { background-color: #c82333; } @media (max-width: 576px) { .container { margin: 110px 15px 50px; padding: 20px; } .logout-btn button { font-size: 13px; padding: 6px 12px; } } </style> </head> <body> <!-- Logout Button --> <div class="logout-btn"> <form action="logout.php" method="post"> <button type="submit"><i class="bi bi-box-arrow-right"></i> Logout</button> </form> </div> <!-- Ticket Form --> <div class="container"> <h3><i class="bi bi-ticket-perforated-fill"></i> Add Ticket Details</h3> <form method="POST" enctype="multipart/form-data"> <div class="form-group mb-3"> <label for="applicant_id"><i class="bi bi-person-fill"></i> Select Applicant</label> <select name="applicant_id" id="applicant_id" class="form-control" required> <option value="">-- Select Applicant --</option> <?php $sql = "SELECT id, name, passport_no FROM job_applicants"; $result = $con->query($sql); while ($row = $result->fetch_assoc()) { echo '<option value="' . $row['id'] . '">' . htmlspecialchars($row['name']) . ' (' . htmlspecialchars($row['passport_no']) . ')</option>'; } ?> </select> </div> <div class="form-group mb-3"> <label for="from_location"><i class="bi bi-geo-alt-fill"></i> From Location</label> <input type="text" name="from_location" class="form-control" required> </div> <div class="form-group mb-3"> <label for="to_location"><i class="bi bi-geo-alt-fill"></i> To Location</label> <input type="text" name="to_location" class="form-control" required> </div> <div class="form-group mb-3"> <label for="distance"><i class="bi bi-signpost-fill"></i> Distance (in km)</label> <input type="number" name="distance" class="form-control" required> </div> <div class="form-group mb-3"> <label for="ticket_date"><i class="bi bi-calendar-event-fill"></i> Ticket Date</label> <input type="date" name="ticket_date" class="form-control" required> </div> <div class="form-group mb-3"> <label for="amount"><i class="bi bi-cash-coin"></i> Amount (Ticket Price)</label> <input type="number" name="amount" class="form-control" required> </div> <div class="form-group mb-4"> <label for="boarding_pass"><i class="bi bi-file-earmark-arrow-up-fill"></i> Upload Boarding Pass</label> <input type="file" name="boarding_pass" class="form-control" accept=".jpg,.jpeg,.png,.pdf"> </div> <div class="form-group text-center"> <button type="submit" class="btn btn-primary"> <i class="bi bi-save2-fill"></i> Add Ticket </button> </div> </form> </div> <!-- Bootstrap JS --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> </body> </html>
Save
Cancel